Skip to content

Commit

Permalink
sqlite: fix types and flags for OpenBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
FiloSottile authored and crawshaw committed Apr 19, 2018
1 parent a98490a commit ad1523d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (conn *Conn) OpenBlob(dbn, table, column string, row int64, write bool) (*B
if err := conn.interrupted("Conn.OpenBlob", ""); err != nil {
return nil, err
}
switch res := C.sqlite3_blob_open(conn.conn, cdb, ctable, ccolumn, C.longlong(row), flags, &blob.blob); res {
switch res := C.sqlite3_blob_open(conn.conn, cdb, ctable, ccolumn, C.sqlite3_int64(row), flags, &blob.blob); res {
case C.SQLITE_LOCKED:
if res := C.wait_for_unlock_notify(conn.conn, conn.unlockNote); res != C.SQLITE_OK {
return nil, conn.reserr("Conn.OpenBlob(Wait)", "", res)
Expand Down
2 changes: 1 addition & 1 deletion func.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (ctx Context) ResultInt64(v int64) { C.sqlite3_result_int64(ctx.ptr, C.s
func (ctx Context) ResultFloat(v float64) { C.sqlite3_result_double(ctx.ptr, C.double(v)) }
func (ctx Context) ResultNull() { C.sqlite3_result_null(ctx.ptr) }
func (ctx Context) ResultValue(v Value) { C.sqlite3_result_value(ctx.ptr, v.ptr) }
func (ctx Context) ResultZeroBlob(n int64) { C.sqlite3_result_zeroblob64(ctx.ptr, C.sqlite_uint64(n)) }
func (ctx Context) ResultZeroBlob(n int64) { C.sqlite3_result_zeroblob64(ctx.ptr, C.sqlite3_uint64(n)) }
func (ctx Context) ResultText(v string) {
var cv *C.char
if len(v) != 0 {
Expand Down
6 changes: 4 additions & 2 deletions sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ package sqlite
// #cgo CFLAGS: -DSQLITE_USE_ALLOCA
// #cgo CFLAGS: -DSQLITE_ENABLE_COLUMN_METADATA
// #cgo linux LDFLAGS: -ldl -lm
// #cgo openbsd LDFLAGS: -lm
// #cgo openbsd CFLAGS: -std=c99
//
// #include <blocking_step.h>
// #include <sqlite3.h>
Expand Down Expand Up @@ -530,7 +532,7 @@ func (stmt *Stmt) BindParamCount() int {
// BindInt64 binds value to a numbered stmt parameter.
// https://www.sqlite.org/c3ref/bind_blob.html
func (stmt *Stmt) BindInt64(param int, value int64) {
res := C.sqlite3_bind_int64(stmt.stmt, C.int(param), C.longlong(value))
res := C.sqlite3_bind_int64(stmt.stmt, C.int(param), C.sqlite3_int64(value))
stmt.handleBindErr("BindInt64", res)
}

Expand All @@ -540,7 +542,7 @@ func (stmt *Stmt) BindBool(param int, value bool) {
if value {
v = 1
}
res := C.sqlite3_bind_int64(stmt.stmt, C.int(param), C.longlong(v))
res := C.sqlite3_bind_int64(stmt.stmt, C.int(param), C.sqlite3_int64(v))
stmt.handleBindErr("BindBool", res)
}

Expand Down

0 comments on commit ad1523d

Please sign in to comment.