Commit 0830587d authored by gwenn's avatar gwenn

Ugly binding to sqlite3_log.

parent 215be9f6
...@@ -38,6 +38,11 @@ extern int goXProgress(void *pArg); ...@@ -38,6 +38,11 @@ extern int goXProgress(void *pArg);
static void goSqlite3ProgressHandler(sqlite3 *db, int freq, void *pArg) { static void goSqlite3ProgressHandler(sqlite3 *db, int freq, void *pArg) {
sqlite3_progress_handler(db, freq, goXProgress, pArg); sqlite3_progress_handler(db, freq, goXProgress, pArg);
} }
// cgo doesn't support varargs
static void my_log(int iErrCode, char *msg) {
sqlite3_log(iErrCode, msg);
}
*/ */
import "C" import "C"
...@@ -248,7 +253,7 @@ func SoftHeapLimit() int64 { ...@@ -248,7 +253,7 @@ func SoftHeapLimit() int64 {
} }
// Calls http://sqlite.org/c3ref/soft_heap_limit64.html // Calls http://sqlite.org/c3ref/soft_heap_limit64.html
func SetSoftHeapLimit(n int64) int64 { func SetSoftHeapLimit(n int64) int64 {
return int64(C.sqlite3_soft_heap_limit64( C.sqlite3_int64(n))) return int64(C.sqlite3_soft_heap_limit64(C.sqlite3_int64(n)))
} }
// Calls http://sqlite.org/c3ref/complete.html // Calls http://sqlite.org/c3ref/complete.html
...@@ -257,3 +262,10 @@ func Complete(sql string) bool { ...@@ -257,3 +262,10 @@ func Complete(sql string) bool {
defer C.free(unsafe.Pointer(cs)) defer C.free(unsafe.Pointer(cs))
return C.sqlite3_complete(cs) != 0 return C.sqlite3_complete(cs) != 0
} }
// Calls http://sqlite.org/c3ref/log.html
func Log(err /*Errno*/ int, msg string) {
cs := C.CString(msg)
defer C.free(unsafe.Pointer(cs))
C.my_log(C.int(err), cs)
}
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