예제 #1
0
파일: Abstract.php 프로젝트: gauthierm/MDB2
 public function tearDown()
 {
     if (!$this->db || MDB2::isError($this->db)) {
         return;
     }
     $this->clearTables();
     $this->db->disconnect();
     $this->db->popExpect();
     unset($this->db);
 }
예제 #2
0
파일: db.php 프로젝트: ryanshoover/core
 /**
  * @brief Disconnect
  * @return bool
  *
  * This is good bye, good bye, yeah!
  */
 public static function disconnect()
 {
     // Cut connection if required
     if (self::$connection) {
         if (self::$backend == self::BACKEND_MDB2) {
             self::$connection->disconnect();
         }
         self::$connection = false;
         self::$MDB2 = false;
         self::$PDO = false;
     }
     return true;
 }
예제 #3
0
 /**
  * Log out and disconnect from the database.
  *
  * @param  boolean $force if the disconnect should be forced even if the
  *                        connection is opened persistently
  * @return mixed true on success, false if not connected and error
  *                object on error
  * @access public
  */
 function disconnect($force = true)
 {
     if (is_resource($this->connection)) {
         if ($this->in_transaction) {
             $dsn = $this->dsn;
             $database_name = $this->database_name;
             $persistent = $this->options['persistent'];
             $this->dsn = $this->connected_dsn;
             $this->database_name = $this->connected_database_name;
             $this->options['persistent'] = $this->opened_persistent;
             $this->rollback();
             $this->dsn = $dsn;
             $this->database_name = $database_name;
             $this->options['persistent'] = $persistent;
         }
         if (!$this->opened_persistent || $force) {
             @sqlite_close($this->connection);
         }
     }
     return parent::disconnect($force);
 }
예제 #4
0
 /**
  * Log out and disconnect from the database.
  *
  * @param  boolean $force if the disconnect should be forced even if the
  *                        connection is opened persistently
  * @return mixed true on success, false if not connected and error
  *                object on error
  * @access public
  */
 function disconnect($force = true)
 {
     if ($this->connection instanceof SQLite3) {
         if ($this->in_transaction) {
             $dsn = $this->dsn;
             $database_name = $this->database_name;
             $persistent = $this->options['persistent'];
             $this->dsn = $this->connected_dsn;
             $this->database_name = $this->connected_database_name;
             $this->options['persistent'] = $this->opened_persistent;
             $this->rollback();
             $this->dsn = $dsn;
             $this->database_name = $database_name;
             $this->options['persistent'] = $persistent;
         }
         if (!$this->opened_persistent || $force) {
             $this->connection->close();
         }
     } else {
         return false;
     }
     return parent::disconnect($force);
 }
예제 #5
0
파일: pgsql.php 프로젝트: phpontrax/trax
 /**
  * Log out and disconnect from the database.
  *
  * @param  boolean $force if the disconnect should be forced even if the
  *                        connection is opened persistently
  * @return mixed true on success, false if not connected and error
  *                object on error
  * @access public
  */
 function disconnect($force = true)
 {
     if (is_resource($this->connection)) {
         if ($this->in_transaction) {
             $dsn = $this->dsn;
             $database_name = $this->database_name;
             $persistent = $this->options['persistent'];
             $this->dsn = $this->connected_dsn;
             $this->database_name = $this->connected_database_name;
             $this->options['persistent'] = $this->opened_persistent;
             $this->rollback();
             $this->dsn = $dsn;
             $this->database_name = $database_name;
             $this->options['persistent'] = $persistent;
         }
         if (!$this->opened_persistent || $force) {
             $ok = @pg_close($this->connection);
             if (!$ok) {
                 return $this->raiseError(MDB2_ERROR_DISCONNECT_FAILED, null, null, null, __FUNCTION__);
             }
         }
     } else {
         return false;
     }
     return parent::disconnect($force);
 }
예제 #6
0
파일: oci8.php 프로젝트: Rudi9719/lucid
 /**
  * Log out and disconnect from the database.
  *
  * @param  boolean $force if the disconnect should be forced even if the
  *                        connection is opened persistently
  * @return mixed true on success, false if not connected and error
  *                object on error
  * @access public
  */
 function disconnect($force = true)
 {
     if (is_resource($this->connection)) {
         if ($this->in_transaction) {
             $dsn = $this->dsn;
             $database_name = $this->database_name;
             $persistent = $this->options['persistent'];
             $this->dsn = $this->connected_dsn;
             $this->database_name = $this->connected_database_name;
             $this->options['persistent'] = $this->opened_persistent;
             $this->rollback();
             $this->dsn = $dsn;
             $this->database_name = $database_name;
             $this->options['persistent'] = $persistent;
         }
         if (!$this->opened_persistent || $force) {
             if (function_exists('oci_close')) {
                 @oci_close($this->connection);
             } else {
                 @OCILogOff($this->connection);
             }
         }
         $this->uncommitedqueries = 0;
     }
     return parent::disconnect($force);
 }
예제 #7
0
파일: mssql.php 프로젝트: laiello/punchcms
 /**
  * Log out and disconnect from the database.
  *
  * @param  boolean $force if the disconnect should be forced even if the
  *                        connection is opened persistently
  * @return mixed true on success, false if not connected and error
  *                object on error
  * @access public
  */
 function disconnect($force = true)
 {
     if (is_resource($this->connection)) {
         if ($this->in_transaction) {
             $this->rollback();
         }
         if (!$this->opened_persistent || $force) {
             @mssql_close($this->connection);
         }
     }
     return parent::disconnect($force);
 }