Пример #1
0
 private function _oGetMysql()
 {
     if (is_null($this->_oMysql)) {
         $this->_oMysql = Ko_Data_Mysql::OInstance(KO_DB_HOST, KO_DB_USER, KO_DB_PASS, KO_DB_NAME);
     }
     return $this->_oMysql;
 }
Пример #2
0
 /**
  * @return Ko_Data_Mysql
  */
 public function oConnectDB($no, $sTag = 'slave')
 {
     $sid = $this->_aTableList[$no]['sid'];
     if (empty($this->_aServerList[$sid][$sTag])) {
         $sTag = empty($this->_aServerList[$sid]['slave']) ? 'master' : 'slave';
     }
     assert(!empty($this->_aServerList[$sid][$sTag]));
     return Ko_Data_Mysql::OInstance($this->_aServerList[$sid][$sTag][0]['host'] . ':' . $this->_aServerList[$sid][$sTag][0]['port'], $this->_aServerList[$sid][$sTag][0]['user'], $this->_aServerList[$sid][$sTag][0]['passwd'], $this->_aTableList[$no]['db_name']);
 }
Пример #3
0
 /**
  * @return Ko_Data_Mysql
  */
 public function oConnectDB($no, $sTag = 'slave')
 {
     return Ko_Data_Mysql::OInstance(KO_DB_HOST, KO_DB_USER, KO_DB_PASS, KO_DB_NAME);
 }