diff options
| author | 2021-10-07 16:59:53 +0800 | |
|---|---|---|
| committer | 2021-10-19 08:40:36 +0200 | |
| commit | 8be5530a3fcfc26c58e47035b4723308326dda1c (patch) | |
| tree | 7570f3bd52e5c2774a91982eaaef59c169a9d6e6 | |
| parent | ParsedQuery: support named parameters. (diff) | |
| download | zig-sqlite-8be5530a3fcfc26c58e47035b4723308326dda1c.tar.gz zig-sqlite-8be5530a3fcfc26c58e47035b4723308326dda1c.tar.xz zig-sqlite-8be5530a3fcfc26c58e47035b4723308326dda1c.zip | |
sqlite: move to new ParsedQuery and BindMarker
| -rw-r--r-- | sqlite.zig | 22 |
1 files changed, 9 insertions, 13 deletions
| @@ -1489,19 +1489,15 @@ pub fn Statement(comptime opts: StatementOptions, comptime query: ParsedQuery) t | |||
| 1489 | 1489 | ||
| 1490 | inline for (StructTypeInfo.fields) |struct_field, _i| { | 1490 | inline for (StructTypeInfo.fields) |struct_field, _i| { |
| 1491 | const bind_marker = query.bind_markers[_i]; | 1491 | const bind_marker = query.bind_markers[_i]; |
| 1492 | switch (bind_marker) { | 1492 | if (bind_marker.typed) |typ| { |
| 1493 | .Typed => |typ| { | 1493 | const FieldTypeInfo = @typeInfo(struct_field.field_type); |
| 1494 | const FieldTypeInfo = @typeInfo(struct_field.field_type); | 1494 | switch (FieldTypeInfo) { |
| 1495 | switch (FieldTypeInfo) { | 1495 | .Struct, .Enum, .Union => comptime assertMarkerType( |
| 1496 | .Struct, .Enum, .Union => comptime assertMarkerType( | 1496 | if (@hasDecl(struct_field.field_type, "BaseType")) struct_field.field_type.BaseType else struct_field.field_type, |
| 1497 | if (@hasDecl(struct_field.field_type, "BaseType")) struct_field.field_type.BaseType else struct_field.field_type, | 1497 | typ, |
| 1498 | typ, | 1498 | ), |
| 1499 | ), | 1499 | else => comptime assertMarkerType(struct_field.field_type, typ), |
| 1500 | else => comptime assertMarkerType(struct_field.field_type, typ), | 1500 | } |
| 1501 | } | ||
| 1502 | }, | ||
| 1503 | |||
| 1504 | .Untyped => {}, | ||
| 1505 | } | 1501 | } |
| 1506 | } | 1502 | } |
| 1507 | 1503 | ||