public function tearDown() { if (!$this->db || MDB2::isError($this->db)) { return; } $this->clearTables(); $this->db->disconnect(); $this->db->popExpect(); unset($this->db); }
/** * @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; }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }