PostgreSQL: Unescape bytea fields
This commit is contained in:
parent
29c127e94a
commit
19653de764
|
@ -6,5 +6,5 @@ header("Content-Disposition: attachment; filename=" . friendly_url("$TABLE-" . i
|
|||
$select = array(idf_escape($_GET["field"]));
|
||||
$result = $driver->select($TABLE, $select, array(where($_GET, $fields)), $select);
|
||||
$row = ($result ? $result->fetch_row() : array());
|
||||
echo $row[0];
|
||||
echo $driver->value($row[0], $fields[$_GET["field"]]);
|
||||
exit; // don't output footer
|
||||
|
|
|
@ -40,6 +40,10 @@ if (isset($_GET["pgsql"])) {
|
|||
return "'" . pg_escape_string($this->_link, $string) . "'";
|
||||
}
|
||||
|
||||
function value($val, $field) {
|
||||
return ($field["type"] == "bytea" ? pg_unescape_bytea($val) : $val);
|
||||
}
|
||||
|
||||
function quoteBinary($string) {
|
||||
return "'" . pg_escape_bytea($this->_link, $string) . "'";
|
||||
}
|
||||
|
@ -151,6 +155,10 @@ if (isset($_GET["pgsql"])) {
|
|||
return ($adminer->database() == $database);
|
||||
}
|
||||
|
||||
function value($val, $field) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
function quoteBinary($s) {
|
||||
return q($s);
|
||||
}
|
||||
|
@ -196,6 +204,10 @@ if (isset($_GET["pgsql"])) {
|
|||
);
|
||||
}
|
||||
|
||||
function value($val, $field) {
|
||||
return $this->_conn->value($val, $field);
|
||||
}
|
||||
|
||||
function quoteBinary($s) {
|
||||
return $this->_conn->quoteBinary($s);
|
||||
}
|
||||
|
|
|
@ -123,6 +123,15 @@
|
|||
return $idf;
|
||||
}
|
||||
|
||||
/** Convert value returned by database to actual value
|
||||
* @param string
|
||||
* @param array
|
||||
* @return string
|
||||
*/
|
||||
function value($val, $field) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
/** Quote binary string
|
||||
* @param string
|
||||
* @return string
|
||||
|
|
|
@ -391,6 +391,7 @@ if (!$columns && support("table")) {
|
|||
foreach ($row as $key => $val) {
|
||||
if (isset($names[$key])) {
|
||||
$field = $fields[$key];
|
||||
$val = $driver->value($val, $field);
|
||||
if ($val != "" && (!isset($email_fields[$key]) || $email_fields[$key] != "")) {
|
||||
$email_fields[$key] = (is_mail($val) ? $names[$key] : ""); //! filled e-mails can be contained on other pages
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Adminer 4.6.1-dev:
|
||||
MySQL: Support non-utf8 charset in search in column
|
||||
MySQL: Support geometry in MySQL 8 (bug #574)
|
||||
PostgreSQL: Upload binary files to bytea fields
|
||||
PostgreSQL: Support binary files in bytea fields
|
||||
PostgreSQL: Cast to string when searching using LIKE (bug #325)
|
||||
PostgreSQL: Don't treat interval type as number (bug #474)
|
||||
PostgreSQL: Fix condition for selecting no rows
|
||||
|
|
Loading…
Reference in a new issue