Commit a8b8c8db authored by Alexander Butenko's avatar Alexander Butenko

Allow prefix configuration out of constructor

parent ea35ad41
......@@ -24,7 +24,7 @@ class MysqliDb
*
* @var string
*/
public static $prefix;
public static $prefix = '';
/**
* MySQLi instance
*
......@@ -167,7 +167,8 @@ class MysqliDb
$this->isSubQuery = true;
return;
}
$this->setPrefix();
if (isset ($prefix))
$this->setPrefix ($prefix);
self::$_instance = $this;
}
......
......@@ -2,6 +2,7 @@
require_once ("../MysqliDb.php");
error_reporting(E_ALL);
$prefix = 't_';
$db = new Mysqlidb('localhost', 'root', '', 'testdb');
if(!$db) die("Database error");
......@@ -12,13 +13,11 @@ $db = new Mysqlidb(Array (
'host' => 'localhost',
'username' => 'root',
'password' => '',
'db'=> 'testdb',
'db' => 'testdb',
'prefix' => $prefix,
'charset' => null));
if(!$db) die("Database error");
$prefix = 't_';
$db->setPrefix($prefix);
$db->setTrace(true);
$tables = Array (
......@@ -117,7 +116,6 @@ if (!$db->ping()) {
exit;
}
$str = $db->escape ("te'st");
// insert test with autoincrement
foreach ($data as $name => $datas) {
foreach ($datas as $d) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment