more pdo tweaks
This commit is contained in:
parent
b4b5eb5bab
commit
e2e3b81f32
@ -14,7 +14,7 @@ class dba_pdo extends dba_driver {
|
|||||||
. ':host=' . $server . (is_null($port) ? '' : ';port=' . $port)
|
. ':host=' . $server . (is_null($port) ? '' : ';port=' . $port)
|
||||||
. ';dbname=' . $db;
|
. ';dbname=' . $db;
|
||||||
|
|
||||||
db_logger('dns: ' . $dns);
|
// db_logger('dns: ' . $dns);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->db = new PDO($dns,$user,$pass);
|
$this->db = new PDO($dns,$user,$pass);
|
||||||
@ -40,8 +40,11 @@ class dba_pdo extends dba_driver {
|
|||||||
if((! $this->db) || (! $this->connected))
|
if((! $this->db) || (! $this->connected))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if($this->driver_dbtype === 'pgsql' && (! strpos($sql,';')))
|
if($this->driver_dbtype === 'pgsql') {
|
||||||
$sql .= ';';
|
if(substr(rtrim($sql),-1,1) !== ';') {
|
||||||
|
$sql .= ';';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->error = '';
|
$this->error = '';
|
||||||
$select = ((stripos($sql,'select') === 0) ? true : false);
|
$select = ((stripos($sql,'select') === 0) ? true : false);
|
||||||
@ -113,6 +116,24 @@ class dba_pdo extends dba_driver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function escapebin($str) {
|
||||||
|
if($this->driver_dbtype === 'pgsql') {
|
||||||
|
return str_replace([ chr(92), chr(0), chr(39) ], [ '\\\134', '\\\000', '\\\047' ], $str);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $this->escape($str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function unescapebin($str) {
|
||||||
|
if($this->driver_dbtype === 'pgsql') {
|
||||||
|
return stripcslashes($str);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function getdriver() {
|
function getdriver() {
|
||||||
return 'pdo';
|
return 'pdo';
|
||||||
|
Reference in New Issue
Block a user