aboutsummaryrefslogtreecommitdiff
path: root/callback.go
diff options
context:
space:
mode:
authorPhilip O'Toole <philip.otoole@yahoo.com>2017-06-17 12:02:47 -0700
committerGitHub <noreply@github.com>2017-06-17 12:02:47 -0700
commitb951516ea086ff8c8a97eff7a59f2b95458b0a1c (patch)
tree035930342ee0510d83ab8ee47e4068bdc50247c3 /callback.go
parentMerge pull request #1 from mattn/master (diff)
parentMerge pull request #425 from xxr3376/empty-bytes (diff)
downloadgolite-b951516ea086ff8c8a97eff7a59f2b95458b0a1c.tar.gz
golite-b951516ea086ff8c8a97eff7a59f2b95458b0a1c.tar.xz
Merge pull request #2 from mattn/master
Merge upstream
Diffstat (limited to 'callback.go')
-rw-r--r--callback.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/callback.go b/callback.go
index e2bf3c6..48fc63a 100644
--- a/callback.go
+++ b/callback.go
@@ -11,7 +11,11 @@ package sqlite3
// code for SQLite custom functions is in here.
/*
+#ifndef USE_LIBSQLITE3
#include <sqlite3-binding.h>
+#else
+#include <sqlite3.h>
+#endif
#include <stdlib.h>
void _sqlite3_result_text(sqlite3_context* ctx, const char* s);
@@ -36,8 +40,8 @@ func callbackTrampoline(ctx *C.sqlite3_context, argc int, argv **C.sqlite3_value
}
//export stepTrampoline
-func stepTrampoline(ctx *C.sqlite3_context, argc int, argv **C.sqlite3_value) {
- args := (*[(math.MaxInt32 - 1) / unsafe.Sizeof((*C.sqlite3_value)(nil))]*C.sqlite3_value)(unsafe.Pointer(argv))[:argc:argc]
+func stepTrampoline(ctx *C.sqlite3_context, argc C.int, argv **C.sqlite3_value) {
+ args := (*[(math.MaxInt32 - 1) / unsafe.Sizeof((*C.sqlite3_value)(nil))]*C.sqlite3_value)(unsafe.Pointer(argv))[:int(argc):int(argc)]
ai := lookupHandle(uintptr(C.sqlite3_user_data(ctx))).(*aggInfo)
ai.Step(ctx, args)
}