/** * __construct * * @desc 构造器 * @access private * @return void */ public function __construct($dbConfKey = '', $isRetry = false, $retryNum = 3, $retrySleep = 1) { if (!empty($dbConfKey)) { $this->dbConf = Config::getConfByKey('database', $dbConfKey); if (!empty($this->dbConf)) { $this->retryFun('connectDb', $this->dbConf); } } $this->isRetry = (bool) $isRetry; $this->retryNum = (int) $retryNum; $this->retrySleep = (int) $retrySleep; }
/** * __construct * * @param string $dbConfKey databases配置文件里的数组key * @param bool $debug 是否打开debug模式,默认关闭,打开后会记录执行的SQL语句 * @access private * @return void */ public function __construct($dbConfKey = '', $debug = false) { if (!empty($dbConfKey)) { $this->dbConf = Config::getConfByKey('database', $dbConfKey); if (!empty($this->dbConf)) { $this->connectDb($this->dbConf); } } $this->debug = $debug; if (true === $this->debug) { $this->debugLogObject = new Log(DB_DEBUG_FILE, 'd'); $this->debugLogObject->setCommonMsg(array('type' => 'sql_debug')); } }