Пример #1
0
 public function db_disconnect()
 {
     switch ($this->connect_method) {
         case "none":
             $this->db->prefix_changed = 1;
             $this->db->obj['sql_tbl_prefix'] = ipsRegistry::$settings['sql_tbl_prefix'];
             if (COLLATE != '' && !empty(ipsRegistry::$settings['sql_charset'])) {
                 $this->db->query("SET NAMES '" . ipsRegistry::$settings['sql_charset'] . "'");
                 $this->db->query("SET CHARACTER SET '" . ipsRegistry::$settings['sql_charset'] . "'");
             }
             break;
         case "use":
             $this->db->query("USE `" . ipsRegistry::$settings['sql_database'] . "`");
             $this->db->prefix_changed = 1;
             $this->db->obj['sql_tbl_prefix'] = ipsRegistry::$settings['sql_tbl_prefix'];
             if (COLLATE != '' && !empty(ipsRegistry::$settings['sql_charset'])) {
                 $this->db->query("SET NAMES '" . ipsRegistry::$settings['sql_charset'] . "'");
                 $this->db->query("SET CHARACTER SET '" . ipsRegistry::$settings['sql_charset'] . "'");
             }
             break;
         default:
             $this->db->disconnect();
             break;
     }
 }
 function query($sql, $silent = false, $unbuffered = false)
 {
     if ($this->slaveid && !$this->slaveexcept && strtoupper(substr($sql, 0, 6)) == 'SELECT') {
         $this->slave_connect();
     }
     $this->slaveexcept = false;
     return parent::query($sql, $silent, $unbuffered);
 }
 public function query($sql, $silent = false, $unbuffered = false)
 {
     if (!(!$this->slaveexcept && strtoupper(substr($sql, 0, 6)) === 'SELECT' && $this->_slave_connect())) {
         $this->_master_connect();
     }
     $this->tablename = '';
     $this->slaveexcept = false;
     return parent::query($sql, $silent, $unbuffered);
 }
Пример #4
0
 public function _getErrorNumber()
 {
     return parent::_getErrorNumber();
 }