aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2016-10-20 16:13:06 -0700
committerzotlabs <mike@macgirvin.com>2016-10-20 16:13:06 -0700
commite2e3b81f323957495a643a9087b663df03dac2d9 (patch)
tree64ee9476bba6da2a6e9eccb1234aeefcaa0df16b /include
parentb4b5eb5babcfd01f41e3df39400758422b39d591 (diff)
downloadvolse-hubzilla-e2e3b81f323957495a643a9087b663df03dac2d9.tar.gz
volse-hubzilla-e2e3b81f323957495a643a9087b663df03dac2d9.tar.bz2
volse-hubzilla-e2e3b81f323957495a643a9087b663df03dac2d9.zip
more pdo tweaks
Diffstat (limited to 'include')
-rwxr-xr-xinclude/dba/dba_pdo.php27
1 files changed, 24 insertions, 3 deletions
diff --git a/include/dba/dba_pdo.php b/include/dba/dba_pdo.php
index b3a1209bc..bb89df6be 100755
--- a/include/dba/dba_pdo.php
+++ b/include/dba/dba_pdo.php
@@ -14,7 +14,7 @@ class dba_pdo extends dba_driver {
. ':host=' . $server . (is_null($port) ? '' : ';port=' . $port)
. ';dbname=' . $db;
- db_logger('dns: ' . $dns);
+ // db_logger('dns: ' . $dns);
try {
$this->db = new PDO($dns,$user,$pass);
@@ -40,8 +40,11 @@ class dba_pdo extends dba_driver {
if((! $this->db) || (! $this->connected))
return false;
- if($this->driver_dbtype === 'pgsql' && (! strpos($sql,';')))
- $sql .= ';';
+ if($this->driver_dbtype === 'pgsql') {
+ if(substr(rtrim($sql),-1,1) !== ';') {
+ $sql .= ';';
+ }
+ }
$this->error = '';
$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() {
return 'pdo';