mirror of
https://github.com/silverstripe/silverstripe-sqlite3
synced 2024-10-22 17:05:37 +02:00
Merge pull request #7 from halkyon/close_conn_fix
BUG SQLite database connection not closed properly
This commit is contained in:
commit
6bb7d5a5f6
@ -106,6 +106,12 @@ class SQLite3Database extends SS_Database {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function __destruct() {
|
||||
if($this->dbConn) {
|
||||
$this->dbConn->close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Not implemented, needed for PDO
|
||||
*/
|
||||
@ -1246,7 +1252,9 @@ class SQLite3Query extends SS_Query {
|
||||
}
|
||||
|
||||
public function __destruct() {
|
||||
if($this->handle) $this->handle->finalize();
|
||||
if($this->handle) {
|
||||
$this->handle->finalize();
|
||||
}
|
||||
}
|
||||
|
||||
public function seek($row) {
|
||||
|
@ -55,6 +55,14 @@ class SQLitePDODatabase extends SQLite3Database {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloaded since the parent class tries to call close() on the connection,
|
||||
* but doing it here won't work as the PDO class has no such method.
|
||||
*/
|
||||
public function __destruct() {
|
||||
// noop
|
||||
}
|
||||
|
||||
public function query($sql, $errorLevel = E_USER_ERROR) {
|
||||
|
||||
if(isset($_REQUEST['previewwrite']) && in_array(strtolower(substr($sql,0,strpos($sql,' '))), array('insert','update','delete','replace'))) {
|
||||
|
Loading…
Reference in New Issue
Block a user