diff options
| author | 2024-12-19 01:02:17 +0100 | |
|---|---|---|
| committer | 2024-12-19 01:02:17 +0100 | |
| commit | 39237dc9a467a83814eac6fba7863f243fadae8c (patch) | |
| tree | 122624fe03b882eb048c3044557ec9674e386ab0 | |
| parent | fix for latest zig (diff) | |
| download | zig-sqlite-39237dc9a467a83814eac6fba7863f243fadae8c.tar.gz zig-sqlite-39237dc9a467a83814eac6fba7863f243fadae8c.tar.xz zig-sqlite-39237dc9a467a83814eac6fba7863f243fadae8c.zip | |
dynamic statement: add prepareWithTail
| -rw-r--r-- | sqlite.zig | 6 |
1 files changed, 5 insertions, 1 deletions
| @@ -1568,6 +1568,10 @@ pub const DynamicStatement = struct { | |||
| 1568 | pub const PrepareError = error{EmptyQuery} || Error; | 1568 | pub const PrepareError = error{EmptyQuery} || Error; |
| 1569 | 1569 | ||
| 1570 | fn prepare(db: *Db, query: []const u8, options: QueryOptions, flags: c_uint) PrepareError!Self { | 1570 | fn prepare(db: *Db, query: []const u8, options: QueryOptions, flags: c_uint) PrepareError!Self { |
| 1571 | return prepareWithTail(db, query, options, flags, null); | ||
| 1572 | } | ||
| 1573 | |||
| 1574 | fn prepareWithTail(db: *Db, query: []const u8, options: QueryOptions, flags: c_uint, tail: ?*[*c]const u8) PrepareError!Self { | ||
| 1571 | var dummy_diags = Diagnostics{}; | 1575 | var dummy_diags = Diagnostics{}; |
| 1572 | var diags = options.diags orelse &dummy_diags; | 1576 | var diags = options.diags orelse &dummy_diags; |
| 1573 | const stmt = blk: { | 1577 | const stmt = blk: { |
| @@ -1578,7 +1582,7 @@ pub const DynamicStatement = struct { | |||
| 1578 | @intCast(query.len), | 1582 | @intCast(query.len), |
| 1579 | flags, | 1583 | flags, |
| 1580 | &tmp, | 1584 | &tmp, |
| 1581 | options.sql_tail_ptr, | 1585 | tail, |
| 1582 | ); | 1586 | ); |
| 1583 | if (result != c.SQLITE_OK) { | 1587 | if (result != c.SQLITE_OK) { |
| 1584 | diags.err = getLastDetailedErrorFromDb(db.db); | 1588 | diags.err = getLastDetailedErrorFromDb(db.db); |