summaryrefslogtreecommitdiff
path: root/sqlite.zig
diff options
context:
space:
mode:
Diffstat (limited to 'sqlite.zig')
-rw-r--r--sqlite.zig11
1 files changed, 10 insertions, 1 deletions
diff --git a/sqlite.zig b/sqlite.zig
index abeea55..e88fb64 100644
--- a/sqlite.zig
+++ b/sqlite.zig
@@ -5,7 +5,7 @@ const io = std.io;
5const mem = std.mem; 5const mem = std.mem;
6const testing = std.testing; 6const testing = std.testing;
7 7
8const c = @cImport({ 8pub const c = @cImport({
9 @cInclude("sqlite3.h"); 9 @cInclude("sqlite3.h");
10}); 10});
11 11
@@ -233,6 +233,12 @@ pub const InitOptions = struct {
233 /// Defaults to Serialized. 233 /// Defaults to Serialized.
234 threading_mode: ThreadingMode = .Serialized, 234 threading_mode: ThreadingMode = .Serialized,
235 235
236 /// shared_cache controls whether or not concurrent SQLite
237 /// connections share the same cache.
238 ///
239 /// Defaults to false.
240 shared_cache: bool = false,
241
236 /// if provided, diags will be populated in case of failures. 242 /// if provided, diags will be populated in case of failures.
237 diags: ?*Diagnostics = null, 243 diags: ?*Diagnostics = null,
238}; 244};
@@ -327,6 +333,9 @@ pub const Db = struct {
327 if (options.open_flags.create) { 333 if (options.open_flags.create) {
328 flags |= c.SQLITE_OPEN_CREATE; 334 flags |= c.SQLITE_OPEN_CREATE;
329 } 335 }
336 if (options.shared_cache) {
337 flags |= c.SQLITE_OPEN_SHAREDCACHE;
338 }
330 switch (options.threading_mode) { 339 switch (options.threading_mode) {
331 .MultiThread => flags |= c.SQLITE_OPEN_NOMUTEX, 340 .MultiThread => flags |= c.SQLITE_OPEN_NOMUTEX,
332 .Serialized => flags |= c.SQLITE_OPEN_FULLMUTEX, 341 .Serialized => flags |= c.SQLITE_OPEN_FULLMUTEX,