diff --git a/cgosqlite/cgosqlite.go b/cgosqlite/cgosqlite.go index 7ee11b6..9bd05af 100644 --- a/cgosqlite/cgosqlite.go +++ b/cgosqlite/cgosqlite.go @@ -302,15 +302,15 @@ func (stmt *Stmt) StepResult() (row bool, lastInsertRowID, changes int64, d time } func (stmt *Stmt) BindDouble(col int, val float64) error { - return errCode(C.sqlite3_bind_double(stmt.stmt.ptr(), C.int(col), C.double(val))) + return errCode(C.ts_sqlite3_bind_double(stmt.stmt.int(), C.int(col), C.double(val))) } func (stmt *Stmt) BindInt64(col int, val int64) error { - return errCode(C.sqlite3_bind_int64(stmt.stmt.ptr(), C.int(col), C.sqlite3_int64(val))) + return errCode(C.ts_sqlite3_bind_int64(stmt.stmt.int(), C.int(col), C.sqlite3_int64(val))) } func (stmt *Stmt) BindNull(col int) error { - return errCode(C.sqlite3_bind_null(stmt.stmt.ptr(), C.int(col))) + return errCode(C.ts_sqlite3_bind_null(stmt.stmt.int(), C.int(col))) } func (stmt *Stmt) BindText64(col int, val string) error { diff --git a/cgosqlite/cgosqlite.h b/cgosqlite/cgosqlite.h index 675d031..cae2bcc 100644 --- a/cgosqlite/cgosqlite.h +++ b/cgosqlite/cgosqlite.h @@ -23,6 +23,18 @@ static int bind_blob64(handle_sqlite3_stmt stmt, int col, char* str, sqlite3_uin return sqlite3_bind_blob64((sqlite3_stmt*)(stmt), col, str, n, SQLITE_TRANSIENT); } +static int ts_sqlite3_bind_double(handle_sqlite3_stmt stmt, int col, double v) { + return sqlite3_bind_double((sqlite3_stmt*)(stmt), col, v); +} + +static int ts_sqlite3_bind_int64(handle_sqlite3_stmt stmt, int col, sqlite3_int64 v) { + return sqlite3_bind_int64((sqlite3_stmt*)(stmt), col, v); +} + +static int ts_sqlite3_bind_null(handle_sqlite3_stmt stmt, int col) { + return sqlite3_bind_null((sqlite3_stmt*)(stmt), col); +} + // We only need the Go string's memory for the duration of the call, // and the GC pins it for us if we pass the gostring_t to C, so we // do the conversion here instead of with C.CString.