aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sqlite3.go18
-rw-r--r--sqlite3_other.go2
-rw-r--r--sqlite3_windows.go2
3 files changed, 17 insertions, 5 deletions
diff --git a/sqlite3.go b/sqlite3.go
index 157d4c3..db6bdf7 100644
--- a/sqlite3.go
+++ b/sqlite3.go
@@ -6,13 +6,17 @@
package sqlite3
/*
-#ifdef _WIN32
-# define _localtime32(x) localtime(x)
-#endif
#include <sqlite3.h>
#include <stdlib.h>
#include <string.h>
+#ifdef _WIN32
+#include <time.h>
+struct tm* _localtime32(const __time32_t *tm) {
+ return localtime(tm);
+}
+#endif
+
#ifdef __CYGWIN__
# include <errno.h>
#endif
@@ -88,6 +92,14 @@ func init() {
sql.Register("sqlite3", &SQLiteDriver{})
}
+// Return SQLite library Version information.
+func Version() (libVersion string, libVersionNumber int, sourceId string) {
+ libVersion = C.GoString(C.sqlite3_libversion())
+ libVersionNumber = int(C.sqlite3_libversion_number())
+ sourceId = C.GoString(C.sqlite3_sourceid())
+ return libVersion, libVersionNumber, sourceId
+}
+
// Driver struct.
type SQLiteDriver struct {
Extensions []string
diff --git a/sqlite3_other.go b/sqlite3_other.go
index c87c01f..54b6c7a 100644
--- a/sqlite3_other.go
+++ b/sqlite3_other.go
@@ -9,6 +9,6 @@ package sqlite3
/*
#cgo CFLAGS: -I.
#cgo linux LDFLAGS: -ldl
-#cgo CFLAGS: -DSQLITE_ENABLE_RTREE
+#cgo CFLAGS: -DSQLITE_ENABLE_RTREE -DSQLITE_THREADSAFE
*/
import "C"
diff --git a/sqlite3_windows.go b/sqlite3_windows.go
index 9c47124..1b339a0 100644
--- a/sqlite3_windows.go
+++ b/sqlite3_windows.go
@@ -8,6 +8,6 @@ package sqlite3
/*
#cgo CFLAGS: -I. -fno-stack-check -fno-stack-protector -mno-stack-arg-probe
#cgo LDFLAGS: -lmingwex -lmingw32
-#cgo CFLAGS: -DSQLITE_ENABLE_RTREE
+#cgo CFLAGS: -DSQLITE_ENABLE_RTREE -DSQLITE_THREADSAFE
*/
import "C"