diff options
Diffstat (limited to 'sqlite.zig')
| -rw-r--r-- | sqlite.zig | 11 |
1 files changed, 10 insertions, 1 deletions
| @@ -5,7 +5,7 @@ const io = std.io; | |||
| 5 | const mem = std.mem; | 5 | const mem = std.mem; |
| 6 | const testing = std.testing; | 6 | const testing = std.testing; |
| 7 | 7 | ||
| 8 | const c = @cImport({ | 8 | pub 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, |