0

sql: Use updated SQLite name for LAST_ERRNO

SQLite now uses SQLITE_FCNTL_LAST_ERRNO to get the LastErrno, so we
should update the Chromium SQL code to use this now, since the previous
name is a deprecated name.

Also update the comment in the header to refer reader to implementation
rather than documentation since documentation is nonexistent.

Bug: 40272342
Change-Id: I6f63f0bb8fcde1cfa32db705b5b76667dd1cef17
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5414914
Reviewed-by: Evan Stade <estade@chromium.org>
Commit-Queue: Vikram Pasupathy <vpasupathy@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1281428}
This commit is contained in:
Vikram Pasupathy
2024-04-02 20:51:31 +00:00
committed by Chromium LUCI CQ
parent f766e66479
commit 73c6039154
2 changed files with 4 additions and 3 deletions

@ -1777,8 +1777,10 @@ int Database::GetLastErrno() const {
return -1;
int err = 0;
if (SQLITE_OK != sqlite3_file_control(db_, nullptr, SQLITE_LAST_ERRNO, &err))
if (SQLITE_OK !=
sqlite3_file_control(db_, nullptr, SQLITE_FCNTL_LAST_ERRNO, &err)) {
return -2;
}
return err;
}

@ -649,8 +649,7 @@ class COMPONENT_EXPORT(SQL) Database {
// Returns the error code associated with the last sqlite operation.
int GetErrorCode() const;
// Returns the errno associated with GetErrorCode(). See
// SQLITE_LAST_ERRNO in SQLite documentation.
// Returns the errno associated with GetErrorCode(). See <errno.h>.
int GetLastErrno() const;
// Returns a pointer to a statically allocated string associated with the