1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-06 14:46:36 +02:00

PostgreSQL PDO: Fix bytea without primary key (fix #1021)

This commit is contained in:
Jakub Vrana
2025-04-11 15:29:25 +02:00
parent 746c0a7b0b
commit 5eaaa498d3
3 changed files with 13 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
## Adminer dev
- Fix search anywhere (bug #1004, regression from 5.1.1)
- Fix import without primary key (bug #1017, regression from 5.1.1)
- PostgreSQL PDO: Fix bytea without primary key (bug #1021)
## Adminer 5.2.0 (released 2025-04-08)
- Autocomplete SQL commands

View File

@@ -197,10 +197,7 @@ abstract class SqlDriver {
* @param Field $field
*/
function value(?string $val, array $field): ?string {
return (method_exists($this->conn, 'value')
? $this->conn->value($val, $field)
: (is_resource($val) ? stream_get_contents($val) : $val)
);
return (method_exists($this->conn, 'value') ? $this->conn->value($val, $field) : $val);
}
/** Quote binary string */

View File

@@ -71,11 +71,20 @@ if (extension_loaded('pdo')) {
public $_offset = 0, $num_rows;
function fetch_assoc() {
return $this->fetch(\PDO::FETCH_ASSOC);
return $this->fetch_array(\PDO::FETCH_ASSOC);
}
function fetch_row() {
return $this->fetch(\PDO::FETCH_NUM);
return $this->fetch_array(\PDO::FETCH_NUM);
}
private function fetch_array(int $mode) {
$return = $this->fetch($mode);
return ($return ? array_map(array($this, 'unresource'), $return) : $return);
}
private function unresource($val) {
return (is_resource($val) ? stream_get_contents($val) : $val);
}
function fetch_field(): \stdClass {