Пример #1
0
 /**
  * @param string        $cacheKey
  * @param \PDOStatement $statement
  */
 protected function _addCachedStmt($cacheKey, $statement)
 {
     if ($this->_maxPreparedStatements === null) {
         $this->_maxPreparedStatements = $this->_config()->getItem('max_prepared_statements', 10);
     }
     if ($this->_maxPreparedStatements > 0) {
         parent::_addCachedStmt($cacheKey, $statement);
         $connId = $this->_getConnectionId();
         if (isset(self::$_stmtCache[$connId])) {
             while (count(self::$_stmtCache[$connId]) > $this->_maxPreparedStatements) {
                 array_shift(self::$_stmtCache[$connId]);
             }
         }
     }
 }
Пример #2
0
 /**
  * Disconnect the open connection
  *
  * @return static
  *
  * @throws ConnectionException
  */
 public function disconnect()
 {
     $this->_client = null;
     if ($this->_transport instanceof TTransport) {
         $this->_transport->close();
     }
     $this->_transport = null;
     $this->_protocol = null;
     $this->_connected = false;
     return parent::disconnect();
 }