本文整理汇总了PHP中ADOConnection::Close方法的典型用法代码示例。如果您正苦于以下问题:PHP ADOConnection::Close方法的具体用法?PHP ADOConnection::Close怎么用?PHP ADOConnection::Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ADOConnection
的用法示例。
在下文中一共展示了ADOConnection::Close方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup
function setup()
{
if ($this->isType('mysql')) {
if ($this->getCreateTarget() == true) {
$this->connection =& NewADOConnection($this->dbConfig->getDBType());
$ok = $this->connection->NConnect($this->dbConfig->getHostName(), $this->dbConfig->getRootUserName(), $this->dbConfig->getRootPassword());
if (!$ok) {
throw new DatabaseBackupException(DatabaseBackupErrorCode::$DB_CONNECT_ERROR, DatabaseBackup::$langString['DestConnectFailed']);
}
// Drop database if already exists
$sql = "drop database IF EXISTS " . $this->dbConfig->getDatabaseName();
$result = $this->connection->Execute($sql);
$this->checkError($result, $sql);
$sql = 'create database ' . $this->dbConfig->getDatabaseName();
if ($this->supportUTF8 == true) {
$sql .= " default character set utf8 default collate utf8_general_ci";
}
$result = $this->connection->Execute($sql);
$this->checkError($result, $sql);
$this->connection->Close();
}
$this->connection =& NewADOConnection($this->dbConfig->getDBType());
$ok = $this->connection->NConnect($this->dbConfig->getHostName(), $this->dbConfig->getUserName(), $this->dbConfig->getPassword(), $this->dbConfig->getDatabaseName());
if (!$ok) {
throw new DatabaseBackupException(DatabaseBackupErrorCode::$DB_CONNECT_ERROR, DatabaseBackup::$langString['DestConnectFailed']);
}
$result = $this->connection->_Execute("SET interactive_timeout=28800", false);
$result = $this->connection->_Execute("SET wait_timeout=28800", false);
$result = $this->connection->_Execute("SET net_write_timeout=900", false);
}
}
示例2: __destruct
/**
* Disconnect DB
*/
public function __destruct()
{
if ($this->connection) {
$this->connection->Close();
}
}