diff options
| author | Damien Regad <dregad@mantisbt.org> | 2022-04-03 14:02:21 +0200 |
|---|---|---|
| committer | Damien Regad <dregad@mantisbt.org> | 2022-04-03 14:02:21 +0200 |
| commit | 3db2fda0aece98011dcf411a747c372668fcd790 (patch) | |
| tree | c387abbfad997db790bddb4a1316e5b82e6720f9 /drivers | |
| parent | 00b6976f7513cec7dd1e2f62a1584bed1873be70 (diff) | |
| download | adodb-3db2fda0aece98011dcf411a747c372668fcd790.tar.gz adodb-3db2fda0aece98011dcf411a747c372668fcd790.tar.bz2 adodb-3db2fda0aece98011dcf411a747c372668fcd790.zip | |
Fix affected_rows() returning false
When an update or insert query is executed after a select query,
ADODB_mysqli::$isSelectStatement is not reset causing subsequent calls
to affected_rows() to return false instead of the expected number of
rows.
This was marked as fixed in 5.22.1 [1], but in fact it wasn't so the
Changelog has been updated accordingly.
Fixes #820
[1]: see commit aa88f92f95454fdfda3c4a916f7aac68c74c19a3
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/adodb-mysqli.inc.php | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/adodb-mysqli.inc.php b/drivers/adodb-mysqli.inc.php index 10f58ec6..643405fd 100644 --- a/drivers/adodb-mysqli.inc.php +++ b/drivers/adodb-mysqli.inc.php @@ -1314,18 +1314,13 @@ class ADODB_mysqli extends ADOConnection { return false; } - /* - * Is the statement a non-select - */ - if ($stmt->affected_rows > -1) - { + // Tells affected_rows to be compliant + $this->isSelectStatement = $stmt->affected_rows == -1; + if (!$this->isSelectStatement) { $this->statementAffectedRows = $stmt->affected_rows; return true; } - // Tells affected_rows to be compliant - $this->isSelectStatement = true; - // Turn the statement into a result set and return it return $stmt->get_result(); } |
