diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 13 |
1 files changed, 13 insertions, 0 deletions
| @@ -104,6 +104,19 @@ defer stmt.deinit(); | |||
| 104 | 104 | ||
| 105 | The `Db.prepare` method takes a `comptime` query string. | 105 | The `Db.prepare` method takes a `comptime` query string. |
| 106 | 106 | ||
| 107 | ### Diagnostics | ||
| 108 | |||
| 109 | If you want failure diagnostics you can use `prepareWithDiags` like this: | ||
| 110 | |||
| 111 | ```zig | ||
| 112 | var diags = sqlite.Diagnostics{}; | ||
| 113 | var stmt = db.prepareWithDiags(query, .{ .diags = &diags }) catch |err| { | ||
| 114 | std.log.err("unable to prepare statement, got error {s}. diagnostics: {s}", .{ err, diags }); | ||
| 115 | return err; | ||
| 116 | }; | ||
| 117 | defer stmt.deinit(); | ||
| 118 | ``` | ||
| 119 | |||
| 107 | ## Executing a statement | 120 | ## Executing a statement |
| 108 | 121 | ||
| 109 | For queries which do not return data (`INSERT`, `UPDATE`) you can use the `exec` method: | 122 | For queries which do not return data (`INSERT`, `UPDATE`) you can use the `exec` method: |