Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/test-sqlite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ jobs:
- name: Test
run: go test -v ./...

- name: With sqlite_enable_tmstmpvfs
run: go test -v -tags sqlite_enable_tmstmpvfs

- name: Race
run: go test -v -race ./...

- name: Race with sqlite_enable_api_armor
run: go test -v -race -tags sqlite_enable_api_armor
- name: Race with sqlite_enable_api_armor and sqlite_enable_tmstmpvfs
run: go test -v -race -tags sqlite_enable_api_armor,sqlite_enable_tmstmpvfs

- name: No CGO build
run: CGO_ENABLED=0 go install ./...
15 changes: 14 additions & 1 deletion cgosqlite/cgosqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,21 @@ package cgosqlite

// Enable API armor.
#cgo sqlite_enable_api_armor CFLAGS: -DSQLITE_ENABLE_API_ARMOR

#ifdef SQLITE_ENABLE_API_ARMOR
int api_armor_enabled=1;
#else
int api_armor_enabled=0;
#endif

// Enable the timestamp VFS shim.
#cgo sqlite_enable_tmstmpvfs CFLAGS: -DSQLITE_EXTRA_INIT=sqlite3_register_tmstmpvfs
#cgo sqlite_enable_tmstmpvfs CFLAGS: -DSQLITE_TMSTMPVFS_STATIC=1
#ifdef SQLITE_TMSTMPVFS_STATIC
int tmstmpvfs_enabled=1;
#else
int tmstmpvfs_enabled=0;
#endif

#include "cgosqlite.h"
*/
import "C"
Expand Down Expand Up @@ -516,3 +524,8 @@ func stringFromBytes(b []byte) string {
func APIArmorEnabled() bool {
return C.api_armor_enabled == 1
}

// TimestampVFSEnabled reports whether or not sqlite was compiled with support for the tmstmpvfs shim.
func TimestampVFSEnabled() bool {
return C.tmstmpvfs_enabled == 1
}
Loading
Loading