mirror of
https://git.sr.ht/~cismonx/bookmarkfs
synced 2025-06-07 19:58:50 +00:00
backend_firefox: don't bother opening db readonly
Readonly db does not work well with WAL mode. See <https://www.sqlite.org/wal.html#readonly>.
This commit is contained in:
parent
76d22c5bcc
commit
349877f9a3
3 changed files with 8 additions and 17 deletions
|
@ -2683,7 +2683,7 @@ backend_create (
|
|||
return -1;
|
||||
}
|
||||
|
||||
sqlite3 *db = db_open(conf->store_path, readonly);
|
||||
sqlite3 *db = db_open(conf->store_path);
|
||||
if (db == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -3150,7 +3150,7 @@ backend_mkfs (
|
|||
// See also:
|
||||
// - <https://sqlite.org/forum/forumpost/c15bf2e7df289a5f>
|
||||
// - <https://sqlite.org/forum/forumpost/680cd395b4bc97c6>
|
||||
sqlite3 *db = db_open(conf->store_path, false);
|
||||
sqlite3 *db = db_open(conf->store_path);
|
||||
if (db == NULL) {
|
||||
goto end;
|
||||
}
|
||||
|
|
12
src/db.c
12
src/db.c
|
@ -214,26 +214,18 @@ db_fcntl (
|
|||
|
||||
sqlite3 *
|
||||
db_open (
|
||||
char const *path,
|
||||
bool readonly
|
||||
char const *path
|
||||
) {
|
||||
sqlite3 *db;
|
||||
int flags = SQLITE_OPEN_READWRITE;
|
||||
if (readonly) {
|
||||
flags = SQLITE_OPEN_READONLY;
|
||||
}
|
||||
flags |= SQLITE_OPEN_EXRESCODE;
|
||||
int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_EXRESCODE;
|
||||
if (SQLITE_OK != sqlite3_open_v2(path, &db, flags, NULL)) {
|
||||
log_printf("sqlite3_open_v2(): %s", sqlite3_errmsg(db));
|
||||
goto fail;
|
||||
}
|
||||
if (!readonly) {
|
||||
if (0 != sqlite3_db_readonly(db, "main")) {
|
||||
log_puts("cannot open database for read/write");
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
return db;
|
||||
|
||||
fail:
|
||||
|
|
3
src/db.h
3
src/db.h
|
@ -113,8 +113,7 @@ db_fcntl (
|
|||
|
||||
sqlite3 *
|
||||
db_open (
|
||||
char const *path,
|
||||
bool readonly
|
||||
char const *path
|
||||
);
|
||||
|
||||
int
|
||||
|
|
Loading…
Add table
Reference in a new issue