Skip to content

Commit

Permalink
make immutable=1 imply SQLITE_OPEN_READONLY
Browse files Browse the repository at this point in the history
  • Loading branch information
mlin committed Jan 13, 2024
1 parent 2e9c7db commit e3275cf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/SQLiteNestedVFS.h
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,7 @@ class InnerDatabaseFile : public SQLiteVFS::File {
}
} catch (SQLite::Exception &exn) {
SQLITE_NVFS_LOG(1, exn.what())
SQLiteVFS::File::Close(); // deletes this
return exn.getErrorCode();
}
unsigned long long sequential = 0, non_sequential = 0, interior_hits = 0;
Expand All @@ -1027,7 +1028,7 @@ class InnerDatabaseFile : public SQLiteVFS::File {
<< "ms decode: " << t_decode.count() / 1000000 << "ms")
}
SQLITE_NVFS_LOG(3, "xClose")
return SQLiteVFS::File::Close();
return SQLiteVFS::File::Close(); // deletes this
}

int ShmMap(int iPg, int pgsz, int isWrite, void volatile **pp) override {
Expand Down Expand Up @@ -1222,6 +1223,7 @@ class VFS : public SQLiteVFS::Wrapper {
outer_db_uri += "?nolock=1&psow=1";
} else if (sqlite3_uri_boolean(zName, "immutable", 0)) {
outer_db_uri += "?immutable=1";
flags |= SQLITE_OPEN_READONLY;
}
if (log_filename_.rfind('/') != std::string::npos) {
log_filename_ = log_filename_.substr(log_filename_.rfind('/') + 1);
Expand Down

0 comments on commit e3275cf

Please sign in to comment.