/** * @deprecated 0.3.0 * @return Core_Lib_Conn * @throws Exception */ protected static function getConn() { static $conn; if (null === $conn) { $conf = Core_Lib_App::app()->getConfig()->get('modelServers.' . get_called_class()); if ($conf['sid'] > 0) { $ipport = Core_Helper_L5::getInstance()->route($conf['sid']); if (!empty($ipport) && $ipport[1] != '0') { $conf['host'] = $ipport[0]; $conf['port'] = $ipport[1]; } } $conn = new Core_Lib_MysqliConn($conf['host'], $conf['user'], $conf['psw'], $conf['dbname'], $conf['port'], null, $conf['tbname']); if ($conn->connect_errno != 0) { throw new Exception('model server connect error: ' . $conn->connect_error); } if (isset($conf['charset'])) { $conn->set_charset($conf['charset']); } } return $conn; }