diff options
author | Jason Abbott <Jason-Abbott@users.noreply.github.com> | 2017-07-03 12:59:20 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-03 12:59:20 -0600 |
commit | dbaad204e95ad68c55137bcd7f879c9cb2fa9deb (patch) | |
tree | cc83849ec381c059e37faf0db7c7bb698ffa3fdd /callback.go | |
parent | Merge pull request #431 from deepilla/issue-430 (diff) | |
parent | Incorporate original PR 271 from https://github.com/brokensandals (diff) | |
download | golite-dbaad204e95ad68c55137bcd7f879c9cb2fa9deb.tar.gz golite-dbaad204e95ad68c55137bcd7f879c9cb2fa9deb.tar.xz |
Merge pull request #1 from toba/missing-callback-hooks
Incorporate original PR 271 from https://github.com/brokensandals
Diffstat (limited to 'callback.go')
-rw-r--r-- | callback.go | 18 |
1 files changed, 18 insertions, 0 deletions
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 { |