aboutsummaryrefslogtreecommitdiffstats
path: root/include/dba/dba_driver.php
diff options
context:
space:
mode:
authorHabeas Codice <habeascodice@federated.social>2014-11-17 03:20:20 -0800
committerHabeas Codice <habeascodice@federated.social>2014-11-17 03:20:20 -0800
commit333f3b17152475e780cc5a9fbedaf3b03dfb2cce (patch)
tree8aaa0a8cd7ddc00630c38a85121124e824e35e7b /include/dba/dba_driver.php
parent2dbecf95454993cdf4996d2d65463d7759cd479b (diff)
parentb11ed7f88e4683315a4f5aa02692cb61facf32a7 (diff)
downloadvolse-hubzilla-333f3b17152475e780cc5a9fbedaf3b03dfb2cce.tar.gz
volse-hubzilla-333f3b17152475e780cc5a9fbedaf3b03dfb2cce.tar.bz2
volse-hubzilla-333f3b17152475e780cc5a9fbedaf3b03dfb2cce.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'include/dba/dba_driver.php')
-rwxr-xr-xinclude/dba/dba_driver.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php
index ddff80d7c..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;
@@ -361,13 +365,17 @@ function db_getfunc($f) {
'regexp'=>array(
DBTYPE_MYSQL=>'REGEXP',
DBTYPE_POSTGRES=>'~'
+ ),
+ '^'=>array(
+ DBTYPE_MYSQL=>'^',
+ DBTYPE_POSTGRES=>'#'
)
);
$f = strtolower($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;
}