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
10 changes: 10 additions & 0 deletions cgosqlite/cgosqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,3 +531,13 @@ func APIArmorEnabled() bool {
func TimestampVFSEnabled() bool {
return C.tmstmpvfs_enabled == 1
}

// SQLiteVersion reports SQLITE_VERSION.
func SQLiteVersion() string {
return C.GoString(C.sqlite3_libversion())
}

// SQLiteVersionNumber reports SQLITE_VERSION_NUMBER.
func SQLiteVersionNumber() int {
return int(C.sqlite3_libversion_number())
}
4 changes: 4 additions & 0 deletions cgosqlite/cgosqlite.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#include <math.h> // math.h is required on linux for FTS5.
#ifdef SQLITE_TRUNK
#include "sqlite3_trunk.h"
#else
#include "sqlite3.h"
#endif
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
Expand Down
21 changes: 21 additions & 0 deletions cgosqlite/release_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//go:build !sqlite_trunk

package cgosqlite

import "testing"

func TestSQLiteVersion(t *testing.T) {
const want = "3.51.2"
got := SQLiteVersion()
if got != want {
t.Fatalf("wrong version, want %s, got %s", want, got)
}
}

func TestSQLiteVersionNumber(t *testing.T) {
const want = 3051002
got := SQLiteVersionNumber()
if got != want {
t.Fatalf("wrong version, want %d, got %d", want, got)
}
}
22 changes: 11 additions & 11 deletions cgosqlite/sqlite3_trunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -141394,7 +141394,7 @@ SQLITE_API int sqlite3_exec(
*/
#ifndef SQLITE3EXT_H
#define SQLITE3EXT_H
/* #include "sqlite3.h" */
/* #include "sqlite3_trunk.h" */

/*
** The following structure holds pointers to all of the SQLite API
Expand Down Expand Up @@ -186161,7 +186161,7 @@ SQLITE_API int sqlite3_complete16(const void *zSql){
** This header file is used by programs that want to link against the
** FTS3 library. All it does is declare the sqlite3Fts3Init() interface.
*/
/* #include "sqlite3.h" */
/* #include "sqlite3_trunk.h" */

#if 0
extern "C" {
Expand Down Expand Up @@ -186194,7 +186194,7 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db);
** This header file is used by programs that want to link against the
** RTREE library. All it does is declare the sqlite3RtreeInit() interface.
*/
/* #include "sqlite3.h" */
/* #include "sqlite3_trunk.h" */

#ifdef SQLITE_OMIT_VIRTUALTABLE
# undef SQLITE_ENABLE_RTREE
Expand Down Expand Up @@ -186231,7 +186231,7 @@ SQLITE_PRIVATE int sqlite3RtreeInit(sqlite3 *db);
** This header file is used by programs that want to link against the
** ICU extension. All it does is declare the sqlite3IcuInit() interface.
*/
/* #include "sqlite3.h" */
/* #include "sqlite3_trunk.h" */

#if 0
extern "C" {
Expand Down Expand Up @@ -192094,7 +192094,7 @@ SQLITE_PRIVATE void sqlite3ConnectionClosed(sqlite3 *db){
SQLITE_EXTENSION_INIT3
#endif

/* #include "sqlite3.h" */
/* #include "sqlite3_trunk.h" */
/************** Include fts3_tokenizer.h in the middle of fts3Int.h **********/
/************** Begin file fts3_tokenizer.h **********************************/
/*
Expand Down Expand Up @@ -192123,7 +192123,7 @@ SQLITE_EXTENSION_INIT3
** If tokenizers are to be allowed to call sqlite3_*() functions, then
** we will need a way to register the API consistently.
*/
/* #include "sqlite3.h" */
/* #include "sqlite3_trunk.h" */

/*
** Structures used by the tokenizer interface. When a new tokenizer
Expand Down Expand Up @@ -217202,7 +217202,7 @@ SQLITE_PRIVATE Module *sqlite3JsonVtabRegister(sqlite3 *db, const char *zName){
/* #include "sqlite3ext.h" */
SQLITE_EXTENSION_INIT1
#else
/* #include "sqlite3.h" */
/* #include "sqlite3_trunk.h" */
#endif
SQLITE_PRIVATE sqlite3_int64 sqlite3GetToken(const unsigned char*,int*); /* In SQLite core */

Expand Down Expand Up @@ -223517,7 +223517,7 @@ SQLITE_API int sqlite3_rtree_init(
/* #include "sqlite3ext.h" */
SQLITE_EXTENSION_INIT1
#else
/* #include "sqlite3.h" */
/* #include "sqlite3_trunk.h" */
#endif

/*
Expand Down Expand Up @@ -224413,7 +224413,7 @@ SQLITE_PRIVATE void sqlite3Fts3IcuTokenizerModule(
/* #include <string.h> */
/* #include <stdio.h> */

/* #include "sqlite3.h" */
/* #include "sqlite3_trunk.h" */

#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU)
/************** Include sqlite3rbu.h in the middle of sqlite3rbu.c ***********/
Expand Down Expand Up @@ -224687,7 +224687,7 @@ SQLITE_PRIVATE void sqlite3Fts3IcuTokenizerModule(
#ifndef _SQLITE3RBU_H
#define _SQLITE3RBU_H

/* #include "sqlite3.h" ** Required for error code definitions ** */
/* #include "sqlite3_trunk.h" ** Required for error code definitions ** */

#if 0
extern "C" {
Expand Down Expand Up @@ -239242,7 +239242,7 @@ SQLITE_API int sqlite3session_config(int op, void *pArg){
#ifndef _FTS5_H
#define _FTS5_H

/* #include "sqlite3.h" */
/* #include "sqlite3_trunk.h" */

#if 0
extern "C" {
Expand Down
Loading
Loading