public function __construct($config) { $this->_redis = new \Redis(); if (isset($config['pconnect']) && $config['pconnect']) { $this->_redis->pconnect($config['host'], $config['port'], $config['timeout']); } else { $this->_redis->connect($config['host'], $config['port'], $config['timeout']); } $this->_debugger = Debugger::getInstance(); }
public function __construct($config) { if ($config && is_array($config)) { $this->_memcached = new \Memcached(); foreach ($config as $val) { $this->_memcached->addServer($val['host'], $val['port'], $val['weight']); } $this->_debugger = Debugger::getInstance(); } else { trigger_error('Memcached config is empty!'); } }
/** * @param string $statement * @param null $pdo_option * @param null $object * @return PDOStatement */ public function query($statement, $pdo_option = null, $object = null) { Debugger::getInstance()->debug('SQL:' . $statement); if ($pdo_option != null && $object != null) { $stmt = parent::query($statement, $pdo_option, $object); } else { $stmt = parent::query($statement); } if ($stmt instanceof PDOStatement) { $stmt->setFetchMode(PDO::FETCH_ASSOC); } return $stmt; }
public function execute($inputParameters = array()) { $ret = parent::execute($inputParameters); Debugger::getInstance()->debug('SQL:' . $this->queryString . ';params:' . var_export($inputParameters, true)); if (!$ret) { $error_info = parent::errorInfo(); if (parent::errorCode() != '00000') { // 执行成功时返回五个零 LoggerFactory::getLogger()->error('PDO executed failed,errors:' . var_export($error_info, true)); trigger_error($this->queryString, E_USER_ERROR); } } return $ret; }
public function prepare($query) { Debugger::getInstance()->debug('SQL:' . $query); return parent::prepare($query); }
/** * @param string $query * @return Statement */ public function prepare($query) { Debugger::getInstance()->debug('SQL:' . $query); return new Statement($this, $query); }