summaryrefslogtreecommitdiff
path: root/sqlite.zig
diff options
context:
space:
mode:
authorGravatar Vincent Rischmann2020-12-30 15:15:30 +0100
committerGravatar Vincent Rischmann2020-12-30 15:15:30 +0100
commitfb85adfcec1a8c920b026a8c43b66823b39f3e73 (patch)
treec9497e405daec4f05cf1a515ce36a5808f5bba42 /sqlite.zig
parentremove the allocator from Db and Db.init (diff)
downloadzig-sqlite-fb85adfcec1a8c920b026a8c43b66823b39f3e73.tar.gz
zig-sqlite-fb85adfcec1a8c920b026a8c43b66823b39f3e73.tar.xz
zig-sqlite-fb85adfcec1a8c920b026a8c43b66823b39f3e73.zip
document ThreadingMode and InitOptions
Diffstat (limited to 'sqlite.zig')
-rw-r--r--sqlite.zig20
1 files changed, 19 insertions, 1 deletions
diff --git a/sqlite.zig b/sqlite.zig
index 3f2cd5a..4a65461 100644
--- a/sqlite.zig
+++ b/sqlite.zig
@@ -12,16 +12,34 @@ usingnamespace @import("query.zig");
12 12
13const logger = std.log.scoped(.sqlite); 13const logger = std.log.scoped(.sqlite);
14 14
15/// ThreadingMode controls the threading mode used by SQLite.
16///
17/// See https://sqlite.org/threadsafe.html
15pub const ThreadingMode = enum { 18pub const ThreadingMode = enum {
19 /// SingleThread makes SQLite unsafe to use with more than a single thread at once.
16 SingleThread, 20 SingleThread,
21 /// MultiThread makes SQLite safe to use with multiple threads at once provided that
22 /// a single database connection is not by more than a single thread at once.
17 MultiThread, 23 MultiThread,
24 /// Serialized makes SQLite safe to use with multiple threads at once with no restriction.
18 Serialized, 25 Serialized,
19}; 26};
20 27
21pub const InitOptions = struct { 28pub const InitOptions = struct {
29 /// mode controls how the database is opened.
30 ///
31 /// Defaults to a in-memory database.
22 mode: Db.Mode = .Memory, 32 mode: Db.Mode = .Memory,
33
34 /// open_flags controls the flags used when opening a database.
35 ///
36 /// Defaults to a read only database.
23 open_flags: Db.OpenFlags = .{}, 37 open_flags: Db.OpenFlags = .{},
24 threading_mode: ThreadingMode = .SingleThread, 38
39 /// threading_mode controls the threading mode used by SQLite.
40 ///
41 /// Defaults to Serialized.
42 threading_mode: ThreadingMode = .Serialized,
25}; 43};
26 44
27fn isThreadSafe() bool { 45fn isThreadSafe() bool {