From a4227e7c8fbbe9c24443e269b459d367d59ef85a Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Tue, 6 Aug 2024 18:18:00 +0200 Subject: PreparedStatement: rename _current to _current_binding --- src/duckdb/PreparedStatement.zig | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'src/duckdb/PreparedStatement.zig') diff --git a/src/duckdb/PreparedStatement.zig b/src/duckdb/PreparedStatement.zig index d6b60b2..5e3229e 100644 --- a/src/duckdb/PreparedStatement.zig +++ b/src/duckdb/PreparedStatement.zig @@ -5,72 +5,72 @@ const c = @cImport({ const Result = @import("Result.zig").Result; _q : c.duckdb_prepared_statement, -_current: usize, +_current_binding: usize, const Self = @This(); pub fn init(stmt: c.duckdb_prepared_statement) !Self{ return .{ ._q = stmt, - ._current = 1, + ._current_binding = 1, }; } pub fn bindInt(self: *Self, param: anytype) !void{ const state = switch(@TypeOf(param)) { - u8 => c.duckdb_bind_uint8 (self._q, self._current, param), - u16 => c.duckdb_bind_uint16(self._q, self._current, param), - u32 => c.duckdb_bind_uint32(self._q, self._current, param), - u64 => c.duckdb_bind_uint64(self._q, self._current, param), - i8 => c.duckdb_bind_int8 (self._q, self._current, param), - i16 => c.duckdb_bind_int16(self._q, self._current, param), - i32 => c.duckdb_bind_int32(self._q, self._current, param), - i64 => c.duckdb_bind_int64(self._q, self._current, param), + u8 => c.duckdb_bind_uint8 (self._q, self._current_binding, param), + u16 => c.duckdb_bind_uint16(self._q, self._current_binding, param), + u32 => c.duckdb_bind_uint32(self._q, self._current_binding, param), + u64 => c.duckdb_bind_uint64(self._q, self._current_binding, param), + i8 => c.duckdb_bind_int8 (self._q, self._current_binding, param), + i16 => c.duckdb_bind_int16(self._q, self._current_binding, param), + i32 => c.duckdb_bind_int32(self._q, self._current_binding, param), + i64 => c.duckdb_bind_int64(self._q, self._current_binding, param), else => @compileError("Invalid int type for binding: " ++ @typeName(@TypeOf(param))), }; if ( state == c.DuckDBError ) { return error.DuckDbBindError; } - self._current += 1; + self._current_binding += 1; } pub fn bindFloat(self: *Self, param: anytype) !void{ const state = switch(@TypeOf(param)) { - f32 => c.duckdb_bind_float (self._q, self._current, param), - f64 => c.duckdb_bind_double(self._q, self._current, param), + f32 => c.duckdb_bind_float (self._q, self._current_binding, param), + f64 => c.duckdb_bind_double(self._q, self._current_binding, param), else => @compileError("Invalid float type for binding: " ++ @typeName(@TypeOf(param))), }; if ( state == c.DuckDBError ) { return error.DuckDbBindError; } - self._current += 1; + self._current_binding += 1; } pub fn bindBool(self: *Self, param: bool) !void{ - const state = c.duckdb_bind_bool(self._q, self._current, param); + const state = c.duckdb_bind_bool(self._q, self._current_binding, param); if ( state == c.DuckDBError ) { return error.DuckDbBindError; } - self._current += 1; + self._current_binding += 1; } pub fn bindNull(self: *Self) !void{ - const state = c.duckdb_bind_bool(self._q, self._current); + const state = c.duckdb_bind_bool(self._q, self._current_binding); if ( state == c.DuckDBError ) { return error.DuckDbBindError; } - self._current += 1; + self._current_binding += 1; } pub fn bindString(self: *Self, param: []const u8) !void{ - const state = c.duckdb_bind_varchar_length(self._q, self._current, + const state = c.duckdb_bind_varchar_length(self._q, self._current_binding, param.ptr, param.len); if ( state == c.DuckDBError ) { return error.DuckDbBindError; } - self._current += 1; + self._current_binding += 1; } pub fn bind(self: *Self, param: anytype) !void { -- cgit v1.2.3