summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/changelog.md10
-rw-r--r--drivers/adodb-sqlite3.inc.php20
2 files changed, 22 insertions, 8 deletions
diff --git a/docs/changelog.md b/docs/changelog.md
index 6162cae8..1268cd4f 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -60,6 +60,14 @@ Older changelogs:
[#833](https://github.com/ADOdb/ADOdb/issues/833)
+## [5.22.9] - Unreleased
+
+### Fixed
+
+- sqlite: fix error reporting
+ [#1061](https://github.com/ADOdb/ADOdb/issues/1061)
+
+
## [5.22.8] - 2025-01-25
### Added
@@ -1521,9 +1529,9 @@ Released together with [v4.95](changelog_v4.x.md#495---17-may-2007)
[5.23.0]: https://github.com/adodb/adodb/compare/v5.22.8...master
+[5.22.9]: https://github.com/adodb/adodb/compare/v5.22.8...hotfix/5.22
[5.22.8]: https://github.com/adodb/adodb/compare/v5.22.7...v5.22.8
[5.22.7]: https://github.com/adodb/adodb/compare/v5.22.6...v5.22.7
-[5.22.7]: https://github.com/adodb/adodb/compare/v5.22.6...v5.22.7
[5.22.6]: https://github.com/adodb/adodb/compare/v5.22.5...v5.22.6
[5.22.5]: https://github.com/adodb/adodb/compare/v5.22.4...v5.22.5
[5.22.4]: https://github.com/adodb/adodb/compare/v5.22.3...v5.22.4
diff --git a/drivers/adodb-sqlite3.inc.php b/drivers/adodb-sqlite3.inc.php
index 0cceafb1..e6bc9014 100644
--- a/drivers/adodb-sqlite3.inc.php
+++ b/drivers/adodb-sqlite3.inc.php
@@ -32,7 +32,6 @@ class ADODB_sqlite3 extends ADOConnection {
var $dataProvider = "sqlite";
var $replaceQuote = "''"; // string to use to replace quotes
var $concat_operator='||';
- var $_errorNo = 0;
var $hasLimit = true;
var $hasInsertID = true; /// supports autoincrement ID?
var $hasAffectedRows = true; /// supports affected rows for update/delete?
@@ -276,17 +275,20 @@ class ADODB_sqlite3 extends ADOConnection {
return $this->_connectionID->changes();
}
+ protected function lastError()
+ {
+ $this->_errorMsg = $this->_connectionID->lastErrorMsg();
+ $this->_errorCode = $this->_connectionID->lastErrorCode();
+ }
+
function ErrorMsg()
{
- if ($this->_logsql) {
- return $this->_errorMsg;
- }
- return ($this->_errorNo) ? $this->ErrorNo() : ''; //**tochange?
+ return $this->_errorMsg;
}
function ErrorNo()
{
- return $this->_connectionID->lastErrorCode(); //**tochange??
+ return $this->_errorCode;
}
function SQLDate($fmt, $col=false)
@@ -333,7 +335,7 @@ class ADODB_sqlite3 extends ADOConnection {
{
$rez = $this->_connectionID->query($sql);
if ($rez === false) {
- $this->_errorNo = $this->_connectionID->lastErrorCode();
+ $this->lastError();
}
// If no data was returned, we don't need to create a real recordset
elseif ($rez->numColumns() == 0) {
@@ -645,6 +647,10 @@ class ADODB_sqlite3 extends ADOConnection {
// Prepare the statement
$stmt = $this->_connectionID->prepare($sql);
+ if ($stmt === false) {
+ $this->lastError();
+ return false;
+ }
// Set the first bind value equal to value we want to update
if (!$stmt->bindValue(1, $val, SQLITE3_BLOB)) {