ext/duckdb/prepared_statement.c in duckdb-0.2.6.0 vs ext/duckdb/prepared_statement.c in duckdb-0.2.6.1
- old
+ new
@@ -68,11 +68,11 @@
rb_raise(rb_eArgError, "index of parameter must be greater than 0");
}
return idx;
}
-static VALUE duckdb_prepared_statement_bind_boolean(VALUE self, VALUE vidx, VALUE val)
+static VALUE duckdb_prepared_statement_bind_bool(VALUE self, VALUE vidx, VALUE val)
{
rubyDuckDBPreparedStatement *ctx;
idx_t idx = check_index(vidx);
Data_Get_Struct(self, rubyDuckDBPreparedStatement, ctx);
@@ -84,10 +84,24 @@
rb_raise(eDuckDBError, "fail to bind %llu parameter", (unsigned long long)idx);
}
return self;
}
+static VALUE duckdb_prepared_statement_bind_int8(VALUE self, VALUE vidx, VALUE val)
+{
+ rubyDuckDBPreparedStatement *ctx;
+ idx_t idx = check_index(vidx);
+ int8_t i8val = (int8_t)NUM2INT(val);
+
+ Data_Get_Struct(self, rubyDuckDBPreparedStatement, ctx);
+
+ if (duckdb_bind_int8(ctx->prepared_statement, idx, i8val) == DuckDBError) {
+ rb_raise(eDuckDBError, "fail to bind %llu parameter", (unsigned long long)idx);
+ }
+ return self;
+}
+
static VALUE duckdb_prepared_statement_bind_int16(VALUE self, VALUE vidx, VALUE val)
{
rubyDuckDBPreparedStatement *ctx;
idx_t idx = check_index(vidx);
int16_t i16val = NUM2INT(val);
@@ -201,10 +215,11 @@
rb_define_alloc_func(cDuckDBPreparedStatement, allocate);
rb_define_method(cDuckDBPreparedStatement, "initialize", duckdb_prepared_statement_initialize, 2);
rb_define_method(cDuckDBPreparedStatement, "execute", duckdb_prepared_statement_execute, 0);
rb_define_method(cDuckDBPreparedStatement, "nparams", duckdb_prepared_statement_nparams, 0);
- rb_define_method(cDuckDBPreparedStatement, "bind_boolean", duckdb_prepared_statement_bind_boolean, 2);
+ rb_define_method(cDuckDBPreparedStatement, "bind_bool", duckdb_prepared_statement_bind_bool, 2);
+ rb_define_method(cDuckDBPreparedStatement, "bind_int8", duckdb_prepared_statement_bind_int8, 2);
rb_define_method(cDuckDBPreparedStatement, "bind_int16", duckdb_prepared_statement_bind_int16, 2);
rb_define_method(cDuckDBPreparedStatement, "bind_int32", duckdb_prepared_statement_bind_int32, 2);
rb_define_method(cDuckDBPreparedStatement, "bind_int64", duckdb_prepared_statement_bind_int64, 2);
rb_define_method(cDuckDBPreparedStatement, "bind_float", duckdb_prepared_statement_bind_float, 2);
rb_define_method(cDuckDBPreparedStatement, "bind_double", duckdb_prepared_statement_bind_double, 2);