public function __construct($host = null, $username = null, $password = null, $db = null, $port = null, $charset = 'utf8')
{
$isSubQuery = false;
// if params were passed as array
if (is_array($host)) {
foreach ($host as $key => $val) {
${$key} = $val;
}
}
// if host were set as mysqli socket
if (is_object($host)) {
$this->_mysqli = $host;
} else {
$this->host = $host;
}
$this->username = $username;
$this->password = $password;
$this->db = $db;
$this->port = $port;
$this->charset = $charset;
if ($isSubQuery) {
$this->isSubQuery = true;
return;
}
if (isset($prefix)) {
$this->setPrefix($prefix);
}
self::$_instance = $this;
}