diff options
| author | 2020-12-28 00:32:15 +0100 | |
|---|---|---|
| committer | 2020-12-30 15:19:09 +0100 | |
| commit | 1eeae525d8d150382f69be3537f70ebb970021b2 (patch) | |
| tree | d817501c1f7583db5558f88720264a7594d2b59b /README.md | |
| parent | document ThreadingMode and InitOptions (diff) | |
| download | zig-sqlite-1eeae525d8d150382f69be3537f70ebb970021b2.tar.gz zig-sqlite-1eeae525d8d150382f69be3537f70ebb970021b2.tar.xz zig-sqlite-1eeae525d8d150382f69be3537f70ebb970021b2.zip | |
update readme for Db.init
Diffstat (limited to '')
| -rw-r--r-- | README.md | 13 |
1 files changed, 10 insertions, 3 deletions
| @@ -51,12 +51,19 @@ You must create and initialize an instance of `sqlite.Db`: | |||
| 51 | 51 | ||
| 52 | ```zig | 52 | ```zig |
| 53 | var db: sqlite.Db = undefined; | 53 | var db: sqlite.Db = undefined; |
| 54 | try db.init(allocator, .{ .mode = sqlite.Db.Mode{ .File = "/home/vincent/mydata.db" } }); | 54 | try db.init(allocator, .{ |
| 55 | .mode = sqlite.Db.Mode{ .File = "/home/vincent/mydata.db" }, | ||
| 56 | .open_flags = .{ | ||
| 57 | .write = true, | ||
| 58 | .create = true, | ||
| 59 | }, | ||
| 60 | .threading_mode = .MultiThread, | ||
| 61 | }); | ||
| 55 | ``` | 62 | ``` |
| 56 | 63 | ||
| 57 | The `init` method takes an allocator and an optional tuple which will be used to configure sqlite. | 64 | The `init` method takes an allocator and a `InitOptions` struct which will be used to configure sqlite. |
| 58 | 65 | ||
| 59 | Right now the only member used in that tuple is `mode` which defines if the sqlite database is in memory or uses a file. | 66 | Only the `mode` field is mandatory, the other fields have sane default values. |
| 60 | 67 | ||
| 61 | ### Preparing a statement | 68 | ### Preparing a statement |
| 62 | 69 | ||