From edda931197c9e4d2642c60ab5ec2f1a80ce0e910 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 13 Nov 2014 16:34:36 -0800 Subject: mysql driver - in debug mode for statements that return true/false report the sql along with the result so we can match it to an offending statement. This has bugged me for some time but never got around to fixing it until now. --- include/dba/dba_mysqli.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/dba') diff --git a/include/dba/dba_mysqli.php b/include/dba/dba_mysqli.php index 19907705b..c71f493b0 100755 --- a/include/dba/dba_mysqli.php +++ b/include/dba/dba_mysqli.php @@ -40,7 +40,7 @@ class dba_mysqli extends dba_driver { if(($result === true) || ($result === false)) { if($this->debug) { - logger('dba_mysqli: DEBUG: returns ' . (($result) ? 'true' : 'false')); + logger('dba_mysqli: DEBUG: ' . printable($sql) . ' returns ' . (($result) ? 'true' : 'false')); } return $result; } -- cgit v1.2.3 From ee38bebbd6a641eb953eacf493c085053442d972 Mon Sep 17 00:00:00 2001 From: Habeas Codice Date: Thu, 13 Nov 2014 17:57:21 -0800 Subject: Add bitwise xor to db_getfunc() --- include/dba/dba_driver.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/dba') diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php index ddff80d7c..103dc8fcc 100755 --- a/include/dba/dba_driver.php +++ b/include/dba/dba_driver.php @@ -361,6 +361,10 @@ function db_getfunc($f) { 'regexp'=>array( DBTYPE_MYSQL=>'REGEXP', DBTYPE_POSTGRES=>'~' + ), + '^'=>array( + DBTYPE_MYSQL=>'^', + DBTYPE_POSTGRES=>'#' ) ); $f = strtolower($f); -- cgit v1.2.3 From 1c249a5b06279ea4a19433d45a8dbe6fd71bcd25 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 16 Nov 2014 15:51:42 -0800 Subject: some poller optimisations and a fix for undefined (empty) dbtype which shows up as a mysql error that 'rand' isn't found. --- include/dba/dba_driver.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'include/dba') diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php index 103dc8fcc..1bb45b06d 100755 --- a/include/dba/dba_driver.php +++ b/include/dba/dba_driver.php @@ -24,7 +24,10 @@ function dba_factory($server, $port,$user,$pass,$db,$dbtype,$install = false) { $dba = null; - if($dbtype == 1) { + + $dbtype = intval($dbtype); + + if($dbtype == DBTYPE_POSTGRES) { require_once('include/dba/dba_postgres.php'); if(is_null($port)) $port = 5432; $dba = new dba_postgres($server, $port, $user, $pass, $db, $install); @@ -39,6 +42,7 @@ function dba_factory($server, $port,$user,$pass,$db,$dbtype,$install = false) { $dba = new dba_mysql($server, $port,$user,$pass,$db,$install); } } + define('NULL_DATE', $dba->get_null_date()); define('ACTIVE_DBTYPE', $dbtype); return $dba; @@ -371,7 +375,7 @@ function db_getfunc($f) { if(isset($lookup[$f]) && isset($lookup[$f][ACTIVE_DBTYPE])) return $lookup[$f][ACTIVE_DBTYPE]; - logger('Unable to abstract DB function "'. $f . '"', LOG_DEBUG); + logger('Unable to abstract DB function "'. $f . '" for dbtype ' . ACTIVE_DBTYPE, LOGGER_DEBUG); return $f; } -- cgit v1.2.3