summaryrefslogtreecommitdiff
path: root/drivers/adodb-sqlite3.inc.php
diff options
context:
space:
mode:
authorDamien Regad <dregad@mantisbt.org>2015-05-15 10:34:41 +0200
committerDamien Regad <dregad@mantisbt.org>2015-05-15 10:34:41 +0200
commitd63003d9d541df2787798b2e5cce0a7c8fa2c9d6 (patch)
treef1ba976c0d5dd34c8ed47467798de0ba9b78ee58 /drivers/adodb-sqlite3.inc.php
parent9b14451d4c804a2b4929ed00434822ebfa73c837 (diff)
downloadadodb-d63003d9d541df2787798b2e5cce0a7c8fa2c9d6.tar.gz
adodb-d63003d9d541df2787798b2e5cce0a7c8fa2c9d6.tar.bz2
adodb-d63003d9d541df2787798b2e5cce0a7c8fa2c9d6.zip
sqlite3: Fix result-less SQL statements executed twice
The sqlite3 driver relies on SQLite3::query to execute the statement, which returns an empty SQLite3Result while the ADOConnection::_Execute() method expects true for handling of result-less queries. This causes the query to be executed a second time when ADOdb initializes the recordset for what it wrongly assumes to be a SELECT statement. This also addresses the same behavior with the sqlite driver, but the fix was not tested as I don't have a sqlite 2 setup available. Fixes #99
Diffstat (limited to 'drivers/adodb-sqlite3.inc.php')
-rw-r--r--drivers/adodb-sqlite3.inc.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/adodb-sqlite3.inc.php b/drivers/adodb-sqlite3.inc.php
index 64575d7f..99271038 100644
--- a/drivers/adodb-sqlite3.inc.php
+++ b/drivers/adodb-sqlite3.inc.php
@@ -193,8 +193,13 @@ class ADODB_sqlite3 extends ADOConnection {
function _query($sql,$inputarr=false)
{
$rez = $this->_connectionID->query($sql);
- if (!$rez) {
- $this->_connectionID->lastErrorCode();
+ if ($rez === false) {
+ $this->_errorNo = $this->_connectionID->lastErrorCode();
+ }
+ // If no data was returned, we don't need to create a real recordset
+ elseif ($rez->numColumns() == 0) {
+ $rez->finalize();
+ $rez = true;
}
return $rez;