Пример #1
0
 protected final function __construct($config)
 {
     $this->_db_engine = 'MySQLi';
     $this->_db_connect_id = new mysqli($config['dbhost'], $config['dbusername'], $config['dbpassword'], $config['dbdatabase']);
     mysqli_options($this->_db_connect_id, MYSQLI_OPT_LOCAL_INFILE, true);
     if ($this->_db_connect_id->connect_error) {
         trigger_error($this->_db_connect_id->connect_error, E_USER_ERROR);
     }
     $this->_prefix = $config['dbprefix'];
     $this->_setup();
     //Run the parent constructor
     parent::__construct();
 }
Пример #2
0
 protected final function __construct($config)
 {
     $this->_db_engine = 'MySQL';
     //Connect to the db server
     if (($this->_db_connect_id = mysql_connect($config['dbhost'], $config['dbusername'], $config['dbpassword'], false, MYSQL_CLIENT_COMPRESS)) === false) {
         trigger_error(mysql_error(), E_USER_ERROR);
     }
     //Open the db
     if (!mysql_select_db($config['dbdatabase'], $this->_db_connect_id)) {
         trigger_error(mysql_error(), E_USER_ERROR);
     }
     $this->_prefix = $config['dbprefix'];
     $this->_setup();
     //Run the parent constructor
     parent::__construct();
 }
Пример #3
0
 protected final function __construct($config)
 {
     $this->_db_engine = 'MySQLi';
     $dbport = isset($config['dbport']) && !empty($config['dbport']) ? $config['dbport'] : ini_get('mysqli.default_port');
     $dbsocket = isset($config['dbsocket']) && !empty($config['dbsocket']) ? $config['dbsocket'] : ini_get('mysqli.default_socket');
     $this->_db_connect_id = new mysqli($config['dbhost'], $config['dbusername'], $config['dbpassword'], $config['dbdatabase'], $dbport, $dbsocket);
     mysqli_options($this->_db_connect_id, MYSQLI_OPT_LOCAL_INFILE, true);
     if ($this->_db_connect_id->connect_error) {
         trigger_error($this->_db_connect_id->connect_error, E_USER_ERROR);
     } else {
         $this->connected = true;
     }
     $this->_prefix = $config['dbprefix'];
     $this->_setup();
     //Run the parent constructor
     parent::__construct();
 }