Make inline for loops compatible with stage1
This commit is contained in:
parent
cfdc8c5761
commit
181e57a631
2 changed files with 6 additions and 2 deletions
|
@ -186,7 +186,9 @@ pub const Db = struct {
|
||||||
var arena = std.heap.ArenaAllocator.init(alloc orelse return error.AllocatorRequired);
|
var arena = std.heap.ArenaAllocator.init(alloc orelse return error.AllocatorRequired);
|
||||||
defer arena.deinit();
|
defer arena.deinit();
|
||||||
const params = try arena.allocator().alloc(?[*:0]const u8, args.len);
|
const params = try arena.allocator().alloc(?[*:0]const u8, args.len);
|
||||||
inline for (args) |arg, i| {
|
//inline for (args) |arg, i| {
|
||||||
|
inline for (std.meta.fields(@TypeOf(args))) |field, i| {
|
||||||
|
const arg = @field(args, field.name);
|
||||||
params[i] = if (try common.prepareParamText(&arena, arg)) |slice|
|
params[i] = if (try common.prepareParamText(&arena, arg)) |slice|
|
||||||
slice.ptr
|
slice.ptr
|
||||||
else
|
else
|
||||||
|
|
|
@ -118,7 +118,9 @@ pub const Db = struct {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (@TypeOf(args) != void) {
|
if (@TypeOf(args) != void) {
|
||||||
inline for (args) |arg, i| {
|
//inline for (args) |arg, i| {
|
||||||
|
inline for (std.meta.fields(@TypeOf(args))) |field, i| {
|
||||||
|
const arg = @field(args, field.name);
|
||||||
// SQLite treats $NNN args as having the name NNN, not index NNN.
|
// SQLite treats $NNN args as having the name NNN, not index NNN.
|
||||||
// As such, if you reference $2 and not $1 in your query (such as
|
// As such, if you reference $2 and not $1 in your query (such as
|
||||||
// when dynamically constructing queries), it could assign $2 the
|
// when dynamically constructing queries), it could assign $2 the
|
||||||
|
|
Loading…
Reference in a new issue