let user specify port with DB::$port -- defaults to mysqli.default_port from the php config (probably 3306)
This commit is contained in:
@@ -33,6 +33,7 @@ class DB
|
|||||||
public static $user = '';
|
public static $user = '';
|
||||||
public static $password = '';
|
public static $password = '';
|
||||||
public static $host = 'localhost';
|
public static $host = 'localhost';
|
||||||
|
public static $port = null;
|
||||||
public static $encoding = 'latin1';
|
public static $encoding = 'latin1';
|
||||||
public static $queryMode = 'queryAllRows';
|
public static $queryMode = 'queryAllRows';
|
||||||
public static $error_handler = 'meekrodb_error_handler';
|
public static $error_handler = 'meekrodb_error_handler';
|
||||||
@@ -42,9 +43,10 @@ class DB
|
|||||||
static $mysql = null;
|
static $mysql = null;
|
||||||
|
|
||||||
if ($mysql == null) {
|
if ($mysql == null) {
|
||||||
|
if (! DB::$port) DB::$port = ini_get('mysqli.default_port');
|
||||||
if (DB::$dbName != '') $dbName = DB::$dbName;
|
if (DB::$dbName != '') $dbName = DB::$dbName;
|
||||||
DB::$current_db = $dbName;
|
DB::$current_db = $dbName;
|
||||||
$mysql = new mysqli(DB::$host, DB::$user, DB::$password, $dbName);
|
$mysql = new mysqli(DB::$host, DB::$user, DB::$password, $dbName, DB::$port);
|
||||||
DB::queryNull("SET NAMES %s", DB::$encoding);
|
DB::queryNull("SET NAMES %s", DB::$encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user