aboutsummaryrefslogtreecommitdiffstats
path: root/include/dba
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2016-10-17 16:12:32 -0700
committerzotlabs <mike@macgirvin.com>2016-10-17 16:12:32 -0700
commit716a83d1f77e2d6f26b25ab03ffe130c11ef7feb (patch)
tree8153393ba2bd9cb11b280869ea91a349fc1b4018 /include/dba
parent40ce6724a9b1c619261319d23468d7eb312353eb (diff)
downloadvolse-hubzilla-716a83d1f77e2d6f26b25ab03ffe130c11ef7feb.tar.gz
volse-hubzilla-716a83d1f77e2d6f26b25ab03ffe130c11ef7feb.tar.bz2
volse-hubzilla-716a83d1f77e2d6f26b25ab03ffe130c11ef7feb.zip
some pdo work
Diffstat (limited to 'include/dba')
-rwxr-xr-xinclude/dba/dba_driver.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php
index 34597bec4..4586f6b70 100755
--- a/include/dba/dba_driver.php
+++ b/include/dba/dba_driver.php
@@ -29,27 +29,33 @@ class DBA {
* @return null|dba_driver A database driver object (dba_mysql|dba_mysqli) or null if no driver found.
*/
- static public function dba_factory($server, $port,$user,$pass,$db,$dbtype,$install = false) {
+ static public function dba_factory($server,$port,$user,$pass,$db,$dbtype,$install = false) {
self::$dba = null;
self::$dbtype = intval($dbtype);
- $set_port = $port;
if(self::$dbtype == DBTYPE_POSTGRES) {
+ if(! ($port))
+ $port = 5432;
+
require_once('include/dba/dba_postgres.php');
- if(is_null($port)) $set_port = 5432;
- self::$dba = new dba_postgres($server, $set_port, $user, $pass, $db, $install);
+ self::$dba = new dba_postgres($server, $port, $user, $pass, $db, $install);
}
else {
+ if(! ($port))
+ $port = 3306;
+ if($server === 'localhost')
+ $server = '127.0.0.1';
+
+
// Highly experimental at the present time.
// require_once('include/dba/dba_pdo.php');
-// self::$dba = new dba_pdo($server, $set_port,$user,$pass,$db,$install);
+// self::$dba = new dba_pdo($server, $port,$user,$pass,$db,$install);
// }
if(class_exists('mysqli')) {
- if (is_null($port)) $set_port = ini_get("mysqli.default_port");
require_once('include/dba/dba_mysqli.php');
self::$dba = new dba_mysqli($server, $set_port,$user,$pass,$db,$install);
}