process:
- create a new db and set pragma journal_mode=PERSIST
- create a table
- open the same db again, without setting journal mode
- create another table
Result:
second create table statement returns SQLITE_IOERR (code 10) after notable
delay
Honestly, I'm not very proud of this use case (one client tries to optimize
access times, the other doesn't care), but a more graceful handling or a
warning in the documentation would be nice.
Example code:
#include "sqlite3.h"
#include <cstdio>
#include <assert.h>
void Check(sqlite3 * db, int err)
{
char const * msg = sqlite3_errmsg(db);
assert(err == SQLITE_OK);
}
void Exec(sqlite3 * db, char const * sql)
{
Check(db, sqlite3_exec(db, sql, nullptr, nullptr, nullptr));
}
int main()
{
char const * path = "c:\\temp\\db1.sqlite";
std::remove(path);
sqlite3 * db = 0;
Check(db, sqlite3_open(path, &db));
Exec(db, "pragma journal_mode=PERSIST");
Exec(db, "CREATE TABLE t1 (id INTEGER PRIMARY KEY AutoIncrement, value
STRING)");
sqlite3 * db2 = 0;
Check(db2, sqlite3_open(path, &db2));
Exec(db2, "CREATE TABLE t2 (id INTEGER PRIMARY KEY AutoIncrement, value
STRING)");
Check(db2, sqlite3_close(db2));
Check(db, sqlite3_close(db));
}
sqlite amalgamation 3.28.0.
--
Sent from: http://sqlite.1065341.n5.nabble.com/
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users