summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Kenta Iwasaki2021-08-27 03:43:30 +0900
committerGravatar Kenta Iwasaki2021-08-27 03:43:30 +0900
commit17ecc483cf725f370d0bceda414fec4aed8dc331 (patch)
treefb7c3a3dd19f69cdba4c573f4f3f119760e914db
parentsqlite: expose c import, add 'shared_cache' to init flags (diff)
downloadzig-sqlite-17ecc483cf725f370d0bceda414fec4aed8dc331.tar.gz
zig-sqlite-17ecc483cf725f370d0bceda414fec4aed8dc331.tar.xz
zig-sqlite-17ecc483cf725f370d0bceda414fec4aed8dc331.zip
sqlite: interpret database path in init flags as uri
To avoid the need for introducing multiple sqlite.Mode's for addressing all the different possible ways one may initialize a SQLite database, enable the flag SQLITE_OPEN_URI by default. This allows for initialization options which are not addressed by InitFlags as of yet, such as the option to initialize a shared in-memory SQLite database instance that may be shared across connections in the same address space, to be set via. URI query parameters. e.g. sqlite.Db.init({ .mode = .{ .File = "file:hello.db?mode=memory&cache=shared" }, .open_flags = .{ .create = true, .write = true }, .threading_mode = .MultiThread, });
-rw-r--r--sqlite.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/sqlite.zig b/sqlite.zig
index e88fb64..0a19fea 100644
--- a/sqlite.zig
+++ b/sqlite.zig
@@ -328,7 +328,7 @@ pub const Db = struct {
328 } 328 }
329 329
330 // Compute the flags 330 // Compute the flags
331 var flags: c_int = 0; 331 var flags: c_int = c.SQLITE_OPEN_URI;
332 flags |= @as(c_int, if (options.open_flags.write) c.SQLITE_OPEN_READWRITE else c.SQLITE_OPEN_READONLY); 332 flags |= @as(c_int, if (options.open_flags.write) c.SQLITE_OPEN_READWRITE else c.SQLITE_OPEN_READONLY);
333 if (options.open_flags.create) { 333 if (options.open_flags.create) {
334 flags |= c.SQLITE_OPEN_CREATE; 334 flags |= c.SQLITE_OPEN_CREATE;