Commit d251084b authored by gwenn's avatar gwenn

Fix signature of the BusyHandler and ProgressHandler callbacks.

parent ddcc9654
...@@ -187,8 +187,9 @@ func (c *Conn) SetAuthorizer(f Authorizer, udp interface{}) error { ...@@ -187,8 +187,9 @@ func (c *Conn) SetAuthorizer(f Authorizer, udp interface{}) error {
return c.error(C.goSqlite3SetAuthorizer(c.db, unsafe.Pointer(c.authorizer))) return c.error(C.goSqlite3SetAuthorizer(c.db, unsafe.Pointer(c.authorizer)))
} }
// Returns true to try again.
// See Conn.BusyHandler // See Conn.BusyHandler
type BusyHandler func(udp interface{}, count int) int type BusyHandler func(udp interface{}, count int) bool
type sqliteBusyHandler struct { type sqliteBusyHandler struct {
f BusyHandler f BusyHandler
...@@ -199,7 +200,7 @@ type sqliteBusyHandler struct { ...@@ -199,7 +200,7 @@ type sqliteBusyHandler struct {
func goXBusy(udp unsafe.Pointer, count C.int) C.int { func goXBusy(udp unsafe.Pointer, count C.int) C.int {
arg := (*sqliteBusyHandler)(udp) arg := (*sqliteBusyHandler)(udp)
result := arg.f(arg.udp, int(count)) result := arg.f(arg.udp, int(count))
return C.int(result) return btocint(result)
} }
// Register a callback to handle SQLITE_BUSY errors // Register a callback to handle SQLITE_BUSY errors
...@@ -215,9 +216,9 @@ func (c *Conn) BusyHandler(f BusyHandler, udp interface{}) error { ...@@ -215,9 +216,9 @@ func (c *Conn) BusyHandler(f BusyHandler, udp interface{}) error {
return c.error(C.goSqlite3BusyHandler(c.db, unsafe.Pointer(c.busyHandler))) return c.error(C.goSqlite3BusyHandler(c.db, unsafe.Pointer(c.busyHandler)))
} }
// Returns non-zero to interrupt. // Returns true to interrupt.
// See Conn.ProgressHandler // See Conn.ProgressHandler
type ProgressHandler func(udp interface{}) int type ProgressHandler func(udp interface{}) bool
type sqliteProgressHandler struct { type sqliteProgressHandler struct {
f ProgressHandler f ProgressHandler
...@@ -228,7 +229,7 @@ type sqliteProgressHandler struct { ...@@ -228,7 +229,7 @@ type sqliteProgressHandler struct {
func goXProgress(udp unsafe.Pointer) C.int { func goXProgress(udp unsafe.Pointer) C.int {
arg := (*sqliteProgressHandler)(udp) arg := (*sqliteProgressHandler)(udp)
result := arg.f(arg.udp) result := arg.f(arg.udp)
return C.int(result) return btocint(result)
} }
// Query progress callbacks // Query progress callbacks
......
...@@ -23,9 +23,9 @@ func profile(d interface{}, sql string, nanoseconds uint64) { ...@@ -23,9 +23,9 @@ func profile(d interface{}, sql string, nanoseconds uint64) {
//fmt.Printf("%s: %s = %d\n", d, sql, nanoseconds/1000) //fmt.Printf("%s: %s = %d\n", d, sql, nanoseconds/1000)
} }
func progressHandler(d interface{}) int { func progressHandler(d interface{}) bool {
//fmt.Print("+") //fmt.Print("+")
return 0 return false
} }
func commitHook(d interface{}) int { func commitHook(d interface{}) int {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment