authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-07-09 13:42:53 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-07-09 13:42:53 -07:00
log6ab167dff5bc5f09d3d83d835b805d43df939157
tree46e47562b2cc49ae203940b0dfae710f935a1476
parentc5cad45bcb9d90a0ea2f9b91f2d61a3fcbabe8a7

sqlite3: add prepareDynamic


1 files changed, 4 insertions(+), 0 deletions(-)

src/sqlite3.zig+4
...@@ -56,6 +56,10 @@ pub fn first(self: *Self, alloc: std.mem.Allocator, comptime T: type, comptime q...@@ -56,6 +56,10 @@ pub fn first(self: *Self, alloc: std.mem.Allocator, comptime T: type, comptime q
56 return try stmt.oneAlloc(T, alloc, .{}, args);56 return try stmt.oneAlloc(T, alloc, .{}, args);
57}57}
5858
59pub fn prepareDynamic(self: *Self, query: string) !sqlite.DynamicStatement {
60 return self.db.prepareDynamic(query);
61}
62
59pub fn doesTableExist(self: *Self, alloc: std.mem.Allocator, name: string) !bool {63pub fn doesTableExist(self: *Self, alloc: std.mem.Allocator, name: string) !bool {
60 for (try self.collect(alloc, string, "select name from sqlite_master where type=? AND name=?", .{ .type = "table", .name = name })) |item| {64 for (try self.collect(alloc, string, "select name from sqlite_master where type=? AND name=?", .{ .type = "table", .name = name })) |item| {
61 if (std.mem.eql(u8, item, name)) {65 if (std.mem.eql(u8, item, name)) {