pdo hacks
This commit is contained in:
parent
04ac04e0ad
commit
d30892ea60
@ -53,7 +53,14 @@ class DBA {
|
|||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(!($port))
|
|
||||||
|
// attempt to use the pdo driver compiled-in mysqli socket
|
||||||
|
// if using 'localhost' with no port configured.
|
||||||
|
// If this is wrong you'll need to set the socket path specifically
|
||||||
|
// using a server name of 'mysql:unix_socket=/socket/path', setting /socket/path
|
||||||
|
// as needed for your platform
|
||||||
|
|
||||||
|
if((!($port)) && ($server !== 'localhost'))
|
||||||
$port = 3306;
|
$port = 3306;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ class dba_pdo extends dba_driver {
|
|||||||
return 'string_agg(' . $fld . ',\'' . $sep . '\')';
|
return 'string_agg(' . $fld . ',\'' . $sep . '\')';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return 'GROUP_CONCAT(DISTINCT '.$fld.' SEPARATOR \''.$sep.'\')';
|
return 'GROUP_CONCAT(DISTINCT ' . $fld . ' SEPARATOR \'' . $sep . '\')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,9 +120,12 @@ class dba_pdo extends dba_driver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// These two functions assume that postgres standard_conforming_strings is set to off;
|
||||||
|
// which we perform during DB open.
|
||||||
|
|
||||||
function escapebin($str) {
|
function escapebin($str) {
|
||||||
if($this->driver_dbtype === 'pgsql') {
|
if($this->driver_dbtype === 'pgsql') {
|
||||||
return str_replace([ chr(92), chr(0), chr(39) ], [ '\\\134', '\\\000', '\\\047' ], $str);
|
return "\\\\x" . bin2hex($str);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return $this->escape($str);
|
return $this->escape($str);
|
||||||
@ -131,7 +134,11 @@ class dba_pdo extends dba_driver {
|
|||||||
|
|
||||||
function unescapebin($str) {
|
function unescapebin($str) {
|
||||||
if($this->driver_dbtype === 'pgsql') {
|
if($this->driver_dbtype === 'pgsql') {
|
||||||
return stripcslashes($str);
|
|
||||||
|
// The initial backslash inserted by escapebin above will have been stripped
|
||||||
|
// by the postgres server, leaving us with '\x{hexdigits}'
|
||||||
|
|
||||||
|
return hex2bin(substr($str,2));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return $str;
|
return $str;
|
||||||
|
Reference in New Issue
Block a user