Resolve 'database is locked' message and crash

* Resolve 'database is locked' when another onedrive process is running and has exclusive access to the database
This commit is contained in:
abraunegg 2018-06-02 06:19:29 +10:00
parent dc4bfb62ff
commit 2576b69a88

View file

@ -1,5 +1,5 @@
module sqlite;
import std.stdio;
import etc.c.sqlite3;
import std.string: fromStringz, toStringz;
@ -133,6 +133,11 @@ struct Statement
{
// https://www.sqlite.org/c3ref/step.html
int rc = sqlite3_step(pStmt);
if (rc == SQLITE_BUSY) {
// Database is locked by another onedrive process
writeln("The database is currently locked by another process - cannot sync");
return;
}
if (rc == SQLITE_DONE) {
row.length = 0;
} else if (rc == SQLITE_ROW) {