qt5base-lts/tests/auto/sql/kernel/qsqldatabase
Florian Bruhin 49efea26a5 sqlite: Fix QSqlError handling when opening/closing database
Both sqlite3_open_v2 and sqlite3_close are documented to return an error code:
https://www.sqlite.org/c3ref/open.html https://sqlite.org/c3ref/close.html

However, those were ignored (other than checking whether the operation
succeeded), causing QSqlError::nativeErrorCode() to always be "-1" when there
was an error while opening/closing the database.

Additionally, the error string needs to be read (via sqlite3_errmsg16) in
qMakeError *before* d->access is set to 0, or the databaseText() will always be
"out of memory" no matter what error actually happened.

Task-number: QTBUG-70506
Change-Id: I75cbf178c9711442e640afd26c4502214d20c598
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-09-13 18:18:47 +00:00
..
testdata Remove exec bits from files that should not be executable 2015-06-07 22:50:19 +00:00
.gitignore Moved sql autotests into new directory structure 2011-09-06 09:32:15 +02:00
qsqldatabase.pro QSql tests: Remove Windows CE and clean up code. 2016-03-10 15:07:02 +00:00
tst_databases.h Make it easier to specify test databases on a per system level 2018-01-26 11:33:07 +00:00
tst_qsqldatabase.cpp sqlite: Fix QSqlError handling when opening/closing database 2018-09-13 18:18:47 +00:00