On 10/29/2016 15:15, Simon Slavin wrote:
I believe SQLite handled the failure correctly. It returned SQLITE_FULL and it
did not corrupt its database. SQLITE_FULL is documented as an error code, not
a warning, in section 1 of
<https://www.sqlite.org/rescode.html>
My program prints errors, but doesn't terminate the process. For some
reason, Qt's db.lastError() doesn't print that text, but SQLite library
prints it into stderr:
> /usr/home/yuri/.config/in-mem-fs-to-test-disk-full: write failed,
filesystem is full
> QSqlSqliteSettingsFormat: database error occurred during ' "update
(key=key-X16)" ': QSqlError(-1, "", "")
> /usr/home/yuri/.config/in-mem-fs-to-test-disk-full: write failed,
filesystem is full
> QSqlSqliteSettingsFormat: database error occurred during ' "update
(key=key-X16)" ': QSqlError(-1, "", "")
So I didn't ignore them.
From what you describe, your application didn't handle this error correctly,
it ignored it. At minimum the programmer needs to consider what to do with the
data it was trying to write, given that it couldn't write it to the database.
Even if that data isn't important, SQLite documentation has recommendations:
<https://www.sqlite.org/lang_transaction.html>
"It is recommended that applications respond to the errors listed above by
explicitly issuing a ROLLBACK command. If the transaction has already been rolled back
automatically by the error response, then the ROLLBACK command will fail with an error,
but no harm is caused by this."
And of course, if the ROLLBACK command itself fails, the program needs to
handle that. Since it means that recovery from the error condition failed.
It opens the DB, applies updates without the explicit transaction, some
of them fail, messages are printed, DB is closed. DB should be left in
the valid state. Is this not what is supposed to happen?
Yuri
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users