From 59bd281a89883d39ef219699e4a46eab87b3cff9 Mon Sep 17 00:00:00 2001 From: Jason Abbott Date: Mon, 3 Jul 2017 12:51:48 -0600 Subject: Incorporate original PR 271 from https://github.com/brokensandals --- callback.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'callback.go') diff --git a/callback.go b/callback.go index 48fc63a..6a55964 100644 --- a/callback.go +++ b/callback.go @@ -53,6 +53,24 @@ func doneTrampoline(ctx *C.sqlite3_context) { ai.Done(ctx) } +//export commitHookTrampoline +func commitHookTrampoline(handle uintptr) int { + callback := lookupHandle(handle).(func() int) + return callback() +} + +//export rollbackHookTrampoline +func rollbackHookTrampoline(handle uintptr) { + callback := lookupHandle(handle).(func()) + callback() +} + +//export updateHookTrampoline +func updateHookTrampoline(handle uintptr, op int, db *C.char, table *C.char, rowid int64) { + callback := lookupHandle(handle).(func(int, string, string, int64)) + callback(op, C.GoString(db), C.GoString(table), rowid) +} + // Use handles to avoid passing Go pointers to C. type handleVal struct { -- cgit v1.2.3