Commit 1fd8256f authored by Juozas Kaziukenas's avatar Juozas Kaziukenas

Close connection on __destruct()

Signed-off-by: 's avatarJuozas Kaziukenas <juozas@juokaz.com>
parent 5d3814ca
......@@ -43,6 +43,7 @@ class Driver implements \Doctrine\DBAL\Driver
$connectionInfo = array(
'Database' => $params['dbname'],
'ReturnDatesAsStrings' => true,
);
if (isset($username) && !empty($username) && isset($password) && !empty($password))
......@@ -52,8 +53,6 @@ class Driver implements \Doctrine\DBAL\Driver
'PWD' => $password,
);
}
$connectionInfo += array('ReturnDatesAsStrings' => true);
return new SqlsrvConnection($serverName, $connectionInfo);
}
......
......@@ -38,6 +38,11 @@ class SqlsrvConnection implements \Doctrine\DBAL\Driver\Connection
throw SqlsrvException::fromErrorInfo($this->errorInfo());
}
}
public function __destruct()
{
sqlsrv_close($this->_dbh);
}
public function prepare($prepareString)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment