SQLite 3. Any update since 1.05 release 3 years ago?

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
wallyg
Posts: 88
Joined: May 08, 2009 7:08
Location: Tucson Arizona

SQLite 3. Any update since 1.05 release 3 years ago?

Postby wallyg » Dec 13, 2018 21:49

I wanted to use SQLite 3 in a new project and checked out the documentation on its website. The documentation is for the current version 3.26. The Freebasic 1.05 version of SQLite3.bi file is for 3.8.11.1. Did not find documentation for version 3.8.

Since this is a new project, I wondered if there was a more up to date FreeBasic set of files for SQLite, so that I could take advantage of the bug fixes in the current version and the new features of the current version?

Thanks in advance for any help.

Wally
srvaldez
Posts: 2109
Joined: Sep 25, 2005 21:54

Re: SQLite 3. Any update since 1.05 release 3 years ago?

Postby srvaldez » Dec 14, 2018 0:17

hello wallyg
you can use a C header translation tool called fbfrog
to build fbfrog, get fbfrog from https://github.com/dkl/fbfrog, extract the archive
from command prompt cd into the fbfrog-master folder, then
fbc -w all -gen gcc -Wc -O2 src/*.bas -m fbfrog
after you have built fbfrog you are ready to translate

what I always do, launch the command prompt and cd into the folder where fbfrog.exe resides, it's so that fbfrog will find it's headers
then type: fbfrog a space then click-and-drag the C header onto the command window, press return
fbfrog does quite well with the sqlite header, to build the binaries you need the gcc toolchain.
wallyg
Posts: 88
Joined: May 08, 2009 7:08
Location: Tucson Arizona

Re: SQLite 3. Any update since 1.05 release 3 years ago?

Postby wallyg » Dec 14, 2018 0:22

Thank you for the information.

The SQLite website has a set of window binaries, could they be used with the *.bi file produced by fbfrog?

Wally
srvaldez
Posts: 2109
Joined: Sep 25, 2005 21:54

Re: SQLite 3. Any update since 1.05 release 3 years ago?

Postby srvaldez » Dec 14, 2018 0:30

I just downloaded the binaries (DLL's), they should work ok with FB, but you may want to make an import lib of the dll
the def file is already there, so from the command prompt do: dlltool -d sqlite3.def -l libsqlite3.dll.a
if you don't have the tools on your PC, I can do that for you
srvaldez
Posts: 2109
Joined: Sep 25, 2005 21:54

Re: SQLite 3. Any update since 1.05 release 3 years ago?

Postby srvaldez » Dec 14, 2018 1:51

here is the sqlite3.bi and sqlite3ext.bi translated with fbfrog
perhaps someone with more experience will have a look at the translated headers and check for correctness
forum limits the post to 60000 characters so you will have to append part 1 and part 2
sqlite3.bi part1

Code: Select all

'' FreeBASIC binding for SQLite 3.26.0
''
'' based on the C header files:
''   * 2018 December 1
''   *
''   * The author disclaims copyright to this source code.  In place of
''   * a legal notice, here is a blessing:
''   *
''   *    May you do good and not evil.
''   *    May you find forgiveness for yourself and forgive others.
''   *    May you share freely, never taking more than you give.
''   *
''   ************************************************************************
''   * This header file defines the interface that the SQLite library
''   * presents to client programs.  If a C-function, structure, datatype,
''   * or constant definition does not appear in this file, then it is
''   * not a published API of SQLite, is subject to change without
''   * notice, and should not be referenced by programs that use SQLite.
''   *
''   * Some of the definitions that are in this file are marked as
''   * "experimental".  Experimental interfaces are normally new
''   * features recently added to SQLite.  We do not anticipate changes
''   * to experimental interfaces but reserve the right to make minor changes
''   * if experience from use "in the wild" suggest such changes are prudent.
''   *
''   * The official C-language API documentation for SQLite is derived
''   * from comments in this file.  This file is the authoritative source
''   * on how SQLite interfaces are supposed to operate.
''   *
''   * The name of this file under configuration management is "sqlite.h.in".
''   * The makefile makes some minor changes to this file (such as inserting
''   * the version number) and changes its name to "sqlite3.h" as
''   * part of the build process.
''
'' translated to FreeBASIC by:
''   Copyright © 2018 FreeBASIC development team

#pragma once

#inclib "sqlite3"

#include once "crt/long.bi"
#include once "crt/stdarg.bi"

extern "C"

#define _SQLITE3_H_
'' TODO: # define SQLITE_EXTERN extern
#define SQLITE_API
#define SQLITE_CDECL
#define SQLITE_APICALL
#define SQLITE_STDCALL SQLITE_APICALL
#define SQLITE_CALLBACK
#define SQLITE_SYSAPI
#define SQLITE_DEPRECATED
#define SQLITE_EXPERIMENTAL
#define SQLITE_VERSION "3.26.0"
const SQLITE_VERSION_NUMBER = 3026000
#define SQLITE_SOURCE_ID "2018-12-01 12:34:55 bf8c1b2b7a5960c282e543b9c293686dccff272512d08865f4600fb58238b4f9"
extern __sqlite3_version alias "sqlite3_version" as const byte
#define sqlite3_version (*cptr(const zstring ptr, @__sqlite3_version))

declare function sqlite3_libversion() as const zstring ptr
declare function sqlite3_sourceid() as const zstring ptr
declare function sqlite3_libversion_number() as long
declare function sqlite3_compileoption_used(byval zOptName as const zstring ptr) as long
declare function sqlite3_compileoption_get(byval N as long) as const zstring ptr
declare function sqlite3_threadsafe() as long

type sqlite_int64 as longint
type sqlite_uint64 as ulongint
type sqlite3_int64 as sqlite_int64
type sqlite3_uint64 as sqlite_uint64
type sqlite3 as sqlite3_
declare function sqlite3_close(byval as sqlite3 ptr) as long
declare function sqlite3_close_v2(byval as sqlite3 ptr) as long
type sqlite3_callback as function(byval as any ptr, byval as long, byval as zstring ptr ptr, byval as zstring ptr ptr) as long
declare function sqlite3_exec(byval as sqlite3 ptr, byval sql as const zstring ptr, byval callback as function(byval as any ptr, byval as long, byval as zstring ptr ptr, byval as zstring ptr ptr) as long, byval as any ptr, byval errmsg as zstring ptr ptr) as long

const SQLITE_OK = 0
const SQLITE_ERROR = 1
const SQLITE_INTERNAL = 2
const SQLITE_PERM = 3
const SQLITE_ABORT = 4
const SQLITE_BUSY = 5
const SQLITE_LOCKED = 6
const SQLITE_NOMEM = 7
const SQLITE_READONLY = 8
const SQLITE_INTERRUPT = 9
const SQLITE_IOERR = 10
const SQLITE_CORRUPT = 11
const SQLITE_NOTFOUND = 12
const SQLITE_FULL = 13
const SQLITE_CANTOPEN = 14
const SQLITE_PROTOCOL = 15
const SQLITE_EMPTY = 16
const SQLITE_SCHEMA = 17
const SQLITE_TOOBIG = 18
const SQLITE_CONSTRAINT = 19
const SQLITE_MISMATCH = 20
const SQLITE_MISUSE = 21
const SQLITE_NOLFS = 22
const SQLITE_AUTH = 23
const SQLITE_FORMAT = 24
const SQLITE_RANGE = 25
const SQLITE_NOTADB = 26
const SQLITE_NOTICE = 27
const SQLITE_WARNING = 28
const SQLITE_ROW = 100
const SQLITE_DONE = 101
const SQLITE_ERROR_MISSING_COLLSEQ = SQLITE_ERROR or (1 shl 8)
const SQLITE_ERROR_RETRY = SQLITE_ERROR or (2 shl 8)
const SQLITE_ERROR_SNAPSHOT = SQLITE_ERROR or (3 shl 8)
const SQLITE_IOERR_READ = SQLITE_IOERR or (1 shl 8)
const SQLITE_IOERR_SHORT_READ = SQLITE_IOERR or (2 shl 8)
const SQLITE_IOERR_WRITE = SQLITE_IOERR or (3 shl 8)
const SQLITE_IOERR_FSYNC = SQLITE_IOERR or (4 shl 8)
const SQLITE_IOERR_DIR_FSYNC = SQLITE_IOERR or (5 shl 8)
const SQLITE_IOERR_TRUNCATE = SQLITE_IOERR or (6 shl 8)
const SQLITE_IOERR_FSTAT = SQLITE_IOERR or (7 shl 8)
const SQLITE_IOERR_UNLOCK = SQLITE_IOERR or (8 shl 8)
const SQLITE_IOERR_RDLOCK = SQLITE_IOERR or (9 shl 8)
const SQLITE_IOERR_DELETE = SQLITE_IOERR or (10 shl 8)
const SQLITE_IOERR_BLOCKED = SQLITE_IOERR or (11 shl 8)
const SQLITE_IOERR_NOMEM = SQLITE_IOERR or (12 shl 8)
const SQLITE_IOERR_ACCESS = SQLITE_IOERR or (13 shl 8)
const SQLITE_IOERR_CHECKRESERVEDLOCK = SQLITE_IOERR or (14 shl 8)
const SQLITE_IOERR_LOCK = SQLITE_IOERR or (15 shl 8)
const SQLITE_IOERR_CLOSE = SQLITE_IOERR or (16 shl 8)
const SQLITE_IOERR_DIR_CLOSE = SQLITE_IOERR or (17 shl 8)
const SQLITE_IOERR_SHMOPEN = SQLITE_IOERR or (18 shl 8)
const SQLITE_IOERR_SHMSIZE = SQLITE_IOERR or (19 shl 8)
const SQLITE_IOERR_SHMLOCK = SQLITE_IOERR or (20 shl 8)
const SQLITE_IOERR_SHMMAP = SQLITE_IOERR or (21 shl 8)
const SQLITE_IOERR_SEEK = SQLITE_IOERR or (22 shl 8)
const SQLITE_IOERR_DELETE_NOENT = SQLITE_IOERR or (23 shl 8)
const SQLITE_IOERR_MMAP = SQLITE_IOERR or (24 shl 8)
const SQLITE_IOERR_GETTEMPPATH = SQLITE_IOERR or (25 shl 8)
const SQLITE_IOERR_CONVPATH = SQLITE_IOERR or (26 shl 8)
const SQLITE_IOERR_VNODE = SQLITE_IOERR or (27 shl 8)
const SQLITE_IOERR_AUTH = SQLITE_IOERR or (28 shl 8)
const SQLITE_IOERR_BEGIN_ATOMIC = SQLITE_IOERR or (29 shl 8)
const SQLITE_IOERR_COMMIT_ATOMIC = SQLITE_IOERR or (30 shl 8)
const SQLITE_IOERR_ROLLBACK_ATOMIC = SQLITE_IOERR or (31 shl 8)
const SQLITE_LOCKED_SHAREDCACHE = SQLITE_LOCKED or (1 shl 8)
const SQLITE_LOCKED_VTAB = SQLITE_LOCKED or (2 shl 8)
const SQLITE_BUSY_RECOVERY = SQLITE_BUSY or (1 shl 8)
const SQLITE_BUSY_SNAPSHOT = SQLITE_BUSY or (2 shl 8)
const SQLITE_CANTOPEN_NOTEMPDIR = SQLITE_CANTOPEN or (1 shl 8)
const SQLITE_CANTOPEN_ISDIR = SQLITE_CANTOPEN or (2 shl 8)
const SQLITE_CANTOPEN_FULLPATH = SQLITE_CANTOPEN or (3 shl 8)
const SQLITE_CANTOPEN_CONVPATH = SQLITE_CANTOPEN or (4 shl 8)
const SQLITE_CANTOPEN_DIRTYWAL = SQLITE_CANTOPEN or (5 shl 8)
const SQLITE_CORRUPT_VTAB = SQLITE_CORRUPT or (1 shl 8)
const SQLITE_CORRUPT_SEQUENCE = SQLITE_CORRUPT or (2 shl 8)
const SQLITE_READONLY_RECOVERY = SQLITE_READONLY or (1 shl 8)
const SQLITE_READONLY_CANTLOCK = SQLITE_READONLY or (2 shl 8)
const SQLITE_READONLY_ROLLBACK = SQLITE_READONLY or (3 shl 8)
const SQLITE_READONLY_DBMOVED = SQLITE_READONLY or (4 shl 8)
const SQLITE_READONLY_CANTINIT = SQLITE_READONLY or (5 shl 8)
const SQLITE_READONLY_DIRECTORY = SQLITE_READONLY or (6 shl 8)
const SQLITE_ABORT_ROLLBACK = SQLITE_ABORT or (2 shl 8)
const SQLITE_CONSTRAINT_CHECK = SQLITE_CONSTRAINT or (1 shl 8)
const SQLITE_CONSTRAINT_COMMITHOOK = SQLITE_CONSTRAINT or (2 shl 8)
const SQLITE_CONSTRAINT_FOREIGNKEY = SQLITE_CONSTRAINT or (3 shl 8)
const SQLITE_CONSTRAINT_FUNCTION = SQLITE_CONSTRAINT or (4 shl 8)
const SQLITE_CONSTRAINT_NOTNULL = SQLITE_CONSTRAINT or (5 shl 8)
const SQLITE_CONSTRAINT_PRIMARYKEY = SQLITE_CONSTRAINT or (6 shl 8)
const SQLITE_CONSTRAINT_TRIGGER = SQLITE_CONSTRAINT or (7 shl 8)
const SQLITE_CONSTRAINT_UNIQUE = SQLITE_CONSTRAINT or (8 shl 8)
const SQLITE_CONSTRAINT_VTAB = SQLITE_CONSTRAINT or (9 shl 8)
const SQLITE_CONSTRAINT_ROWID = SQLITE_CONSTRAINT or (10 shl 8)
const SQLITE_NOTICE_RECOVER_WAL = SQLITE_NOTICE or (1 shl 8)
const SQLITE_NOTICE_RECOVER_ROLLBACK = SQLITE_NOTICE or (2 shl 8)
const SQLITE_WARNING_AUTOINDEX = SQLITE_WARNING or (1 shl 8)
const SQLITE_AUTH_USER = SQLITE_AUTH or (1 shl 8)
const SQLITE_OK_LOAD_PERMANENTLY = SQLITE_OK or (1 shl 8)
const SQLITE_OPEN_READONLY = &h00000001
const SQLITE_OPEN_READWRITE = &h00000002
const SQLITE_OPEN_CREATE = &h00000004
const SQLITE_OPEN_DELETEONCLOSE = &h00000008
const SQLITE_OPEN_EXCLUSIVE = &h00000010
const SQLITE_OPEN_AUTOPROXY = &h00000020
const SQLITE_OPEN_URI = &h00000040
const SQLITE_OPEN_MEMORY = &h00000080
const SQLITE_OPEN_MAIN_DB = &h00000100
const SQLITE_OPEN_TEMP_DB = &h00000200
const SQLITE_OPEN_TRANSIENT_DB = &h00000400
const SQLITE_OPEN_MAIN_JOURNAL = &h00000800
const SQLITE_OPEN_TEMP_JOURNAL = &h00001000
const SQLITE_OPEN_SUBJOURNAL = &h00002000
const SQLITE_OPEN_MASTER_JOURNAL = &h00004000
const SQLITE_OPEN_NOMUTEX = &h00008000
const SQLITE_OPEN_FULLMUTEX = &h00010000
const SQLITE_OPEN_SHAREDCACHE = &h00020000
const SQLITE_OPEN_PRIVATECACHE = &h00040000
const SQLITE_OPEN_WAL = &h00080000
const SQLITE_IOCAP_ATOMIC = &h00000001
const SQLITE_IOCAP_ATOMIC512 = &h00000002
const SQLITE_IOCAP_ATOMIC1K = &h00000004
const SQLITE_IOCAP_ATOMIC2K = &h00000008
const SQLITE_IOCAP_ATOMIC4K = &h00000010
const SQLITE_IOCAP_ATOMIC8K = &h00000020
const SQLITE_IOCAP_ATOMIC16K = &h00000040
const SQLITE_IOCAP_ATOMIC32K = &h00000080
const SQLITE_IOCAP_ATOMIC64K = &h00000100
const SQLITE_IOCAP_SAFE_APPEND = &h00000200
const SQLITE_IOCAP_SEQUENTIAL = &h00000400
const SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN = &h00000800
const SQLITE_IOCAP_POWERSAFE_OVERWRITE = &h00001000
const SQLITE_IOCAP_IMMUTABLE = &h00002000
const SQLITE_IOCAP_BATCH_ATOMIC = &h00004000
const SQLITE_LOCK_NONE = 0
const SQLITE_LOCK_SHARED = 1
const SQLITE_LOCK_RESERVED = 2
const SQLITE_LOCK_PENDING = 3
const SQLITE_LOCK_EXCLUSIVE = 4
const SQLITE_SYNC_NORMAL = &h00002
const SQLITE_SYNC_FULL = &h00003
const SQLITE_SYNC_DATAONLY = &h00010
type sqlite3_io_methods as sqlite3_io_methods_

Last edited by srvaldez on Dec 14, 2018 5:43, edited 6 times in total.
srvaldez
Posts: 2109
Joined: Sep 25, 2005 21:54

Re: SQLite 3. Any update since 1.05 release 3 years ago?

Postby srvaldez » Dec 14, 2018 1:54

sqlite3.bi part2

Code: Select all


type sqlite3_file
   pMethods as const sqlite3_io_methods ptr
end type

type sqlite3_io_methods_
   iVersion as long
   xClose as function(byval as sqlite3_file ptr) as long
   xRead as function(byval as sqlite3_file ptr, byval as any ptr, byval iAmt as long, byval iOfst as sqlite3_int64) as long
   xWrite as function(byval as sqlite3_file ptr, byval as const any ptr, byval iAmt as long, byval iOfst as sqlite3_int64) as long
   xTruncate as function(byval as sqlite3_file ptr, byval size as sqlite3_int64) as long
   xSync as function(byval as sqlite3_file ptr, byval flags as long) as long
   xFileSize as function(byval as sqlite3_file ptr, byval pSize as sqlite3_int64 ptr) as long
   xLock as function(byval as sqlite3_file ptr, byval as long) as long
   xUnlock as function(byval as sqlite3_file ptr, byval as long) as long
   xCheckReservedLock as function(byval as sqlite3_file ptr, byval pResOut as long ptr) as long
   xFileControl as function(byval as sqlite3_file ptr, byval op as long, byval pArg as any ptr) as long
   xSectorSize as function(byval as sqlite3_file ptr) as long
   xDeviceCharacteristics as function(byval as sqlite3_file ptr) as long
   xShmMap as function(byval as sqlite3_file ptr, byval iPg as long, byval pgsz as long, byval as long, byval as any ptr ptr) as long
   xShmLock as function(byval as sqlite3_file ptr, byval offset as long, byval n as long, byval flags as long) as long
   xShmBarrier as sub(byval as sqlite3_file ptr)
   xShmUnmap as function(byval as sqlite3_file ptr, byval deleteFlag as long) as long
   xFetch as function(byval as sqlite3_file ptr, byval iOfst as sqlite3_int64, byval iAmt as long, byval pp as any ptr ptr) as long
   xUnfetch as function(byval as sqlite3_file ptr, byval iOfst as sqlite3_int64, byval p as any ptr) as long
end type

const SQLITE_FCNTL_LOCKSTATE = 1
const SQLITE_FCNTL_GET_LOCKPROXYFILE = 2
const SQLITE_FCNTL_SET_LOCKPROXYFILE = 3
const SQLITE_FCNTL_LAST_ERRNO = 4
const SQLITE_FCNTL_SIZE_HINT = 5
const SQLITE_FCNTL_CHUNK_SIZE = 6
const SQLITE_FCNTL_FILE_POINTER = 7
const SQLITE_FCNTL_SYNC_OMITTED = 8
const SQLITE_FCNTL_WIN32_AV_RETRY = 9
const SQLITE_FCNTL_PERSIST_WAL = 10
const SQLITE_FCNTL_OVERWRITE = 11
const SQLITE_FCNTL_VFSNAME = 12
const SQLITE_FCNTL_POWERSAFE_OVERWRITE = 13
const SQLITE_FCNTL_PRAGMA = 14
const SQLITE_FCNTL_BUSYHANDLER = 15
const SQLITE_FCNTL_TEMPFILENAME = 16
const SQLITE_FCNTL_MMAP_SIZE = 18
const SQLITE_FCNTL_TRACE = 19
const SQLITE_FCNTL_HAS_MOVED = 20
const SQLITE_FCNTL_SYNC = 21
const SQLITE_FCNTL_COMMIT_PHASETWO = 22
const SQLITE_FCNTL_WIN32_SET_HANDLE = 23
const SQLITE_FCNTL_WAL_BLOCK = 24
const SQLITE_FCNTL_ZIPVFS = 25
const SQLITE_FCNTL_RBU = 26
const SQLITE_FCNTL_VFS_POINTER = 27
const SQLITE_FCNTL_JOURNAL_POINTER = 28
const SQLITE_FCNTL_WIN32_GET_HANDLE = 29
const SQLITE_FCNTL_PDB = 30
const SQLITE_FCNTL_BEGIN_ATOMIC_WRITE = 31
const SQLITE_FCNTL_COMMIT_ATOMIC_WRITE = 32
const SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE = 33
const SQLITE_FCNTL_LOCK_TIMEOUT = 34
const SQLITE_FCNTL_DATA_VERSION = 35
const SQLITE_GET_LOCKPROXYFILE = SQLITE_FCNTL_GET_LOCKPROXYFILE
const SQLITE_SET_LOCKPROXYFILE = SQLITE_FCNTL_SET_LOCKPROXYFILE
const SQLITE_LAST_ERRNO = SQLITE_FCNTL_LAST_ERRNO
type sqlite3_syscall_ptr as sub()

type sqlite3_vfs
   iVersion as long
   szOsFile as long
   mxPathname as long
   pNext as sqlite3_vfs ptr
   zName as const zstring ptr
   pAppData as any ptr
   xOpen as function(byval as sqlite3_vfs ptr, byval zName as const zstring ptr, byval as sqlite3_file ptr, byval flags as long, byval pOutFlags as long ptr) as long
   xDelete as function(byval as sqlite3_vfs ptr, byval zName as const zstring ptr, byval syncDir as long) as long
   xAccess as function(byval as sqlite3_vfs ptr, byval zName as const zstring ptr, byval flags as long, byval pResOut as long ptr) as long
   xFullPathname as function(byval as sqlite3_vfs ptr, byval zName as const zstring ptr, byval nOut as long, byval zOut as zstring ptr) as long
   xDlOpen as function(byval as sqlite3_vfs ptr, byval zFilename as const zstring ptr) as any ptr
   xDlError as sub(byval as sqlite3_vfs ptr, byval nByte as long, byval zErrMsg as zstring ptr)
   xDlSym as function(byval as sqlite3_vfs ptr, byval as any ptr, byval zSymbol as const zstring ptr) as sub()
   xDlClose as sub(byval as sqlite3_vfs ptr, byval as any ptr)
   xRandomness as function(byval as sqlite3_vfs ptr, byval nByte as long, byval zOut as zstring ptr) as long
   xSleep as function(byval as sqlite3_vfs ptr, byval microseconds as long) as long
   xCurrentTime as function(byval as sqlite3_vfs ptr, byval as double ptr) as long
   xGetLastError as function(byval as sqlite3_vfs ptr, byval as long, byval as zstring ptr) as long
   xCurrentTimeInt64 as function(byval as sqlite3_vfs ptr, byval as sqlite3_int64 ptr) as long
   xSetSystemCall as function(byval as sqlite3_vfs ptr, byval zName as const zstring ptr, byval as sqlite3_syscall_ptr) as long
   xGetSystemCall as function(byval as sqlite3_vfs ptr, byval zName as const zstring ptr) as sqlite3_syscall_ptr
   xNextSystemCall as function(byval as sqlite3_vfs ptr, byval zName as const zstring ptr) as const zstring ptr
end type

const SQLITE_ACCESS_EXISTS = 0
const SQLITE_ACCESS_READWRITE = 1
const SQLITE_ACCESS_READ = 2
const SQLITE_SHM_UNLOCK = 1
const SQLITE_SHM_LOCK = 2
const SQLITE_SHM_SHARED = 4
const SQLITE_SHM_EXCLUSIVE = 8
const SQLITE_SHM_NLOCK = 8

declare function sqlite3_initialize() as long
declare function sqlite3_shutdown() as long
declare function sqlite3_os_init() as long
declare function sqlite3_os_end() as long
declare function sqlite3_config(byval as long, ...) as long
declare function sqlite3_db_config(byval as sqlite3 ptr, byval op as long, ...) as long

type sqlite3_mem_methods
   xMalloc as function(byval as long) as any ptr
   xFree as sub(byval as any ptr)
   xRealloc as function(byval as any ptr, byval as long) as any ptr
   xSize as function(byval as any ptr) as long
   xRoundup as function(byval as long) as long
   xInit as function(byval as any ptr) as long
   xShutdown as sub(byval as any ptr)
   pAppData as any ptr
end type

const SQLITE_CONFIG_SINGLETHREAD = 1
const SQLITE_CONFIG_MULTITHREAD = 2
const SQLITE_CONFIG_SERIALIZED = 3
const SQLITE_CONFIG_MALLOC = 4
const SQLITE_CONFIG_GETMALLOC = 5
const SQLITE_CONFIG_SCRATCH = 6
const SQLITE_CONFIG_PAGECACHE = 7
const SQLITE_CONFIG_HEAP = 8
const SQLITE_CONFIG_MEMSTATUS = 9
const SQLITE_CONFIG_MUTEX = 10
const SQLITE_CONFIG_GETMUTEX = 11
const SQLITE_CONFIG_LOOKASIDE = 13
const SQLITE_CONFIG_PCACHE = 14
const SQLITE_CONFIG_GETPCACHE = 15
const SQLITE_CONFIG_LOG = 16
const SQLITE_CONFIG_URI = 17
const SQLITE_CONFIG_PCACHE2 = 18
const SQLITE_CONFIG_GETPCACHE2 = 19
const SQLITE_CONFIG_COVERING_INDEX_SCAN = 20
const SQLITE_CONFIG_SQLLOG = 21
const SQLITE_CONFIG_MMAP_SIZE = 22
const SQLITE_CONFIG_WIN32_HEAPSIZE = 23
const SQLITE_CONFIG_PCACHE_HDRSZ = 24
const SQLITE_CONFIG_PMASZ = 25
const SQLITE_CONFIG_STMTJRNL_SPILL = 26
const SQLITE_CONFIG_SMALL_MALLOC = 27
const SQLITE_CONFIG_SORTERREF_SIZE = 28
const SQLITE_DBCONFIG_MAINDBNAME = 1000
const SQLITE_DBCONFIG_LOOKASIDE = 1001
const SQLITE_DBCONFIG_ENABLE_FKEY = 1002
const SQLITE_DBCONFIG_ENABLE_TRIGGER = 1003
const SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER = 1004
const SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION = 1005
const SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE = 1006
const SQLITE_DBCONFIG_ENABLE_QPSG = 1007
const SQLITE_DBCONFIG_TRIGGER_EQP = 1008
const SQLITE_DBCONFIG_RESET_DATABASE = 1009
const SQLITE_DBCONFIG_DEFENSIVE = 1010
const SQLITE_DBCONFIG_MAX = 1010

declare function sqlite3_extended_result_codes(byval as sqlite3 ptr, byval onoff as long) as long
declare function sqlite3_last_insert_rowid(byval as sqlite3 ptr) as sqlite3_int64
declare sub sqlite3_set_last_insert_rowid(byval as sqlite3 ptr, byval as sqlite3_int64)
declare function sqlite3_changes(byval as sqlite3 ptr) as long
declare function sqlite3_total_changes(byval as sqlite3 ptr) as long
declare sub sqlite3_interrupt(byval as sqlite3 ptr)
declare function sqlite3_complete(byval sql as const zstring ptr) as long
declare function sqlite3_complete16(byval sql as const any ptr) as long
declare function sqlite3_busy_handler(byval as sqlite3 ptr, byval as function(byval as any ptr, byval as long) as long, byval as any ptr) as long
declare function sqlite3_busy_timeout(byval as sqlite3 ptr, byval ms as long) as long
declare function sqlite3_get_table(byval db as sqlite3 ptr, byval zSql as const zstring ptr, byval pazResult as zstring ptr ptr ptr, byval pnRow as long ptr, byval pnColumn as long ptr, byval pzErrmsg as zstring ptr ptr) as long
declare sub sqlite3_free_table(byval result as zstring ptr ptr)
declare function sqlite3_mprintf(byval as const zstring ptr, ...) as zstring ptr
declare function sqlite3_vmprintf(byval as const zstring ptr, byval as va_list) as zstring ptr
declare function sqlite3_snprintf(byval as long, byval as zstring ptr, byval as const zstring ptr, ...) as zstring ptr
declare function sqlite3_vsnprintf(byval as long, byval as zstring ptr, byval as const zstring ptr, byval as va_list) as zstring ptr
declare function sqlite3_malloc(byval as long) as any ptr
declare function sqlite3_malloc64(byval as sqlite3_uint64) as any ptr
declare function sqlite3_realloc(byval as any ptr, byval as long) as any ptr
declare function sqlite3_realloc64(byval as any ptr, byval as sqlite3_uint64) as any ptr
declare sub sqlite3_free(byval as any ptr)
declare function sqlite3_msize(byval as any ptr) as sqlite3_uint64
declare function sqlite3_memory_used() as sqlite3_int64
declare function sqlite3_memory_highwater(byval resetFlag as long) as sqlite3_int64
declare sub sqlite3_randomness(byval N as long, byval P as any ptr)
declare function sqlite3_set_authorizer(byval as sqlite3 ptr, byval xAuth as function(byval as any ptr, byval as long, byval as const zstring ptr, byval as const zstring ptr, byval as const zstring ptr, byval as const zstring ptr) as long, byval pUserData as any ptr) as long

const SQLITE_DENY = 1
const SQLITE_IGNORE = 2
const SQLITE_CREATE_INDEX = 1
const SQLITE_CREATE_TABLE = 2
const SQLITE_CREATE_TEMP_INDEX = 3
const SQLITE_CREATE_TEMP_TABLE = 4
const SQLITE_CREATE_TEMP_TRIGGER = 5
const SQLITE_CREATE_TEMP_VIEW = 6
const SQLITE_CREATE_TRIGGER = 7
const SQLITE_CREATE_VIEW = 8
const SQLITE_DELETE = 9
const SQLITE_DROP_INDEX = 10
const SQLITE_DROP_TABLE = 11
const SQLITE_DROP_TEMP_INDEX = 12
const SQLITE_DROP_TEMP_TABLE = 13
const SQLITE_DROP_TEMP_TRIGGER = 14
const SQLITE_DROP_TEMP_VIEW = 15
const SQLITE_DROP_TRIGGER = 16
const SQLITE_DROP_VIEW = 17
const SQLITE_INSERT = 18
const SQLITE_PRAGMA = 19
const SQLITE_READ = 20
const SQLITE_SELECT = 21
const SQLITE_TRANSACTION = 22
const SQLITE_UPDATE = 23
const SQLITE_ATTACH = 24
const SQLITE_DETACH = 25
const SQLITE_ALTER_TABLE = 26
const SQLITE_REINDEX = 27
const SQLITE_ANALYZE = 28
const SQLITE_CREATE_VTABLE = 29
const SQLITE_DROP_VTABLE = 30
const SQLITE_FUNCTION = 31
const SQLITE_SAVEPOINT = 32
const SQLITE_COPY = 0
const SQLITE_RECURSIVE = 33
declare function sqlite3_trace(byval as sqlite3 ptr, byval xTrace as sub(byval as any ptr, byval as const zstring ptr), byval as any ptr) as any ptr
declare function sqlite3_profile(byval as sqlite3 ptr, byval xProfile as sub(byval as any ptr, byval as const zstring ptr, byval as sqlite3_uint64), byval as any ptr) as any ptr
const SQLITE_TRACE_STMT = &h01
const SQLITE_TRACE_PROFILE = &h02
const SQLITE_TRACE_ROW = &h04
const SQLITE_TRACE_CLOSE = &h08

declare function sqlite3_trace_v2(byval as sqlite3 ptr, byval uMask as ulong, byval xCallback as function(byval as ulong, byval as any ptr, byval as any ptr, byval as any ptr) as long, byval pCtx as any ptr) as long
declare sub sqlite3_progress_handler(byval as sqlite3 ptr, byval as long, byval as function(byval as any ptr) as long, byval as any ptr)
declare function sqlite3_open(byval filename as const zstring ptr, byval ppDb as sqlite3 ptr ptr) as long
declare function sqlite3_open16(byval filename as const any ptr, byval ppDb as sqlite3 ptr ptr) as long
declare function sqlite3_open_v2(byval filename as const zstring ptr, byval ppDb as sqlite3 ptr ptr, byval flags as long, byval zVfs as const zstring ptr) as long
declare function sqlite3_uri_parameter(byval zFilename as const zstring ptr, byval zParam as const zstring ptr) as const zstring ptr
declare function sqlite3_uri_boolean(byval zFile as const zstring ptr, byval zParam as const zstring ptr, byval bDefault as long) as long
declare function sqlite3_uri_int64(byval as const zstring ptr, byval as const zstring ptr, byval as sqlite3_int64) as sqlite3_int64
declare function sqlite3_errcode(byval db as sqlite3 ptr) as long
declare function sqlite3_extended_errcode(byval db as sqlite3 ptr) as long
declare function sqlite3_errmsg(byval as sqlite3 ptr) as const zstring ptr
declare function sqlite3_errmsg16(byval as sqlite3 ptr) as const any ptr
declare function sqlite3_errstr(byval as long) as const zstring ptr
declare function sqlite3_limit(byval as sqlite3 ptr, byval id as long, byval newVal as long) as long

const SQLITE_LIMIT_LENGTH = 0
const SQLITE_LIMIT_SQL_LENGTH = 1
const SQLITE_LIMIT_COLUMN = 2
const SQLITE_LIMIT_EXPR_DEPTH = 3
const SQLITE_LIMIT_COMPOUND_SELECT = 4
const SQLITE_LIMIT_VDBE_OP = 5
const SQLITE_LIMIT_FUNCTION_ARG = 6
const SQLITE_LIMIT_ATTACHED = 7
const SQLITE_LIMIT_LIKE_PATTERN_LENGTH = 8
const SQLITE_LIMIT_VARIABLE_NUMBER = 9
const SQLITE_LIMIT_TRIGGER_DEPTH = 10
const SQLITE_LIMIT_WORKER_THREADS = 11
const SQLITE_PREPARE_PERSISTENT = &h01
const SQLITE_PREPARE_NORMALIZE = &h02
type sqlite3_stmt as sqlite3_stmt_

declare function sqlite3_prepare(byval db as sqlite3 ptr, byval zSql as const zstring ptr, byval nByte as long, byval ppStmt as sqlite3_stmt ptr ptr, byval pzTail as const zstring ptr ptr) as long
declare function sqlite3_prepare_v2(byval db as sqlite3 ptr, byval zSql as const zstring ptr, byval nByte as long, byval ppStmt as sqlite3_stmt ptr ptr, byval pzTail as const zstring ptr ptr) as long
declare function sqlite3_prepare_v3(byval db as sqlite3 ptr, byval zSql as const zstring ptr, byval nByte as long, byval prepFlags as ulong, byval ppStmt as sqlite3_stmt ptr ptr, byval pzTail as const zstring ptr ptr) as long
declare function sqlite3_prepare16(byval db as sqlite3 ptr, byval zSql as const any ptr, byval nByte as long, byval ppStmt as sqlite3_stmt ptr ptr, byval pzTail as const any ptr ptr) as long
declare function sqlite3_prepare16_v2(byval db as sqlite3 ptr, byval zSql as const any ptr, byval nByte as long, byval ppStmt as sqlite3_stmt ptr ptr, byval pzTail as const any ptr ptr) as long
declare function sqlite3_prepare16_v3(byval db as sqlite3 ptr, byval zSql as const any ptr, byval nByte as long, byval prepFlags as ulong, byval ppStmt as sqlite3_stmt ptr ptr, byval pzTail as const any ptr ptr) as long
declare function sqlite3_sql(byval pStmt as sqlite3_stmt ptr) as const zstring ptr
declare function sqlite3_expanded_sql(byval pStmt as sqlite3_stmt ptr) as zstring ptr
declare function sqlite3_normalized_sql(byval pStmt as sqlite3_stmt ptr) as const zstring ptr
declare function sqlite3_stmt_readonly(byval pStmt as sqlite3_stmt ptr) as long
declare function sqlite3_stmt_busy(byval as sqlite3_stmt ptr) as long
type sqlite3_value as Mem
declare function sqlite3_bind_blob(byval as sqlite3_stmt ptr, byval as long, byval as const any ptr, byval n as long, byval as sub(byval as any ptr)) as long
declare function sqlite3_bind_blob64(byval as sqlite3_stmt ptr, byval as long, byval as const any ptr, byval as sqlite3_uint64, byval as sub(byval as any ptr)) as long
declare function sqlite3_bind_double(byval as sqlite3_stmt ptr, byval as long, byval as double) as long
declare function sqlite3_bind_int(byval as sqlite3_stmt ptr, byval as long, byval as long) as long
declare function sqlite3_bind_int64(byval as sqlite3_stmt ptr, byval as long, byval as sqlite3_int64) as long
declare function sqlite3_bind_null(byval as sqlite3_stmt ptr, byval as long) as long
declare function sqlite3_bind_text(byval as sqlite3_stmt ptr, byval as long, byval as const zstring ptr, byval as long, byval as sub(byval as any ptr)) as long
declare function sqlite3_bind_text16(byval as sqlite3_stmt ptr, byval as long, byval as const any ptr, byval as long, byval as sub(byval as any ptr)) as long
declare function sqlite3_bind_text64(byval as sqlite3_stmt ptr, byval as long, byval as const zstring ptr, byval as sqlite3_uint64, byval as sub(byval as any ptr), byval encoding as ubyte) as long
declare function sqlite3_bind_value(byval as sqlite3_stmt ptr, byval as long, byval as const sqlite3_value ptr) as long
declare function sqlite3_bind_pointer(byval as sqlite3_stmt ptr, byval as long, byval as any ptr, byval as const zstring ptr, byval as sub(byval as any ptr)) as long
declare function sqlite3_bind_zeroblob(byval as sqlite3_stmt ptr, byval as long, byval n as long) as long
declare function sqlite3_bind_zeroblob64(byval as sqlite3_stmt ptr, byval as long, byval as sqlite3_uint64) as long
declare function sqlite3_bind_parameter_count(byval as sqlite3_stmt ptr) as long
declare function sqlite3_bind_parameter_name(byval as sqlite3_stmt ptr, byval as long) as const zstring ptr
declare function sqlite3_bind_parameter_index(byval as sqlite3_stmt ptr, byval zName as const zstring ptr) as long
declare function sqlite3_clear_bindings(byval as sqlite3_stmt ptr) as long
declare function sqlite3_column_count(byval pStmt as sqlite3_stmt ptr) as long
declare function sqlite3_column_name(byval as sqlite3_stmt ptr, byval N as long) as const zstring ptr
declare function sqlite3_column_name16(byval as sqlite3_stmt ptr, byval N as long) as const any ptr
declare function sqlite3_column_database_name(byval as sqlite3_stmt ptr, byval as long) as const zstring ptr
declare function sqlite3_column_database_name16(byval as sqlite3_stmt ptr, byval as long) as const any ptr
declare function sqlite3_column_table_name(byval as sqlite3_stmt ptr, byval as long) as const zstring ptr
declare function sqlite3_column_table_name16(byval as sqlite3_stmt ptr, byval as long) as const any ptr
declare function sqlite3_column_origin_name(byval as sqlite3_stmt ptr, byval as long) as const zstring ptr
declare function sqlite3_column_origin_name16(byval as sqlite3_stmt ptr, byval as long) as const any ptr
declare function sqlite3_column_decltype(byval as sqlite3_stmt ptr, byval as long) as const zstring ptr
declare function sqlite3_column_decltype16(byval as sqlite3_stmt ptr, byval as long) as const any ptr
declare function sqlite3_step(byval as sqlite3_stmt ptr) as long
declare function sqlite3_data_count(byval pStmt as sqlite3_stmt ptr) as long

const SQLITE_INTEGER = 1
const SQLITE_FLOAT = 2
const SQLITE_BLOB = 4
const SQLITE_NULL = 5
const SQLITE_TEXT = 3
const SQLITE3_TEXT = 3

declare function sqlite3_column_blob(byval as sqlite3_stmt ptr, byval iCol as long) as const any ptr
declare function sqlite3_column_double(byval as sqlite3_stmt ptr, byval iCol as long) as double
declare function sqlite3_column_int(byval as sqlite3_stmt ptr, byval iCol as long) as long
declare function sqlite3_column_int64(byval as sqlite3_stmt ptr, byval iCol as long) as sqlite3_int64
declare function sqlite3_column_text(byval as sqlite3_stmt ptr, byval iCol as long) as const ubyte ptr
declare function sqlite3_column_text16(byval as sqlite3_stmt ptr, byval iCol as long) as const any ptr
declare function sqlite3_column_value(byval as sqlite3_stmt ptr, byval iCol as long) as sqlite3_value ptr
declare function sqlite3_column_bytes(byval as sqlite3_stmt ptr, byval iCol as long) as long
declare function sqlite3_column_bytes16(byval as sqlite3_stmt ptr, byval iCol as long) as long
declare function sqlite3_column_type(byval as sqlite3_stmt ptr, byval iCol as long) as long
declare function sqlite3_finalize(byval pStmt as sqlite3_stmt ptr) as long
declare function sqlite3_reset(byval pStmt as sqlite3_stmt ptr) as long
type sqlite3_context as sqlite3_context_
declare function sqlite3_create_function(byval db as sqlite3 ptr, byval zFunctionName as const zstring ptr, byval nArg as long, byval eTextRep as long, byval pApp as any ptr, byval xFunc as sub(byval as sqlite3_context ptr, byval as long, byval as sqlite3_value ptr ptr), byval xStep as sub(byval as sqlite3_context ptr, byval as long, byval as sqlite3_value ptr ptr), byval xFinal as sub(byval as sqlite3_context ptr)) as long
declare function sqlite3_create_function16(byval db as sqlite3 ptr, byval zFunctionName as const any ptr, byval nArg as long, byval eTextRep as long, byval pApp as any ptr, byval xFunc as sub(byval as sqlite3_context ptr, byval as long, byval as sqlite3_value ptr ptr), byval xStep as sub(byval as sqlite3_context ptr, byval as long, byval as sqlite3_value ptr ptr), byval xFinal as sub(byval as sqlite3_context ptr)) as long
declare function sqlite3_create_function_v2(byval db as sqlite3 ptr, byval zFunctionName as const zstring ptr, byval nArg as long, byval eTextRep as long, byval pApp as any ptr, byval xFunc as sub(byval as sqlite3_context ptr, byval as long, byval as sqlite3_value ptr ptr), byval xStep as sub(byval as sqlite3_context ptr, byval as long, byval as sqlite3_value ptr ptr), byval xFinal as sub(byval as sqlite3_context ptr), byval xDestroy as sub(byval as any ptr)) as long
declare function sqlite3_create_window_function(byval db as sqlite3 ptr, byval zFunctionName as const zstring ptr, byval nArg as long, byval eTextRep as long, byval pApp as any ptr, byval xStep as sub(byval as sqlite3_context ptr, byval as long, byval as sqlite3_value ptr ptr), byval xFinal as sub(byval as sqlite3_context ptr), byval xValue as sub(byval as sqlite3_context ptr), byval xInverse as sub(byval as sqlite3_context ptr, byval as long, byval as sqlite3_value ptr ptr), byval xDestroy as sub(byval as any ptr)) as long

const SQLITE_UTF8 = 1
const SQLITE_UTF16LE = 2
const SQLITE_UTF16BE = 3
const SQLITE_UTF16 = 4
const SQLITE_ANY = 5
const SQLITE_UTF16_ALIGNED = 8
const SQLITE_DETERMINISTIC = &h800

declare function sqlite3_aggregate_count(byval as sqlite3_context ptr) as long
declare function sqlite3_expired(byval as sqlite3_stmt ptr) as long
declare function sqlite3_transfer_bindings(byval as sqlite3_stmt ptr, byval as sqlite3_stmt ptr) as long
declare function sqlite3_global_recover() as long
declare sub sqlite3_thread_cleanup()
declare function sqlite3_memory_alarm(byval as sub(byval as any ptr, byval as sqlite3_int64, byval as long), byval as any ptr, byval as sqlite3_int64) as long
declare function sqlite3_value_blob(byval as sqlite3_value ptr) as const any ptr
declare function sqlite3_value_double(byval as sqlite3_value ptr) as double
declare function sqlite3_value_int(byval as sqlite3_value ptr) as long
declare function sqlite3_value_int64(byval as sqlite3_value ptr) as sqlite3_int64
declare function sqlite3_value_pointer(byval as sqlite3_value ptr, byval as const zstring ptr) as any ptr
declare function sqlite3_value_text(byval as sqlite3_value ptr) as const ubyte ptr
declare function sqlite3_value_text16(byval as sqlite3_value ptr) as const any ptr
declare function sqlite3_value_text16le(byval as sqlite3_value ptr) as const any ptr
declare function sqlite3_value_text16be(byval as sqlite3_value ptr) as const any ptr
declare function sqlite3_value_bytes(byval as sqlite3_value ptr) as long
declare function sqlite3_value_bytes16(byval as sqlite3_value ptr) as long
declare function sqlite3_value_type(byval as sqlite3_value ptr) as long
declare function sqlite3_value_numeric_type(byval as sqlite3_value ptr) as long
declare function sqlite3_value_nochange(byval as sqlite3_value ptr) as long
declare function sqlite3_value_subtype(byval as sqlite3_value ptr) as ulong
declare function sqlite3_value_dup(byval as const sqlite3_value ptr) as sqlite3_value ptr
declare sub sqlite3_value_free(byval as sqlite3_value ptr)
declare function sqlite3_aggregate_context(byval as sqlite3_context ptr, byval nBytes as long) as any ptr
declare function sqlite3_user_data(byval as sqlite3_context ptr) as any ptr
declare function sqlite3_context_db_handle(byval as sqlite3_context ptr) as sqlite3 ptr
declare function sqlite3_get_auxdata(byval as sqlite3_context ptr, byval N as long) as any ptr
declare sub sqlite3_set_auxdata(byval as sqlite3_context ptr, byval N as long, byval as any ptr, byval as sub(byval as any ptr))
type sqlite3_destructor_type as sub(byval as any ptr)
const SQLITE_STATIC = cast(sqlite3_destructor_type, 0)
const SQLITE_TRANSIENT = cast(sqlite3_destructor_type, -1)
declare sub sqlite3_result_blob(byval as sqlite3_context ptr, byval as const any ptr, byval as long, byval as sub(byval as any ptr))
declare sub sqlite3_result_blob64(byval as sqlite3_context ptr, byval as const any ptr, byval as sqlite3_uint64, byval as sub(byval as any ptr))
declare sub sqlite3_result_double(byval as sqlite3_context ptr, byval as double)
declare sub sqlite3_result_error(byval as sqlite3_context ptr, byval as const zstring ptr, byval as long)
declare sub sqlite3_result_error16(byval as sqlite3_context ptr, byval as const any ptr, byval as long)
declare sub sqlite3_result_error_toobig(byval as sqlite3_context ptr)
declare sub sqlite3_result_error_nomem(byval as sqlite3_context ptr)
declare sub sqlite3_result_error_code(byval as sqlite3_context ptr, byval as long)
declare sub sqlite3_result_int(byval as sqlite3_context ptr, byval as long)
declare sub sqlite3_result_int64(byval as sqlite3_context ptr, byval as sqlite3_int64)
declare sub sqlite3_result_null(byval as sqlite3_context ptr)
declare sub sqlite3_result_text(byval as sqlite3_context ptr, byval as const zstring ptr, byval as long, byval as sub(byval as any ptr))
declare sub sqlite3_result_text64(byval as sqlite3_context ptr, byval as const zstring ptr, byval as sqlite3_uint64, byval as sub(byval as any ptr), byval encoding as ubyte)
declare sub sqlite3_result_text16(byval as sqlite3_context ptr, byval as const any ptr, byval as long, byval as sub(byval as any ptr))
declare sub sqlite3_result_text16le(byval as sqlite3_context ptr, byval as const any ptr, byval as long, byval as sub(byval as any ptr))
declare sub sqlite3_result_text16be(byval as sqlite3_context ptr, byval as const any ptr, byval as long, byval as sub(byval as any ptr))
declare sub sqlite3_result_value(byval as sqlite3_context ptr, byval as sqlite3_value ptr)
declare sub sqlite3_result_pointer(byval as sqlite3_context ptr, byval as any ptr, byval as const zstring ptr, byval as sub(byval as any ptr))
declare sub sqlite3_result_zeroblob(byval as sqlite3_context ptr, byval n as long)
declare function sqlite3_result_zeroblob64(byval as sqlite3_context ptr, byval n as sqlite3_uint64) as long
declare sub sqlite3_result_subtype(byval as sqlite3_context ptr, byval as ulong)
declare function sqlite3_create_collation(byval as sqlite3 ptr, byval zName as const zstring ptr, byval eTextRep as long, byval pArg as any ptr, byval xCompare as function(byval as any ptr, byval as long, byval as const any ptr, byval as long, byval as const any ptr) as long) as long
declare function sqlite3_create_collation_v2(byval as sqlite3 ptr, byval zName as const zstring ptr, byval eTextRep as long, byval pArg as any ptr, byval xCompare as function(byval as any ptr, byval as long, byval as const any ptr, byval as long, byval as const any ptr) as long, byval xDestroy as sub(byval as any ptr)) as long
declare function sqlite3_create_collation16(byval as sqlite3 ptr, byval zName as const any ptr, byval eTextRep as long, byval pArg as any ptr, byval xCompare as function(byval as any ptr, byval as long, byval as const any ptr, byval as long, byval as const any ptr) as long) as long
declare function sqlite3_collation_needed(byval as sqlite3 ptr, byval as any ptr, byval as sub(byval as any ptr, byval as sqlite3 ptr, byval eTextRep as long, byval as const zstring ptr)) as long
declare function sqlite3_collation_needed16(byval as sqlite3 ptr, byval as any ptr, byval as sub(byval as any ptr, byval as sqlite3 ptr, byval eTextRep as long, byval as const any ptr)) as long
declare function sqlite3_sleep(byval as long) as long
extern sqlite3_temp_directory as zstring ptr
extern sqlite3_data_directory as zstring ptr
declare function sqlite3_win32_set_directory(byval type as culong, byval zValue as any ptr) as long
declare function sqlite3_win32_set_directory8(byval type as culong, byval zValue as const zstring ptr) as long
declare function sqlite3_win32_set_directory16(byval type as culong, byval zValue as const any ptr) as long
const SQLITE_WIN32_DATA_DIRECTORY_TYPE = 1
const SQLITE_WIN32_TEMP_DIRECTORY_TYPE = 2
declare function sqlite3_get_autocommit(byval as sqlite3 ptr) as long
declare function sqlite3_db_handle(byval as sqlite3_stmt ptr) as sqlite3 ptr
declare function sqlite3_db_filename(byval db as sqlite3 ptr, byval zDbName as const zstring ptr) as const zstring ptr
declare function sqlite3_db_readonly(byval db as sqlite3 ptr, byval zDbName as const zstring ptr) as long
declare function sqlite3_next_stmt(byval pDb as sqlite3 ptr, byval pStmt as sqlite3_stmt ptr) as sqlite3_stmt ptr
declare function sqlite3_commit_hook(byval as sqlite3 ptr, byval as function(byval as any ptr) as long, byval as any ptr) as any ptr
declare function sqlite3_rollback_hook(byval as sqlite3 ptr, byval as sub(byval as any ptr), byval as any ptr) as any ptr
declare function sqlite3_update_hook(byval as sqlite3 ptr, byval as sub(byval as any ptr, byval as long, byval as const zstring ptr, byval as const zstring ptr, byval as sqlite3_int64), byval as any ptr) as any ptr
declare function sqlite3_enable_shared_cache(byval as long) as long
declare function sqlite3_release_memory(byval as long) as long
declare function sqlite3_db_release_memory(byval as sqlite3 ptr) as long
declare function sqlite3_soft_heap_limit64(byval N as sqlite3_int64) as sqlite3_int64
declare sub sqlite3_soft_heap_limit(byval N as long)
declare function sqlite3_table_column_metadata(byval db as sqlite3 ptr, byval zDbName as const zstring ptr, byval zTableName as const zstring ptr, byval zColumnName as const zstring ptr, byval pzDataType as const zstring ptr ptr, byval pzCollSeq as const zstring ptr ptr, byval pNotNull as long ptr, byval pPrimaryKey as long ptr, byval pAutoinc as long ptr) as long
declare function sqlite3_load_extension(byval db as sqlite3 ptr, byval zFile as const zstring ptr, byval zProc as const zstring ptr, byval pzErrMsg as zstring ptr ptr) as long
declare function sqlite3_enable_load_extension(byval db as sqlite3 ptr, byval onoff as long) as long
declare function sqlite3_auto_extension(byval xEntryPoint as sub()) as long
declare function sqlite3_cancel_auto_extension(byval xEntryPoint as sub()) as long
declare sub sqlite3_reset_auto_extension()

type sqlite3_vtab as sqlite3_vtab_
type sqlite3_index_info as sqlite3_index_info_
type sqlite3_vtab_cursor as sqlite3_vtab_cursor_

type sqlite3_module
   iVersion as long
   xCreate as function(byval as sqlite3 ptr, byval pAux as any ptr, byval argc as long, byval argv as const zstring const ptr ptr, byval ppVTab as sqlite3_vtab ptr ptr, byval as zstring ptr ptr) as long
   xConnect as function(byval as sqlite3 ptr, byval pAux as any ptr, byval argc as long, byval argv as const zstring const ptr ptr, byval ppVTab as sqlite3_vtab ptr ptr, byval as zstring ptr ptr) as long
   xBestIndex as function(byval pVTab as sqlite3_vtab ptr, byval as sqlite3_index_info ptr) as long
   xDisconnect as function(byval pVTab as sqlite3_vtab ptr) as long
   xDestroy as function(byval pVTab as sqlite3_vtab ptr) as long
   xOpen as function(byval pVTab as sqlite3_vtab ptr, byval ppCursor as sqlite3_vtab_cursor ptr ptr) as long
   xClose as function(byval as sqlite3_vtab_cursor ptr) as long
   xFilter as function(byval as sqlite3_vtab_cursor ptr, byval idxNum as long, byval idxStr as const zstring ptr, byval argc as long, byval argv as sqlite3_value ptr ptr) as long
   xNext as function(byval as sqlite3_vtab_cursor ptr) as long
   xEof as function(byval as sqlite3_vtab_cursor ptr) as long
   xColumn as function(byval as sqlite3_vtab_cursor ptr, byval as sqlite3_context ptr, byval as long) as long
   xRowid as function(byval as sqlite3_vtab_cursor ptr, byval pRowid as sqlite3_int64 ptr) as long
   xUpdate as function(byval as sqlite3_vtab ptr, byval as long, byval as sqlite3_value ptr ptr, byval as sqlite3_int64 ptr) as long
   xBegin as function(byval pVTab as sqlite3_vtab ptr) as long
   xSync as function(byval pVTab as sqlite3_vtab ptr) as long
   xCommit as function(byval pVTab as sqlite3_vtab ptr) as long
   xRollback as function(byval pVTab as sqlite3_vtab ptr) as long
   xFindFunction as function(byval pVtab as sqlite3_vtab ptr, byval nArg as long, byval zName as const zstring ptr, byval pxFunc as typeof(sub(byval as sqlite3_context ptr, byval as long, byval as sqlite3_value ptr ptr)) ptr, byval ppArg as any ptr ptr) as long
   xRename as function(byval pVtab as sqlite3_vtab ptr, byval zNew as const zstring ptr) as long
   xSavepoint as function(byval pVTab as sqlite3_vtab ptr, byval as long) as long
   xRelease as function(byval pVTab as sqlite3_vtab ptr, byval as long) as long
   xRollbackTo as function(byval pVTab as sqlite3_vtab ptr, byval as long) as long
   xShadowName as function(byval as const zstring ptr) as long
end type

type sqlite3_index_constraint
   iColumn as long
   op as ubyte
   usable as ubyte
   iTermOffset as long
end type

type sqlite3_index_orderby
   iColumn as long
   desc as ubyte
end type

type sqlite3_index_constraint_usage
   argvIndex as long
   omit as ubyte
end type

type sqlite3_index_info_
   nConstraint as long
   aConstraint as sqlite3_index_constraint ptr
   nOrderBy as long
   aOrderBy as sqlite3_index_orderby ptr
   aConstraintUsage as sqlite3_index_constraint_usage ptr
   idxNum as long
   idxStr as zstring ptr
   needToFreeIdxStr as long
   orderByConsumed as long
   estimatedCost as double
   estimatedRows as sqlite3_int64
   idxFlags as long
   colUsed as sqlite3_uint64
end type

const SQLITE_INDEX_SCAN_UNIQUE = 1
const SQLITE_INDEX_CONSTRAINT_EQ = 2
const SQLITE_INDEX_CONSTRAINT_GT = 4
const SQLITE_INDEX_CONSTRAINT_LE = 8
const SQLITE_INDEX_CONSTRAINT_LT = 16
const SQLITE_INDEX_CONSTRAINT_GE = 32
const SQLITE_INDEX_CONSTRAINT_MATCH = 64
const SQLITE_INDEX_CONSTRAINT_LIKE = 65
const SQLITE_INDEX_CONSTRAINT_GLOB = 66
const SQLITE_INDEX_CONSTRAINT_REGEXP = 67
const SQLITE_INDEX_CONSTRAINT_NE = 68
const SQLITE_INDEX_CONSTRAINT_ISNOT = 69
const SQLITE_INDEX_CONSTRAINT_ISNOTNULL = 70
const SQLITE_INDEX_CONSTRAINT_ISNULL = 71
const SQLITE_INDEX_CONSTRAINT_IS = 72
const SQLITE_INDEX_CONSTRAINT_FUNCTION = 150
declare function sqlite3_create_module(byval db as sqlite3 ptr, byval zName as const zstring ptr, byval p as const sqlite3_module ptr, byval pClientData as any ptr) as long
declare function sqlite3_create_module_v2(byval db as sqlite3 ptr, byval zName as const zstring ptr, byval p as const sqlite3_module ptr, byval pClientData as any ptr, byval xDestroy as sub(byval as any ptr)) as long

type sqlite3_vtab_
   pModule as const sqlite3_module ptr
   nRef as long
   zErrMsg as zstring ptr
end type

type sqlite3_vtab_cursor_
   pVtab as sqlite3_vtab ptr
end type

declare function sqlite3_declare_vtab(byval as sqlite3 ptr, byval zSQL as const zstring ptr) as long
declare function sqlite3_overload_function(byval as sqlite3 ptr, byval zFuncName as const zstring ptr, byval nArg as long) as long
type sqlite3_blob as sqlite3_blob_
declare function sqlite3_blob_open(byval as sqlite3 ptr, byval zDb as const zstring ptr, byval zTable as const zstring ptr, byval zColumn as const zstring ptr, byval iRow as sqlite3_int64, byval flags as long, byval ppBlob as sqlite3_blob ptr ptr) as long
declare function sqlite3_blob_reopen(byval as sqlite3_blob ptr, byval as sqlite3_int64) as long
declare function sqlite3_blob_close(byval as sqlite3_blob ptr) as long
declare function sqlite3_blob_bytes(byval as sqlite3_blob ptr) as long
declare function sqlite3_blob_read(byval as sqlite3_blob ptr, byval Z as any ptr, byval N as long, byval iOffset as long) as long
declare function sqlite3_blob_write(byval as sqlite3_blob ptr, byval z as const any ptr, byval n as long, byval iOffset as long) as long
declare function sqlite3_vfs_find(byval zVfsName as const zstring ptr) as sqlite3_vfs ptr
declare function sqlite3_vfs_register(byval as sqlite3_vfs ptr, byval makeDflt as long) as long
declare function sqlite3_vfs_unregister(byval as sqlite3_vfs ptr) as long
type sqlite3_mutex as sqlite3_mutex_
declare function sqlite3_mutex_alloc(byval as long) as sqlite3_mutex ptr
declare sub sqlite3_mutex_free(byval as sqlite3_mutex ptr)
declare sub sqlite3_mutex_enter(byval as sqlite3_mutex ptr)
declare function sqlite3_mutex_try(byval as sqlite3_mutex ptr) as long
declare sub sqlite3_mutex_leave(byval as sqlite3_mutex ptr)

type sqlite3_mutex_methods
   xMutexInit as function() as long
   xMutexEnd as function() as long
   xMutexAlloc as function(byval as long) as sqlite3_mutex ptr
   xMutexFree as sub(byval as sqlite3_mutex ptr)
   xMutexEnter as sub(byval as sqlite3_mutex ptr)
   xMutexTry as function(byval as sqlite3_mutex ptr) as long
   xMutexLeave as sub(byval as sqlite3_mutex ptr)
   xMutexHeld as function(byval as sqlite3_mutex ptr) as long
   xMutexNotheld as function(byval as sqlite3_mutex ptr) as long
end type

declare function sqlite3_mutex_held(byval as sqlite3_mutex ptr) as long
declare function sqlite3_mutex_notheld(byval as sqlite3_mutex ptr) as long
const SQLITE_MUTEX_FAST = 0
const SQLITE_MUTEX_RECURSIVE = 1
const SQLITE_MUTEX_STATIC_MASTER = 2
const SQLITE_MUTEX_STATIC_MEM = 3
const SQLITE_MUTEX_STATIC_MEM2 = 4
const SQLITE_MUTEX_STATIC_OPEN = 4
const SQLITE_MUTEX_STATIC_PRNG = 5
const SQLITE_MUTEX_STATIC_LRU = 6
const SQLITE_MUTEX_STATIC_LRU2 = 7
const SQLITE_MUTEX_STATIC_PMEM = 7
const SQLITE_MUTEX_STATIC_APP1 = 8
const SQLITE_MUTEX_STATIC_APP2 = 9
const SQLITE_MUTEX_STATIC_APP3 = 10
const SQLITE_MUTEX_STATIC_VFS1 = 11
const SQLITE_MUTEX_STATIC_VFS2 = 12
const SQLITE_MUTEX_STATIC_VFS3 = 13

declare function sqlite3_db_mutex(byval as sqlite3 ptr) as sqlite3_mutex ptr
declare function sqlite3_file_control(byval as sqlite3 ptr, byval zDbName as const zstring ptr, byval op as long, byval as any ptr) as long
declare function sqlite3_test_control(byval op as long, ...) as long

const SQLITE_TESTCTRL_FIRST = 5
const SQLITE_TESTCTRL_PRNG_SAVE = 5
const SQLITE_TESTCTRL_PRNG_RESTORE = 6
const SQLITE_TESTCTRL_PRNG_RESET = 7
const SQLITE_TESTCTRL_BITVEC_TEST = 8
const SQLITE_TESTCTRL_FAULT_INSTALL = 9
const SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS = 10
const SQLITE_TESTCTRL_PENDING_BYTE = 11
const SQLITE_TESTCTRL_ASSERT = 12
const SQLITE_TESTCTRL_ALWAYS = 13
const SQLITE_TESTCTRL_RESERVE = 14
const SQLITE_TESTCTRL_OPTIMIZATIONS = 15
const SQLITE_TESTCTRL_ISKEYWORD = 16
const SQLITE_TESTCTRL_SCRATCHMALLOC = 17
const SQLITE_TESTCTRL_INTERNAL_FUNCTIONS = 17
const SQLITE_TESTCTRL_LOCALTIME_FAULT = 18
const SQLITE_TESTCTRL_EXPLAIN_STMT = 19
const SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD = 19
const SQLITE_TESTCTRL_NEVER_CORRUPT = 20
const SQLITE_TESTCTRL_VDBE_COVERAGE = 21
const SQLITE_TESTCTRL_BYTEORDER = 22
const SQLITE_TESTCTRL_ISINIT = 23
const SQLITE_TESTCTRL_SORTER_MMAP = 24
const SQLITE_TESTCTRL_IMPOSTER = 25
const SQLITE_TESTCTRL_PARSER_COVERAGE = 26
const SQLITE_TESTCTRL_LAST = 26

declare function sqlite3_keyword_count() as long
declare function sqlite3_keyword_name(byval as long, byval as const zstring ptr ptr, byval as long ptr) as long
declare function sqlite3_keyword_check(byval as const zstring ptr, byval as long) as long
type sqlite3_str as sqlite3_str_
declare function sqlite3_str_new(byval as sqlite3 ptr) as sqlite3_str ptr
declare function sqlite3_str_finish(byval as sqlite3_str ptr) as zstring ptr
declare sub sqlite3_str_appendf(byval as sqlite3_str ptr, byval zFormat as const zstring ptr, ...)
declare sub sqlite3_str_vappendf(byval as sqlite3_str ptr, byval zFormat as const zstring ptr, byval as va_list)
declare sub sqlite3_str_append(byval as sqlite3_str ptr, byval zIn as const zstring ptr, byval N as long)
declare sub sqlite3_str_appendall(byval as sqlite3_str ptr, byval zIn as const zstring ptr)
declare sub sqlite3_str_appendchar(byval as sqlite3_str ptr, byval N as long, byval C as byte)
declare sub sqlite3_str_reset(byval as sqlite3_str ptr)
declare function sqlite3_str_errcode(byval as sqlite3_str ptr) as long
declare function sqlite3_str_length(byval as sqlite3_str ptr) as long
declare function sqlite3_str_value(byval as sqlite3_str ptr) as zstring ptr
declare function sqlite3_status(byval op as long, byval pCurrent as long ptr, byval pHighwater as long ptr, byval resetFlag as long) as long
declare function sqlite3_status64(byval op as long, byval pCurrent as sqlite3_int64 ptr, byval pHighwater as sqlite3_int64 ptr, byval resetFlag as long) as long

const SQLITE_STATUS_MEMORY_USED = 0
const SQLITE_STATUS_PAGECACHE_USED = 1
const SQLITE_STATUS_PAGECACHE_OVERFLOW = 2
const SQLITE_STATUS_SCRATCH_USED = 3
const SQLITE_STATUS_SCRATCH_OVERFLOW = 4
const SQLITE_STATUS_MALLOC_SIZE = 5
const SQLITE_STATUS_PARSER_STACK = 6
const SQLITE_STATUS_PAGECACHE_SIZE = 7
const SQLITE_STATUS_SCRATCH_SIZE = 8
const SQLITE_STATUS_MALLOC_COUNT = 9
declare function sqlite3_db_status(byval as sqlite3 ptr, byval op as long, byval pCur as long ptr, byval pHiwtr as long ptr, byval resetFlg as long) as long
const SQLITE_DBSTATUS_LOOKASIDE_USED = 0
const SQLITE_DBSTATUS_CACHE_USED = 1
const SQLITE_DBSTATUS_SCHEMA_USED = 2
const SQLITE_DBSTATUS_STMT_USED = 3
const SQLITE_DBSTATUS_LOOKASIDE_HIT = 4
const SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE = 5
const SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL = 6
const SQLITE_DBSTATUS_CACHE_HIT = 7
const SQLITE_DBSTATUS_CACHE_MISS = 8
const SQLITE_DBSTATUS_CACHE_WRITE = 9
const SQLITE_DBSTATUS_DEFERRED_FKS = 10
const SQLITE_DBSTATUS_CACHE_USED_SHARED = 11
const SQLITE_DBSTATUS_CACHE_SPILL = 12
const SQLITE_DBSTATUS_MAX = 12
declare function sqlite3_stmt_status(byval as sqlite3_stmt ptr, byval op as long, byval resetFlg as long) as long
const SQLITE_STMTSTATUS_FULLSCAN_STEP = 1
const SQLITE_STMTSTATUS_SORT = 2
const SQLITE_STMTSTATUS_AUTOINDEX = 3
const SQLITE_STMTSTATUS_VM_STEP = 4
const SQLITE_STMTSTATUS_REPREPARE = 5
const SQLITE_STMTSTATUS_RUN = 6
const SQLITE_STMTSTATUS_MEMUSED = 99

type sqlite3_pcache_page
   pBuf as any ptr
   pExtra as any ptr
end type

type sqlite3_pcache as sqlite3_pcache_

type sqlite3_pcache_methods2
   iVersion as long
   pArg as any ptr
   xInit as function(byval as any ptr) as long
   xShutdown as sub(byval as any ptr)
   xCreate as function(byval szPage as long, byval szExtra as long, byval bPurgeable as long) as sqlite3_pcache ptr
   xCachesize as sub(byval as sqlite3_pcache ptr, byval nCachesize as long)
   xPagecount as function(byval as sqlite3_pcache ptr) as long
   xFetch as function(byval as sqlite3_pcache ptr, byval key as ulong, byval createFlag as long) as sqlite3_pcache_page ptr
   xUnpin as sub(byval as sqlite3_pcache ptr, byval as sqlite3_pcache_page ptr, byval discard as long)
   xRekey as sub(byval as sqlite3_pcache ptr, byval as sqlite3_pcache_page ptr, byval oldKey as ulong, byval newKey as ulong)
   xTruncate as sub(byval as sqlite3_pcache ptr, byval iLimit as ulong)
   xDestroy as sub(byval as sqlite3_pcache ptr)
   xShrink as sub(byval as sqlite3_pcache ptr)
end type

type sqlite3_pcache_methods
   pArg as any ptr
   xInit as function(byval as any ptr) as long
   xShutdown as sub(byval as any ptr)
   xCreate as function(byval szPage as long, byval bPurgeable as long) as sqlite3_pcache ptr
   xCachesize as sub(byval as sqlite3_pcache ptr, byval nCachesize as long)
   xPagecount as function(byval as sqlite3_pcache ptr) as long
   xFetch as function(byval as sqlite3_pcache ptr, byval key as ulong, byval createFlag as long) as any ptr
   xUnpin as sub(byval as sqlite3_pcache ptr, byval as any ptr, byval discard as long)
   xRekey as sub(byval as sqlite3_pcache ptr, byval as any ptr, byval oldKey as ulong, byval newKey as ulong)
   xTruncate as sub(byval as sqlite3_pcache ptr, byval iLimit as ulong)
   xDestroy as sub(byval as sqlite3_pcache ptr)
end type

type sqlite3_backup as sqlite3_backup_

declare function sqlite3_backup_init(byval pDest as sqlite3 ptr, byval zDestName as const zstring ptr, byval pSource as sqlite3 ptr, byval zSourceName as const zstring ptr) as sqlite3_backup ptr
declare function sqlite3_backup_step(byval p as sqlite3_backup ptr, byval nPage as long) as long
declare function sqlite3_backup_finish(byval p as sqlite3_backup ptr) as long
declare function sqlite3_backup_remaining(byval p as sqlite3_backup ptr) as long
declare function sqlite3_backup_pagecount(byval p as sqlite3_backup ptr) as long
declare function sqlite3_unlock_notify(byval pBlocked as sqlite3 ptr, byval xNotify as sub(byval apArg as any ptr ptr, byval nArg as long), byval pNotifyArg as any ptr) as long
declare function sqlite3_stricmp(byval as const zstring ptr, byval as const zstring ptr) as long
declare function sqlite3_strnicmp(byval as const zstring ptr, byval as const zstring ptr, byval as long) as long
declare function sqlite3_strglob(byval zGlob as const zstring ptr, byval zStr as const zstring ptr) as long
declare function sqlite3_strlike(byval zGlob as const zstring ptr, byval zStr as const zstring ptr, byval cEsc as ulong) as long
declare sub sqlite3_log(byval iErrCode as long, byval zFormat as const zstring ptr, ...)
declare function sqlite3_wal_hook(byval as sqlite3 ptr, byval as function(byval as any ptr, byval as sqlite3 ptr, byval as const zstring ptr, byval as long) as long, byval as any ptr) as any ptr
declare function sqlite3_wal_autocheckpoint(byval db as sqlite3 ptr, byval N as long) as long
declare function sqlite3_wal_checkpoint(byval db as sqlite3 ptr, byval zDb as const zstring ptr) as long
declare function sqlite3_wal_checkpoint_v2(byval db as sqlite3 ptr, byval zDb as const zstring ptr, byval eMode as long, byval pnLog as long ptr, byval pnCkpt as long ptr) as long

const SQLITE_CHECKPOINT_PASSIVE = 0
const SQLITE_CHECKPOINT_FULL = 1
const SQLITE_CHECKPOINT_RESTART = 2
const SQLITE_CHECKPOINT_TRUNCATE = 3
declare function sqlite3_vtab_config(byval as sqlite3 ptr, byval op as long, ...) as long
const SQLITE_VTAB_CONSTRAINT_SUPPORT = 1

declare function sqlite3_vtab_on_conflict(byval as sqlite3 ptr) as long
declare function sqlite3_vtab_nochange(byval as sqlite3_context ptr) as long
declare function sqlite3_vtab_collation(byval as sqlite3_index_info ptr, byval as long) as const zstring ptr

const SQLITE_ROLLBACK = 1
const SQLITE_FAIL = 3
const SQLITE_REPLACE = 5
const SQLITE_SCANSTAT_NLOOP = 0
const SQLITE_SCANSTAT_NVISIT = 1
const SQLITE_SCANSTAT_EST = 2
const SQLITE_SCANSTAT_NAME = 3
const SQLITE_SCANSTAT_EXPLAIN = 4
const SQLITE_SCANSTAT_SELECTID = 5

declare function sqlite3_stmt_scanstatus(byval pStmt as sqlite3_stmt ptr, byval idx as long, byval iScanStatusOp as long, byval pOut as any ptr) as long
declare sub sqlite3_stmt_scanstatus_reset(byval as sqlite3_stmt ptr)
declare function sqlite3_db_cacheflush(byval as sqlite3 ptr) as long
declare function sqlite3_system_errno(byval as sqlite3 ptr) as long

type sqlite3_snapshot
   hidden(0 to 47) as ubyte
end type

declare function sqlite3_snapshot_get(byval db as sqlite3 ptr, byval zSchema as const zstring ptr, byval ppSnapshot as sqlite3_snapshot ptr ptr) as long
declare function sqlite3_snapshot_open(byval db as sqlite3 ptr, byval zSchema as const zstring ptr, byval pSnapshot as sqlite3_snapshot ptr) as long
declare sub sqlite3_snapshot_free(byval as sqlite3_snapshot ptr)
declare function sqlite3_snapshot_cmp(byval p1 as sqlite3_snapshot ptr, byval p2 as sqlite3_snapshot ptr) as long
declare function sqlite3_snapshot_recover(byval db as sqlite3 ptr, byval zDb as const zstring ptr) as long
declare function sqlite3_serialize(byval db as sqlite3 ptr, byval zSchema as const zstring ptr, byval piSize as sqlite3_int64 ptr, byval mFlags as ulong) as ubyte ptr
const SQLITE_SERIALIZE_NOCOPY = &h001
declare function sqlite3_deserialize(byval db as sqlite3 ptr, byval zSchema as const zstring ptr, byval pData as ubyte ptr, byval szDb as sqlite3_int64, byval szBuf as sqlite3_int64, byval mFlags as ulong) as long

const SQLITE_DESERIALIZE_FREEONCLOSE = 1
const SQLITE_DESERIALIZE_RESIZEABLE = 2
const SQLITE_DESERIALIZE_READONLY = 4
#define _SQLITE3RTREE_H_
type sqlite3_rtree_dbl as double
type sqlite3_rtree_geometry as sqlite3_rtree_geometry_
declare function sqlite3_rtree_geometry_callback(byval db as sqlite3 ptr, byval zGeom as const zstring ptr, byval xGeom as function(byval as sqlite3_rtree_geometry ptr, byval as long, byval as sqlite3_rtree_dbl ptr, byval as long ptr) as long, byval pContext as any ptr) as long

type sqlite3_rtree_geometry_
   pContext as any ptr
   nParam as long
   aParam as sqlite3_rtree_dbl ptr
   pUser as any ptr
   xDelUser as sub(byval as any ptr)
end type

type sqlite3_rtree_query_info as sqlite3_rtree_query_info_
declare function sqlite3_rtree_query_callback(byval db as sqlite3 ptr, byval zQueryFunc as const zstring ptr, byval xQueryFunc as function(byval as sqlite3_rtree_query_info ptr) as long, byval pContext as any ptr, byval xDestructor as sub(byval as any ptr)) as long

type sqlite3_rtree_query_info_
   pContext as any ptr
   nParam as long
   aParam as sqlite3_rtree_dbl ptr
   pUser as any ptr
   xDelUser as sub(byval as any ptr)
   aCoord as sqlite3_rtree_dbl ptr
   anQueue as ulong ptr
   nCoord as long
   iLevel as long
   mxLevel as long
   iRowid as sqlite3_int64
   rParentScore as sqlite3_rtree_dbl
   eParentWithin as long
   eWithin as long
   rScore as sqlite3_rtree_dbl
   apSqlParam as sqlite3_value ptr ptr
end type

const NOT_WITHIN = 0
const PARTLY_WITHIN = 1
const FULLY_WITHIN = 2
#define _FTS5_H
type Fts5ExtensionApi as Fts5ExtensionApi_
type Fts5Context as Fts5Context_

type fts5_extension_function as sub(byval pApi as const Fts5ExtensionApi ptr, byval pFts as Fts5Context ptr, byval pCtx as sqlite3_context ptr, byval nVal as long, byval apVal as sqlite3_value ptr ptr)

type Fts5PhraseIter
   a as const ubyte ptr
   b as const ubyte ptr
end type

type Fts5ExtensionApi_
   iVersion as long
   xUserData as function(byval as Fts5Context ptr) as any ptr
   xColumnCount as function(byval as Fts5Context ptr) as long
   xRowCount as function(byval as Fts5Context ptr, byval pnRow as sqlite3_int64 ptr) as long
   xColumnTotalSize as function(byval as Fts5Context ptr, byval iCol as long, byval pnToken as sqlite3_int64 ptr) as long
   xTokenize as function(byval as Fts5Context ptr, byval pText as const zstring ptr, byval nText as long, byval pCtx as any ptr, byval xToken as function(byval as any ptr, byval as long, byval as const zstring ptr, byval as long, byval as long, byval as long) as long) as long
   xPhraseCount as function(byval as Fts5Context ptr) as long
   xPhraseSize as function(byval as Fts5Context ptr, byval iPhrase as long) as long
   xInstCount as function(byval as Fts5Context ptr, byval pnInst as long ptr) as long
   xInst as function(byval as Fts5Context ptr, byval iIdx as long, byval piPhrase as long ptr, byval piCol as long ptr, byval piOff as long ptr) as long
   xRowid as function(byval as Fts5Context ptr) as sqlite3_int64
   xColumnText as function(byval as Fts5Context ptr, byval iCol as long, byval pz as const zstring ptr ptr, byval pn as long ptr) as long
   xColumnSize as function(byval as Fts5Context ptr, byval iCol as long, byval pnToken as long ptr) as long
   xQueryPhrase as function(byval as Fts5Context ptr, byval iPhrase as long, byval pUserData as any ptr, byval as function(byval as const Fts5ExtensionApi ptr, byval as Fts5Context ptr, byval as any ptr) as long) as long
   xSetAuxdata as function(byval as Fts5Context ptr, byval pAux as any ptr, byval xDelete as sub(byval as any ptr)) as long
   xGetAuxdata as function(byval as Fts5Context ptr, byval bClear as long) as any ptr
   xPhraseFirst as function(byval as Fts5Context ptr, byval iPhrase as long, byval as Fts5PhraseIter ptr, byval as long ptr, byval as long ptr) as long
   xPhraseNext as sub(byval as Fts5Context ptr, byval as Fts5PhraseIter ptr, byval piCol as long ptr, byval piOff as long ptr)
   xPhraseFirstColumn as function(byval as Fts5Context ptr, byval iPhrase as long, byval as Fts5PhraseIter ptr, byval as long ptr) as long
   xPhraseNextColumn as sub(byval as Fts5Context ptr, byval as Fts5PhraseIter ptr, byval piCol as long ptr)
end type

type Fts5Tokenizer as Fts5Tokenizer_

type fts5_tokenizer
   xCreate as function(byval as any ptr, byval azArg as const zstring ptr ptr, byval nArg as long, byval ppOut as Fts5Tokenizer ptr ptr) as long
   xDelete as sub(byval as Fts5Tokenizer ptr)
   xTokenize as function(byval as Fts5Tokenizer ptr, byval pCtx as any ptr, byval flags as long, byval pText as const zstring ptr, byval nText as long, byval xToken as function(byval pCtx as any ptr, byval tflags as long, byval pToken as const zstring ptr, byval nToken as long, byval iStart as long, byval iEnd as long) as long) as long
end type

const FTS5_TOKENIZE_QUERY = &h0001
const FTS5_TOKENIZE_PREFIX = &h0002
const FTS5_TOKENIZE_DOCUMENT = &h0004
const FTS5_TOKENIZE_AUX = &h0008
const FTS5_TOKEN_COLOCATED = &h0001

type fts5_api
   iVersion as long
   xCreateTokenizer as function(byval pApi as fts5_api ptr, byval zName as const zstring ptr, byval pContext as any ptr, byval pTokenizer as fts5_tokenizer ptr, byval xDestroy as sub(byval as any ptr)) as long
   xFindTokenizer as function(byval pApi as fts5_api ptr, byval zName as const zstring ptr, byval ppContext as any ptr ptr, byval pTokenizer as fts5_tokenizer ptr) as long
   xCreateFunction as function(byval pApi as fts5_api ptr, byval zName as const zstring ptr, byval pContext as any ptr, byval xFunction as fts5_extension_function, byval xDestroy as sub(byval as any ptr)) as long
end type

end extern
Last edited by srvaldez on Dec 14, 2018 5:39, edited 1 time in total.
srvaldez
Posts: 2109
Joined: Sep 25, 2005 21:54

Re: SQLite 3. Any update since 1.05 release 3 years ago?

Postby srvaldez » Dec 14, 2018 1:55

sqlite3ext.bi

Code: Select all

'' FreeBASIC binding for SQLite 3.26.0
''
'' based on the C header files:
''   * 2018 December 1
''   *
''   * The author disclaims copyright to this source code.  In place of
''   * a legal notice, here is a blessing:
''   *
''   *    May you do good and not evil.
''   *    May you find forgiveness for yourself and forgive others.
''   *    May you share freely, never taking more than you give.
''   *
''   ************************************************************************
''   * This header file defines the SQLite interface for use by
''   * shared libraries that want to be imported as extensions into
''   * an SQLite instance.  Shared libraries that intend to be loaded
''   * as extensions by SQLite should #include this file instead of
''   * sqlite3.h.
''
'' translated to FreeBASIC by:
''   Copyright © 2018 FreeBASIC development team

#pragma once

#include once "sqlite3.bi"

extern "C"

#define _SQLITE3EXT_H_

type sqlite3_api_routines
   aggregate_context as function(byval as sqlite3_context ptr, byval nBytes as long) as any ptr
   aggregate_count as function(byval as sqlite3_context ptr) as long
   bind_blob as function(byval as sqlite3_stmt ptr, byval as long, byval as const any ptr, byval n as long, byval as sub(byval as any ptr)) as long
   bind_double as function(byval as sqlite3_stmt ptr, byval as long, byval as double) as long
   bind_int as function(byval as sqlite3_stmt ptr, byval as long, byval as long) as long
   bind_int64 as function(byval as sqlite3_stmt ptr, byval as long, byval as sqlite_int64) as long
   bind_null as function(byval as sqlite3_stmt ptr, byval as long) as long
   bind_parameter_count as function(byval as sqlite3_stmt ptr) as long
   bind_parameter_index as function(byval as sqlite3_stmt ptr, byval zName as const zstring ptr) as long
   bind_parameter_name as function(byval as sqlite3_stmt ptr, byval as long) as const zstring ptr
   bind_text as function(byval as sqlite3_stmt ptr, byval as long, byval as const zstring ptr, byval n as long, byval as sub(byval as any ptr)) as long
   bind_text16 as function(byval as sqlite3_stmt ptr, byval as long, byval as const any ptr, byval as long, byval as sub(byval as any ptr)) as long
   bind_value as function(byval as sqlite3_stmt ptr, byval as long, byval as const sqlite3_value ptr) as long
   busy_handler as function(byval as sqlite3 ptr, byval as function(byval as any ptr, byval as long) as long, byval as any ptr) as long
   busy_timeout as function(byval as sqlite3 ptr, byval ms as long) as long
   changes as function(byval as sqlite3 ptr) as long
   close as function(byval as sqlite3 ptr) as long
   collation_needed as function(byval as sqlite3 ptr, byval as any ptr, byval as sub(byval as any ptr, byval as sqlite3 ptr, byval eTextRep as long, byval as const zstring ptr)) as long
   collation_needed16 as function(byval as sqlite3 ptr, byval as any ptr, byval as sub(byval as any ptr, byval as sqlite3 ptr, byval eTextRep as long, byval as const any ptr)) as long
   column_blob as function(byval as sqlite3_stmt ptr, byval iCol as long) as const any ptr
   column_bytes as function(byval as sqlite3_stmt ptr, byval iCol as long) as long
   column_bytes16 as function(byval as sqlite3_stmt ptr, byval iCol as long) as long
   column_count as function(byval pStmt as sqlite3_stmt ptr) as long
   column_database_name as function(byval as sqlite3_stmt ptr, byval as long) as const zstring ptr
   column_database_name16 as function(byval as sqlite3_stmt ptr, byval as long) as const any ptr
   column_decltype as function(byval as sqlite3_stmt ptr, byval i as long) as const zstring ptr
   column_decltype16 as function(byval as sqlite3_stmt ptr, byval as long) as const any ptr
   column_double as function(byval as sqlite3_stmt ptr, byval iCol as long) as double
   column_int as function(byval as sqlite3_stmt ptr, byval iCol as long) as long
   column_int64 as function(byval as sqlite3_stmt ptr, byval iCol as long) as sqlite_int64
   column_name as function(byval as sqlite3_stmt ptr, byval as long) as const zstring ptr
   column_name16 as function(byval as sqlite3_stmt ptr, byval as long) as const any ptr
   column_origin_name as function(byval as sqlite3_stmt ptr, byval as long) as const zstring ptr
   column_origin_name16 as function(byval as sqlite3_stmt ptr, byval as long) as const any ptr
   column_table_name as function(byval as sqlite3_stmt ptr, byval as long) as const zstring ptr
   column_table_name16 as function(byval as sqlite3_stmt ptr, byval as long) as const any ptr
   column_text as function(byval as sqlite3_stmt ptr, byval iCol as long) as const ubyte ptr
   column_text16 as function(byval as sqlite3_stmt ptr, byval iCol as long) as const any ptr
   column_type as function(byval as sqlite3_stmt ptr, byval iCol as long) as long
   column_value as function(byval as sqlite3_stmt ptr, byval iCol as long) as sqlite3_value ptr
   commit_hook as function(byval as sqlite3 ptr, byval as function(byval as any ptr) as long, byval as any ptr) as any ptr
   complete as function(byval sql as const zstring ptr) as long
   complete16 as function(byval sql as const any ptr) as long
   create_collation as function(byval as sqlite3 ptr, byval as const zstring ptr, byval as long, byval as any ptr, byval as function(byval as any ptr, byval as long, byval as const any ptr, byval as long, byval as const any ptr) as long) as long
   create_collation16 as function(byval as sqlite3 ptr, byval as const any ptr, byval as long, byval as any ptr, byval as function(byval as any ptr, byval as long, byval as const any ptr, byval as long, byval as const any ptr) as long) as long
   create_function as function(byval as sqlite3 ptr, byval as const zstring ptr, byval as long, byval as long, byval as any ptr, byval xFunc as sub(byval as sqlite3_context ptr, byval as long, byval as sqlite3_value ptr ptr), byval xStep as sub(byval as sqlite3_context ptr, byval as long, byval as sqlite3_value ptr ptr), byval xFinal as sub(byval as sqlite3_context ptr)) as long
   create_function16 as function(byval as sqlite3 ptr, byval as const any ptr, byval as long, byval as long, byval as any ptr, byval xFunc as sub(byval as sqlite3_context ptr, byval as long, byval as sqlite3_value ptr ptr), byval xStep as sub(byval as sqlite3_context ptr, byval as long, byval as sqlite3_value ptr ptr), byval xFinal as sub(byval as sqlite3_context ptr)) as long
   create_module as function(byval as sqlite3 ptr, byval as const zstring ptr, byval as const sqlite3_module ptr, byval as any ptr) as long
   data_count as function(byval pStmt as sqlite3_stmt ptr) as long
   db_handle as function(byval as sqlite3_stmt ptr) as sqlite3 ptr
   declare_vtab as function(byval as sqlite3 ptr, byval as const zstring ptr) as long
   enable_shared_cache as function(byval as long) as long
   errcode as function(byval db as sqlite3 ptr) as long
   errmsg as function(byval as sqlite3 ptr) as const zstring ptr
   errmsg16 as function(byval as sqlite3 ptr) as const any ptr
   exec as function(byval as sqlite3 ptr, byval as const zstring ptr, byval as sqlite3_callback, byval as any ptr, byval as zstring ptr ptr) as long
   expired as function(byval as sqlite3_stmt ptr) as long
   finalize as function(byval pStmt as sqlite3_stmt ptr) as long
   free as sub(byval as any ptr)
   free_table as sub(byval result as zstring ptr ptr)
   get_autocommit as function(byval as sqlite3 ptr) as long
   get_auxdata as function(byval as sqlite3_context ptr, byval as long) as any ptr
   get_table as function(byval as sqlite3 ptr, byval as const zstring ptr, byval as zstring ptr ptr ptr, byval as long ptr, byval as long ptr, byval as zstring ptr ptr) as long
   global_recover as function() as long
   interruptx as sub(byval as sqlite3 ptr)
   last_insert_rowid as function(byval as sqlite3 ptr) as sqlite_int64
   libversion as function() as const zstring ptr
   libversion_number as function() as long
   malloc as function(byval as long) as any ptr
   mprintf as function(byval as const zstring ptr, ...) as zstring ptr
   open as function(byval as const zstring ptr, byval as sqlite3 ptr ptr) as long
   open16 as function(byval as const any ptr, byval as sqlite3 ptr ptr) as long
   prepare as function(byval as sqlite3 ptr, byval as const zstring ptr, byval as long, byval as sqlite3_stmt ptr ptr, byval as const zstring ptr ptr) as long
   prepare16 as function(byval as sqlite3 ptr, byval as const any ptr, byval as long, byval as sqlite3_stmt ptr ptr, byval as const any ptr ptr) as long
   profile as function(byval as sqlite3 ptr, byval as sub(byval as any ptr, byval as const zstring ptr, byval as sqlite_uint64), byval as any ptr) as any ptr
   progress_handler as sub(byval as sqlite3 ptr, byval as long, byval as function(byval as any ptr) as long, byval as any ptr)
   realloc as function(byval as any ptr, byval as long) as any ptr
   reset as function(byval pStmt as sqlite3_stmt ptr) as long
   result_blob as sub(byval as sqlite3_context ptr, byval as const any ptr, byval as long, byval as sub(byval as any ptr))
   result_double as sub(byval as sqlite3_context ptr, byval as double)
   result_error as sub(byval as sqlite3_context ptr, byval as const zstring ptr, byval as long)
   result_error16 as sub(byval as sqlite3_context ptr, byval as const any ptr, byval as long)
   result_int as sub(byval as sqlite3_context ptr, byval as long)
   result_int64 as sub(byval as sqlite3_context ptr, byval as sqlite_int64)
   result_null as sub(byval as sqlite3_context ptr)
   result_text as sub(byval as sqlite3_context ptr, byval as const zstring ptr, byval as long, byval as sub(byval as any ptr))
   result_text16 as sub(byval as sqlite3_context ptr, byval as const any ptr, byval as long, byval as sub(byval as any ptr))
   result_text16be as sub(byval as sqlite3_context ptr, byval as const any ptr, byval as long, byval as sub(byval as any ptr))
   result_text16le as sub(byval as sqlite3_context ptr, byval as const any ptr, byval as long, byval as sub(byval as any ptr))
   result_value as sub(byval as sqlite3_context ptr, byval as sqlite3_value ptr)
   rollback_hook as function(byval as sqlite3 ptr, byval as sub(byval as any ptr), byval as any ptr) as any ptr
   set_authorizer as function(byval as sqlite3 ptr, byval as function(byval as any ptr, byval as long, byval as const zstring ptr, byval as const zstring ptr, byval as const zstring ptr, byval as const zstring ptr) as long, byval as any ptr) as long
   set_auxdata as sub(byval as sqlite3_context ptr, byval as long, byval as any ptr, byval as sub(byval as any ptr))
   xsnprintf as function(byval as long, byval as zstring ptr, byval as const zstring ptr, ...) as zstring ptr
   step as function(byval as sqlite3_stmt ptr) as long
   table_column_metadata as function(byval as sqlite3 ptr, byval as const zstring ptr, byval as const zstring ptr, byval as const zstring ptr, byval as const zstring ptr ptr, byval as const zstring ptr ptr, byval as long ptr, byval as long ptr, byval as long ptr) as long
   thread_cleanup as sub()
   total_changes as function(byval as sqlite3 ptr) as long
   trace as function(byval as sqlite3 ptr, byval xTrace as sub(byval as any ptr, byval as const zstring ptr), byval as any ptr) as any ptr
   transfer_bindings as function(byval as sqlite3_stmt ptr, byval as sqlite3_stmt ptr) as long
   update_hook as function(byval as sqlite3 ptr, byval as sub(byval as any ptr, byval as long, byval as const zstring ptr, byval as const zstring ptr, byval as sqlite_int64), byval as any ptr) as any ptr
   user_data as function(byval as sqlite3_context ptr) as any ptr
   value_blob as function(byval as sqlite3_value ptr) as const any ptr
   value_bytes as function(byval as sqlite3_value ptr) as long
   value_bytes16 as function(byval as sqlite3_value ptr) as long
   value_double as function(byval as sqlite3_value ptr) as double
   value_int as function(byval as sqlite3_value ptr) as long
   value_int64 as function(byval as sqlite3_value ptr) as sqlite_int64
   value_numeric_type as function(byval as sqlite3_value ptr) as long
   value_text as function(byval as sqlite3_value ptr) as const ubyte ptr
   value_text16 as function(byval as sqlite3_value ptr) as const any ptr
   value_text16be as function(byval as sqlite3_value ptr) as const any ptr
   value_text16le as function(byval as sqlite3_value ptr) as const any ptr
   value_type as function(byval as sqlite3_value ptr) as long
   vmprintf as function(byval as const zstring ptr, byval as va_list) as zstring ptr
   overload_function as function(byval as sqlite3 ptr, byval zFuncName as const zstring ptr, byval nArg as long) as long
   prepare_v2 as function(byval as sqlite3 ptr, byval as const zstring ptr, byval as long, byval as sqlite3_stmt ptr ptr, byval as const zstring ptr ptr) as long
   prepare16_v2 as function(byval as sqlite3 ptr, byval as const any ptr, byval as long, byval as sqlite3_stmt ptr ptr, byval as const any ptr ptr) as long
   clear_bindings as function(byval as sqlite3_stmt ptr) as long
   create_module_v2 as function(byval as sqlite3 ptr, byval as const zstring ptr, byval as const sqlite3_module ptr, byval as any ptr, byval xDestroy as sub(byval as any ptr)) as long
   bind_zeroblob as function(byval as sqlite3_stmt ptr, byval as long, byval as long) as long
   blob_bytes as function(byval as sqlite3_blob ptr) as long
   blob_close as function(byval as sqlite3_blob ptr) as long
   blob_open as function(byval as sqlite3 ptr, byval as const zstring ptr, byval as const zstring ptr, byval as const zstring ptr, byval as sqlite3_int64, byval as long, byval as sqlite3_blob ptr ptr) as long
   blob_read as function(byval as sqlite3_blob ptr, byval as any ptr, byval as long, byval as long) as long
   blob_write as function(byval as sqlite3_blob ptr, byval as const any ptr, byval as long, byval as long) as long
   create_collation_v2 as function(byval as sqlite3 ptr, byval as const zstring ptr, byval as long, byval as any ptr, byval as function(byval as any ptr, byval as long, byval as const any ptr, byval as long, byval as const any ptr) as long, byval as sub(byval as any ptr)) as long
   file_control as function(byval as sqlite3 ptr, byval as const zstring ptr, byval as long, byval as any ptr) as long
   memory_highwater as function(byval as long) as sqlite3_int64
   memory_used as function() as sqlite3_int64
   mutex_alloc as function(byval as long) as sqlite3_mutex ptr
   mutex_enter as sub(byval as sqlite3_mutex ptr)
   mutex_free as sub(byval as sqlite3_mutex ptr)
   mutex_leave as sub(byval as sqlite3_mutex ptr)
   mutex_try as function(byval as sqlite3_mutex ptr) as long
   open_v2 as function(byval as const zstring ptr, byval as sqlite3 ptr ptr, byval as long, byval as const zstring ptr) as long
   release_memory as function(byval as long) as long
   result_error_nomem as sub(byval as sqlite3_context ptr)
   result_error_toobig as sub(byval as sqlite3_context ptr)
   sleep as function(byval as long) as long
   soft_heap_limit as sub(byval as long)
   vfs_find as function(byval as const zstring ptr) as sqlite3_vfs ptr
   vfs_register as function(byval as sqlite3_vfs ptr, byval as long) as long
   vfs_unregister as function(byval as sqlite3_vfs ptr) as long
   xthreadsafe as function() as long
   result_zeroblob as sub(byval as sqlite3_context ptr, byval as long)
   result_error_code as sub(byval as sqlite3_context ptr, byval as long)
   test_control as function(byval as long, ...) as long
   randomness as sub(byval as long, byval as any ptr)
   context_db_handle as function(byval as sqlite3_context ptr) as sqlite3 ptr
   extended_result_codes as function(byval as sqlite3 ptr, byval as long) as long
   limit as function(byval as sqlite3 ptr, byval as long, byval as long) as long
   next_stmt as function(byval as sqlite3 ptr, byval as sqlite3_stmt ptr) as sqlite3_stmt ptr
   sql as function(byval as sqlite3_stmt ptr) as const zstring ptr
   status as function(byval as long, byval as long ptr, byval as long ptr, byval as long) as long
   backup_finish as function(byval as sqlite3_backup ptr) as long
   backup_init as function(byval as sqlite3 ptr, byval as const zstring ptr, byval as sqlite3 ptr, byval as const zstring ptr) as sqlite3_backup ptr
   backup_pagecount as function(byval as sqlite3_backup ptr) as long
   backup_remaining as function(byval as sqlite3_backup ptr) as long
   backup_step as function(byval as sqlite3_backup ptr, byval as long) as long
   compileoption_get as function(byval as long) as const zstring ptr
   compileoption_used as function(byval as const zstring ptr) as long
   create_function_v2 as function(byval as sqlite3 ptr, byval as const zstring ptr, byval as long, byval as long, byval as any ptr, byval xFunc as sub(byval as sqlite3_context ptr, byval as long, byval as sqlite3_value ptr ptr), byval xStep as sub(byval as sqlite3_context ptr, byval as long, byval as sqlite3_value ptr ptr), byval xFinal as sub(byval as sqlite3_context ptr), byval xDestroy as sub(byval as any ptr)) as long
   db_config as function(byval as sqlite3 ptr, byval as long, ...) as long
   db_mutex as function(byval as sqlite3 ptr) as sqlite3_mutex ptr
   db_status as function(byval as sqlite3 ptr, byval as long, byval as long ptr, byval as long ptr, byval as long) as long
   extended_errcode as function(byval as sqlite3 ptr) as long
   log as sub(byval as long, byval as const zstring ptr, ...)
   soft_heap_limit64 as function(byval as sqlite3_int64) as sqlite3_int64
   sourceid as function() as const zstring ptr
   stmt_status as function(byval as sqlite3_stmt ptr, byval as long, byval as long) as long
   strnicmp as function(byval as const zstring ptr, byval as const zstring ptr, byval as long) as long
   unlock_notify as function(byval as sqlite3 ptr, byval as sub(byval as any ptr ptr, byval as long), byval as any ptr) as long
   wal_autocheckpoint as function(byval as sqlite3 ptr, byval as long) as long
   wal_checkpoint as function(byval as sqlite3 ptr, byval as const zstring ptr) as long
   wal_hook as function(byval as sqlite3 ptr, byval as function(byval as any ptr, byval as sqlite3 ptr, byval as const zstring ptr, byval as long) as long, byval as any ptr) as any ptr
   blob_reopen as function(byval as sqlite3_blob ptr, byval as sqlite3_int64) as long
   vtab_config as function(byval as sqlite3 ptr, byval op as long, ...) as long
   vtab_on_conflict as function(byval as sqlite3 ptr) as long
   close_v2 as function(byval as sqlite3 ptr) as long
   db_filename as function(byval as sqlite3 ptr, byval as const zstring ptr) as const zstring ptr
   db_readonly as function(byval as sqlite3 ptr, byval as const zstring ptr) as long
   db_release_memory as function(byval as sqlite3 ptr) as long
   errstr as function(byval as long) as const zstring ptr
   stmt_busy as function(byval as sqlite3_stmt ptr) as long
   stmt_readonly as function(byval as sqlite3_stmt ptr) as long
   stricmp as function(byval as const zstring ptr, byval as const zstring ptr) as long
   uri_boolean as function(byval as const zstring ptr, byval as const zstring ptr, byval as long) as long
   uri_int64 as function(byval as const zstring ptr, byval as const zstring ptr, byval as sqlite3_int64) as sqlite3_int64
   uri_parameter as function(byval as const zstring ptr, byval as const zstring ptr) as const zstring ptr
   xvsnprintf as function(byval as long, byval as zstring ptr, byval as const zstring ptr, byval as va_list) as zstring ptr
   wal_checkpoint_v2 as function(byval as sqlite3 ptr, byval as const zstring ptr, byval as long, byval as long ptr, byval as long ptr) as long
   auto_extension as function(byval as sub()) as long
   bind_blob64 as function(byval as sqlite3_stmt ptr, byval as long, byval as const any ptr, byval as sqlite3_uint64, byval as sub(byval as any ptr)) as long
   bind_text64 as function(byval as sqlite3_stmt ptr, byval as long, byval as const zstring ptr, byval as sqlite3_uint64, byval as sub(byval as any ptr), byval as ubyte) as long
   cancel_auto_extension as function(byval as sub()) as long
   load_extension as function(byval as sqlite3 ptr, byval as const zstring ptr, byval as const zstring ptr, byval as zstring ptr ptr) as long
   malloc64 as function(byval as sqlite3_uint64) as any ptr
   msize as function(byval as any ptr) as sqlite3_uint64
   realloc64 as function(byval as any ptr, byval as sqlite3_uint64) as any ptr
   reset_auto_extension as sub()
   result_blob64 as sub(byval as sqlite3_context ptr, byval as const any ptr, byval as sqlite3_uint64, byval as sub(byval as any ptr))
   result_text64 as sub(byval as sqlite3_context ptr, byval as const zstring ptr, byval as sqlite3_uint64, byval as sub(byval as any ptr), byval as ubyte)
   strglob as function(byval as const zstring ptr, byval as const zstring ptr) as long
   value_dup as function(byval as const sqlite3_value ptr) as sqlite3_value ptr
   value_free as sub(byval as sqlite3_value ptr)
   result_zeroblob64 as function(byval as sqlite3_context ptr, byval as sqlite3_uint64) as long
   bind_zeroblob64 as function(byval as sqlite3_stmt ptr, byval as long, byval as sqlite3_uint64) as long
   value_subtype as function(byval as sqlite3_value ptr) as ulong
   result_subtype as sub(byval as sqlite3_context ptr, byval as ulong)
   status64 as function(byval as long, byval as sqlite3_int64 ptr, byval as sqlite3_int64 ptr, byval as long) as long
   strlike as function(byval as const zstring ptr, byval as const zstring ptr, byval as ulong) as long
   db_cacheflush as function(byval as sqlite3 ptr) as long
   system_errno as function(byval as sqlite3 ptr) as long
   trace_v2 as function(byval as sqlite3 ptr, byval as ulong, byval as function(byval as ulong, byval as any ptr, byval as any ptr, byval as any ptr) as long, byval as any ptr) as long
   expanded_sql as function(byval as sqlite3_stmt ptr) as zstring ptr
   set_last_insert_rowid as sub(byval as sqlite3 ptr, byval as sqlite3_int64)
   prepare_v3 as function(byval as sqlite3 ptr, byval as const zstring ptr, byval as long, byval as ulong, byval as sqlite3_stmt ptr ptr, byval as const zstring ptr ptr) as long
   prepare16_v3 as function(byval as sqlite3 ptr, byval as const any ptr, byval as long, byval as ulong, byval as sqlite3_stmt ptr ptr, byval as const any ptr ptr) as long
   bind_pointer as function(byval as sqlite3_stmt ptr, byval as long, byval as any ptr, byval as const zstring ptr, byval as sub(byval as any ptr)) as long
   result_pointer as sub(byval as sqlite3_context ptr, byval as any ptr, byval as const zstring ptr, byval as sub(byval as any ptr))
   value_pointer as function(byval as sqlite3_value ptr, byval as const zstring ptr) as any ptr
   vtab_nochange as function(byval as sqlite3_context ptr) as long
   value_nochange as function(byval as sqlite3_value ptr) as long
   vtab_collation as function(byval as sqlite3_index_info ptr, byval as long) as const zstring ptr
   keyword_count as function() as long
   keyword_name as function(byval as long, byval as const zstring ptr ptr, byval as long ptr) as long
   keyword_check as function(byval as const zstring ptr, byval as long) as long
   str_new as function(byval as sqlite3 ptr) as sqlite3_str ptr
   str_finish as function(byval as sqlite3_str ptr) as zstring ptr
   str_appendf as sub(byval as sqlite3_str ptr, byval zFormat as const zstring ptr, ...)
   str_vappendf as sub(byval as sqlite3_str ptr, byval zFormat as const zstring ptr, byval as va_list)
   str_append as sub(byval as sqlite3_str ptr, byval zIn as const zstring ptr, byval N as long)
   str_appendall as sub(byval as sqlite3_str ptr, byval zIn as const zstring ptr)
   str_appendchar as sub(byval as sqlite3_str ptr, byval N as long, byval C as byte)
   str_reset as sub(byval as sqlite3_str ptr)
   str_errcode as function(byval as sqlite3_str ptr) as long
   str_length as function(byval as sqlite3_str ptr) as long
   str_value as function(byval as sqlite3_str ptr) as zstring ptr
   create_window_function as function(byval as sqlite3 ptr, byval as const zstring ptr, byval as long, byval as long, byval as any ptr, byval xStep as sub(byval as sqlite3_context ptr, byval as long, byval as sqlite3_value ptr ptr), byval xFinal as sub(byval as sqlite3_context ptr), byval xValue as sub(byval as sqlite3_context ptr), byval xInv as sub(byval as sqlite3_context ptr, byval as long, byval as sqlite3_value ptr ptr), byval xDestroy as sub(byval as any ptr)) as long
   normalized_sql as function(byval as sqlite3_stmt ptr) as const zstring ptr
end type

type sqlite3_loadext_entry as function(byval db as sqlite3 ptr, byval pzErrMsg as zstring ptr ptr, byval pThunk as const sqlite3_api_routines ptr) as long
#undef sqlite3_aggregate_context
#define sqlite3_aggregate_context sqlite3_api->aggregate_context
#undef sqlite3_aggregate_count
#define sqlite3_aggregate_count sqlite3_api->aggregate_count
#undef sqlite3_bind_blob
#define sqlite3_bind_blob sqlite3_api->bind_blob
#undef sqlite3_bind_double
#define sqlite3_bind_double sqlite3_api->bind_double
#undef sqlite3_bind_int
#define sqlite3_bind_int sqlite3_api->bind_int
#undef sqlite3_bind_int64
#define sqlite3_bind_int64 sqlite3_api->bind_int64
#undef sqlite3_bind_null
#define sqlite3_bind_null sqlite3_api->bind_null
#undef sqlite3_bind_parameter_count
#define sqlite3_bind_parameter_count sqlite3_api->bind_parameter_count
#undef sqlite3_bind_parameter_index
#define sqlite3_bind_parameter_index sqlite3_api->bind_parameter_index
#undef sqlite3_bind_parameter_name
#define sqlite3_bind_parameter_name sqlite3_api->bind_parameter_name
#undef sqlite3_bind_text
#define sqlite3_bind_text sqlite3_api->bind_text
#undef sqlite3_bind_text16
#define sqlite3_bind_text16 sqlite3_api->bind_text16
#undef sqlite3_bind_value
#define sqlite3_bind_value sqlite3_api->bind_value
#undef sqlite3_busy_handler
#define sqlite3_busy_handler sqlite3_api->busy_handler
#undef sqlite3_busy_timeout
#define sqlite3_busy_timeout sqlite3_api->busy_timeout
#undef sqlite3_changes
#define sqlite3_changes sqlite3_api->changes
#undef sqlite3_close
#define sqlite3_close sqlite3_api->close
#undef sqlite3_collation_needed
#define sqlite3_collation_needed sqlite3_api->collation_needed
#undef sqlite3_collation_needed16
#define sqlite3_collation_needed16 sqlite3_api->collation_needed16
#undef sqlite3_column_blob
#define sqlite3_column_blob sqlite3_api->column_blob
#undef sqlite3_column_bytes
#define sqlite3_column_bytes sqlite3_api->column_bytes
#undef sqlite3_column_bytes16
#define sqlite3_column_bytes16 sqlite3_api->column_bytes16
#undef sqlite3_column_count
#define sqlite3_column_count sqlite3_api->column_count
#undef sqlite3_column_database_name
#define sqlite3_column_database_name sqlite3_api->column_database_name
#undef sqlite3_column_database_name16
#define sqlite3_column_database_name16 sqlite3_api->column_database_name16
#undef sqlite3_column_decltype
#define sqlite3_column_decltype sqlite3_api->column_decltype
#undef sqlite3_column_decltype16
#define sqlite3_column_decltype16 sqlite3_api->column_decltype16
#undef sqlite3_column_double
#define sqlite3_column_double sqlite3_api->column_double
#undef sqlite3_column_int
#define sqlite3_column_int sqlite3_api->column_int
#undef sqlite3_column_int64
#define sqlite3_column_int64 sqlite3_api->column_int64
#undef sqlite3_column_name
#define sqlite3_column_name sqlite3_api->column_name
#undef sqlite3_column_name16
#define sqlite3_column_name16 sqlite3_api->column_name16
#undef sqlite3_column_origin_name
#define sqlite3_column_origin_name sqlite3_api->column_origin_name
#undef sqlite3_column_origin_name16
#define sqlite3_column_origin_name16 sqlite3_api->column_origin_name16
#undef sqlite3_column_table_name
#define sqlite3_column_table_name sqlite3_api->column_table_name
#undef sqlite3_column_table_name16
#define sqlite3_column_table_name16 sqlite3_api->column_table_name16
#undef sqlite3_column_text
#define sqlite3_column_text sqlite3_api->column_text
#undef sqlite3_column_text16
#define sqlite3_column_text16 sqlite3_api->column_text16
#undef sqlite3_column_type
#define sqlite3_column_type sqlite3_api->column_type
#undef sqlite3_column_value
#define sqlite3_column_value sqlite3_api->column_value
#undef sqlite3_commit_hook
#define sqlite3_commit_hook sqlite3_api->commit_hook
#undef sqlite3_complete
#define sqlite3_complete sqlite3_api->complete
#undef sqlite3_complete16
#define sqlite3_complete16 sqlite3_api->complete16
#undef sqlite3_create_collation
#define sqlite3_create_collation sqlite3_api->create_collation
#undef sqlite3_create_collation16
#define sqlite3_create_collation16 sqlite3_api->create_collation16
#undef sqlite3_create_function
#define sqlite3_create_function sqlite3_api->create_function
#undef sqlite3_create_function16
#define sqlite3_create_function16 sqlite3_api->create_function16
#undef sqlite3_create_module
#define sqlite3_create_module sqlite3_api->create_module
#undef sqlite3_create_module_v2
#define sqlite3_create_module_v2 sqlite3_api->create_module_v2
#undef sqlite3_data_count
#define sqlite3_data_count sqlite3_api->data_count
#undef sqlite3_db_handle
#define sqlite3_db_handle sqlite3_api->db_handle
#undef sqlite3_declare_vtab
#define sqlite3_declare_vtab sqlite3_api->declare_vtab
#undef sqlite3_enable_shared_cache
#define sqlite3_enable_shared_cache sqlite3_api->enable_shared_cache
#undef sqlite3_errcode
#define sqlite3_errcode sqlite3_api->errcode
#undef sqlite3_errmsg
#define sqlite3_errmsg sqlite3_api->errmsg
#undef sqlite3_errmsg16
#define sqlite3_errmsg16 sqlite3_api->errmsg16
#undef sqlite3_exec
#define sqlite3_exec sqlite3_api->exec
#undef sqlite3_expired
#define sqlite3_expired sqlite3_api->expired
#undef sqlite3_finalize
#define sqlite3_finalize sqlite3_api->finalize
#undef sqlite3_free
#define sqlite3_free sqlite3_api->free
#undef sqlite3_free_table
#define sqlite3_free_table sqlite3_api->free_table
#undef sqlite3_get_autocommit
#define sqlite3_get_autocommit sqlite3_api->get_autocommit
#undef sqlite3_get_auxdata
#define sqlite3_get_auxdata sqlite3_api->get_auxdata
#undef sqlite3_get_table
#define sqlite3_get_table sqlite3_api->get_table
#undef sqlite3_global_recover
#define sqlite3_global_recover sqlite3_api->global_recover
#undef sqlite3_interrupt
#define sqlite3_interrupt sqlite3_api->interruptx
#undef sqlite3_last_insert_rowid
#define sqlite3_last_insert_rowid sqlite3_api->last_insert_rowid
#undef sqlite3_libversion
#define sqlite3_libversion sqlite3_api->libversion
#undef sqlite3_libversion_number
#define sqlite3_libversion_number sqlite3_api->libversion_number
#undef sqlite3_malloc
#define sqlite3_malloc sqlite3_api->malloc
#undef sqlite3_mprintf
#define sqlite3_mprintf sqlite3_api->mprintf
#undef sqlite3_open
#define sqlite3_open sqlite3_api->open
#undef sqlite3_open16
#define sqlite3_open16 sqlite3_api->open16
#undef sqlite3_prepare
#define sqlite3_prepare sqlite3_api->prepare
#undef sqlite3_prepare16
#define sqlite3_prepare16 sqlite3_api->prepare16
#undef sqlite3_prepare_v2
#define sqlite3_prepare_v2 sqlite3_api->prepare_v2
#undef sqlite3_prepare16_v2
#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2
#undef sqlite3_profile
#define sqlite3_profile sqlite3_api->profile
#undef sqlite3_progress_handler
#define sqlite3_progress_handler sqlite3_api->progress_handler
#undef sqlite3_realloc
#define sqlite3_realloc sqlite3_api->realloc
#undef sqlite3_reset
#define sqlite3_reset sqlite3_api->reset
#undef sqlite3_result_blob
#define sqlite3_result_blob sqlite3_api->result_blob
#undef sqlite3_result_double
#define sqlite3_result_double sqlite3_api->result_double
#undef sqlite3_result_error
#define sqlite3_result_error sqlite3_api->result_error
#undef sqlite3_result_error16
#define sqlite3_result_error16 sqlite3_api->result_error16
#undef sqlite3_result_int
#define sqlite3_result_int sqlite3_api->result_int
#undef sqlite3_result_int64
#define sqlite3_result_int64 sqlite3_api->result_int64
#undef sqlite3_result_null
#define sqlite3_result_null sqlite3_api->result_null
#undef sqlite3_result_text
#define sqlite3_result_text sqlite3_api->result_text
#undef sqlite3_result_text16
#define sqlite3_result_text16 sqlite3_api->result_text16
#undef sqlite3_result_text16be
#define sqlite3_result_text16be sqlite3_api->result_text16be
#undef sqlite3_result_text16le
#define sqlite3_result_text16le sqlite3_api->result_text16le
#undef sqlite3_result_value
#define sqlite3_result_value sqlite3_api->result_value
#undef sqlite3_rollback_hook
#define sqlite3_rollback_hook sqlite3_api->rollback_hook
#undef sqlite3_set_authorizer
#define sqlite3_set_authorizer sqlite3_api->set_authorizer
#undef sqlite3_set_auxdata
#define sqlite3_set_auxdata sqlite3_api->set_auxdata
#undef sqlite3_snprintf
#define sqlite3_snprintf sqlite3_api->xsnprintf
#undef sqlite3_step
#define sqlite3_step sqlite3_api->step
#undef sqlite3_table_column_metadata
#define sqlite3_table_column_metadata sqlite3_api->table_column_metadata
#undef sqlite3_thread_cleanup
#define sqlite3_thread_cleanup sqlite3_api->thread_cleanup
#undef sqlite3_total_changes
#define sqlite3_total_changes sqlite3_api->total_changes
#undef sqlite3_trace
#define sqlite3_trace sqlite3_api->trace
#undef sqlite3_transfer_bindings
#define sqlite3_transfer_bindings sqlite3_api->transfer_bindings
#undef sqlite3_update_hook
#define sqlite3_update_hook sqlite3_api->update_hook
#undef sqlite3_user_data
#define sqlite3_user_data sqlite3_api->user_data
#undef sqlite3_value_blob
#define sqlite3_value_blob sqlite3_api->value_blob
#undef sqlite3_value_bytes
#define sqlite3_value_bytes sqlite3_api->value_bytes
#undef sqlite3_value_bytes16
#define sqlite3_value_bytes16 sqlite3_api->value_bytes16
#undef sqlite3_value_double
#define sqlite3_value_double sqlite3_api->value_double
#undef sqlite3_value_int
#define sqlite3_value_int sqlite3_api->value_int
#undef sqlite3_value_int64
#define sqlite3_value_int64 sqlite3_api->value_int64
#undef sqlite3_value_numeric_type
#define sqlite3_value_numeric_type sqlite3_api->value_numeric_type
#undef sqlite3_value_text
#define sqlite3_value_text sqlite3_api->value_text
#undef sqlite3_value_text16
#define sqlite3_value_text16 sqlite3_api->value_text16
#undef sqlite3_value_text16be
#define sqlite3_value_text16be sqlite3_api->value_text16be
#undef sqlite3_value_text16le
#define sqlite3_value_text16le sqlite3_api->value_text16le
#undef sqlite3_value_type
#define sqlite3_value_type sqlite3_api->value_type
#undef sqlite3_vmprintf
#define sqlite3_vmprintf sqlite3_api->vmprintf
#undef sqlite3_vsnprintf
#define sqlite3_vsnprintf sqlite3_api->xvsnprintf
#undef sqlite3_overload_function
#define sqlite3_overload_function sqlite3_api->overload_function
#undef sqlite3_prepare_v2
#define sqlite3_prepare_v2 sqlite3_api->prepare_v2
#undef sqlite3_prepare16_v2
#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2
#undef sqlite3_clear_bindings
#define sqlite3_clear_bindings sqlite3_api->clear_bindings
#undef sqlite3_bind_zeroblob
#define sqlite3_bind_zeroblob sqlite3_api->bind_zeroblob
#undef sqlite3_blob_bytes
#define sqlite3_blob_bytes sqlite3_api->blob_bytes
#undef sqlite3_blob_close
#define sqlite3_blob_close sqlite3_api->blob_close
#undef sqlite3_blob_open
#define sqlite3_blob_open sqlite3_api->blob_open
#undef sqlite3_blob_read
#define sqlite3_blob_read sqlite3_api->blob_read
#undef sqlite3_blob_write
#define sqlite3_blob_write sqlite3_api->blob_write
#undef sqlite3_create_collation_v2
#define sqlite3_create_collation_v2 sqlite3_api->create_collation_v2
#undef sqlite3_file_control
#define sqlite3_file_control sqlite3_api->file_control
#undef sqlite3_memory_highwater
#define sqlite3_memory_highwater sqlite3_api->memory_highwater
#undef sqlite3_memory_used
#define sqlite3_memory_used sqlite3_api->memory_used
#undef sqlite3_mutex_alloc
#define sqlite3_mutex_alloc sqlite3_api->mutex_alloc
#undef sqlite3_mutex_enter
#define sqlite3_mutex_enter sqlite3_api->mutex_enter
#undef sqlite3_mutex_free
#define sqlite3_mutex_free sqlite3_api->mutex_free
#undef sqlite3_mutex_leave
#define sqlite3_mutex_leave sqlite3_api->mutex_leave
#undef sqlite3_mutex_try
#define sqlite3_mutex_try sqlite3_api->mutex_try
#undef sqlite3_open_v2
#define sqlite3_open_v2 sqlite3_api->open_v2
#undef sqlite3_release_memory
#define sqlite3_release_memory sqlite3_api->release_memory
#undef sqlite3_result_error_nomem
#define sqlite3_result_error_nomem sqlite3_api->result_error_nomem
#undef sqlite3_result_error_toobig
#define sqlite3_result_error_toobig sqlite3_api->result_error_toobig
#undef sqlite3_sleep
#define sqlite3_sleep sqlite3_api->sleep
#undef sqlite3_soft_heap_limit
#define sqlite3_soft_heap_limit sqlite3_api->soft_heap_limit
#undef sqlite3_vfs_find
#define sqlite3_vfs_find sqlite3_api->vfs_find
#undef sqlite3_vfs_register
#define sqlite3_vfs_register sqlite3_api->vfs_register
#undef sqlite3_vfs_unregister
#define sqlite3_vfs_unregister sqlite3_api->vfs_unregister
#undef sqlite3_threadsafe
#define sqlite3_threadsafe sqlite3_api->xthreadsafe
#undef sqlite3_result_zeroblob
#define sqlite3_result_zeroblob sqlite3_api->result_zeroblob
#undef sqlite3_result_error_code
#define sqlite3_result_error_code sqlite3_api->result_error_code
#undef sqlite3_test_control
#define sqlite3_test_control sqlite3_api->test_control
#undef sqlite3_randomness
#define sqlite3_randomness sqlite3_api->randomness
#undef sqlite3_context_db_handle
#define sqlite3_context_db_handle sqlite3_api->context_db_handle
#undef sqlite3_extended_result_codes
#define sqlite3_extended_result_codes sqlite3_api->extended_result_codes
#undef sqlite3_limit
#define sqlite3_limit sqlite3_api->limit
#undef sqlite3_next_stmt
#define sqlite3_next_stmt sqlite3_api->next_stmt
#undef sqlite3_sql
#define sqlite3_sql sqlite3_api->sql
#undef sqlite3_status
#define sqlite3_status sqlite3_api->status
#undef sqlite3_backup_finish
#define sqlite3_backup_finish sqlite3_api->backup_finish
#undef sqlite3_backup_init
#define sqlite3_backup_init sqlite3_api->backup_init
#undef sqlite3_backup_pagecount
#define sqlite3_backup_pagecount sqlite3_api->backup_pagecount
#undef sqlite3_backup_remaining
#define sqlite3_backup_remaining sqlite3_api->backup_remaining
#undef sqlite3_backup_step
#define sqlite3_backup_step sqlite3_api->backup_step
#undef sqlite3_compileoption_get
#define sqlite3_compileoption_get sqlite3_api->compileoption_get
#undef sqlite3_compileoption_used
#define sqlite3_compileoption_used sqlite3_api->compileoption_used
#undef sqlite3_create_function_v2
#define sqlite3_create_function_v2 sqlite3_api->create_function_v2
#undef sqlite3_db_config
#define sqlite3_db_config sqlite3_api->db_config
#undef sqlite3_db_mutex
#define sqlite3_db_mutex sqlite3_api->db_mutex
#undef sqlite3_db_status
#define sqlite3_db_status sqlite3_api->db_status
#undef sqlite3_extended_errcode
#define sqlite3_extended_errcode sqlite3_api->extended_errcode
#undef sqlite3_log
#define sqlite3_log sqlite3_api->log
#undef sqlite3_soft_heap_limit64
#define sqlite3_soft_heap_limit64 sqlite3_api->soft_heap_limit64
#undef sqlite3_sourceid
#define sqlite3_sourceid sqlite3_api->sourceid
#undef sqlite3_stmt_status
#define sqlite3_stmt_status sqlite3_api->stmt_status
#undef sqlite3_strnicmp
#define sqlite3_strnicmp sqlite3_api->strnicmp
#undef sqlite3_unlock_notify
#define sqlite3_unlock_notify sqlite3_api->unlock_notify
#undef sqlite3_wal_autocheckpoint
#define sqlite3_wal_autocheckpoint sqlite3_api->wal_autocheckpoint
#undef sqlite3_wal_checkpoint
#define sqlite3_wal_checkpoint sqlite3_api->wal_checkpoint
#undef sqlite3_wal_hook
#define sqlite3_wal_hook sqlite3_api->wal_hook
#undef sqlite3_blob_reopen
#define sqlite3_blob_reopen sqlite3_api->blob_reopen
#undef sqlite3_vtab_config
#define sqlite3_vtab_config sqlite3_api->vtab_config
#undef sqlite3_vtab_on_conflict
#define sqlite3_vtab_on_conflict sqlite3_api->vtab_on_conflict
#undef sqlite3_close_v2
#define sqlite3_close_v2 sqlite3_api->close_v2
#undef sqlite3_db_filename
#define sqlite3_db_filename sqlite3_api->db_filename
#undef sqlite3_db_readonly
#define sqlite3_db_readonly sqlite3_api->db_readonly
#undef sqlite3_db_release_memory
#define sqlite3_db_release_memory sqlite3_api->db_release_memory
#undef sqlite3_errstr
#define sqlite3_errstr sqlite3_api->errstr
#undef sqlite3_stmt_busy
#define sqlite3_stmt_busy sqlite3_api->stmt_busy
#undef sqlite3_stmt_readonly
#define sqlite3_stmt_readonly sqlite3_api->stmt_readonly
#undef sqlite3_stricmp
#define sqlite3_stricmp sqlite3_api->stricmp
#undef sqlite3_uri_boolean
#define sqlite3_uri_boolean sqlite3_api->uri_boolean
#undef sqlite3_uri_int64
#define sqlite3_uri_int64 sqlite3_api->uri_int64
#undef sqlite3_uri_parameter
#define sqlite3_uri_parameter sqlite3_api->uri_parameter
#undef sqlite3_uri_vsnprintf
#define sqlite3_uri_vsnprintf sqlite3_api->xvsnprintf
#undef sqlite3_wal_checkpoint_v2
#define sqlite3_wal_checkpoint_v2 sqlite3_api->wal_checkpoint_v2
#undef sqlite3_auto_extension
#define sqlite3_auto_extension sqlite3_api->auto_extension
#undef sqlite3_bind_blob64
#define sqlite3_bind_blob64 sqlite3_api->bind_blob64
#undef sqlite3_bind_text64
#define sqlite3_bind_text64 sqlite3_api->bind_text64
#undef sqlite3_cancel_auto_extension
#define sqlite3_cancel_auto_extension sqlite3_api->cancel_auto_extension
#undef sqlite3_load_extension
#define sqlite3_load_extension sqlite3_api->load_extension
#undef sqlite3_malloc64
#define sqlite3_malloc64 sqlite3_api->malloc64
#undef sqlite3_msize
#define sqlite3_msize sqlite3_api->msize
#undef sqlite3_realloc64
#define sqlite3_realloc64 sqlite3_api->realloc64
#undef sqlite3_reset_auto_extension
#define sqlite3_reset_auto_extension sqlite3_api->reset_auto_extension
#undef sqlite3_result_blob64
#define sqlite3_result_blob64 sqlite3_api->result_blob64
#undef sqlite3_result_text64
#define sqlite3_result_text64 sqlite3_api->result_text64
#undef sqlite3_strglob
#define sqlite3_strglob sqlite3_api->strglob
#undef sqlite3_value_dup
#define sqlite3_value_dup sqlite3_api->value_dup
#undef sqlite3_value_free
#define sqlite3_value_free sqlite3_api->value_free
#undef sqlite3_result_zeroblob64
#define sqlite3_result_zeroblob64 sqlite3_api->result_zeroblob64
#undef sqlite3_bind_zeroblob64
#define sqlite3_bind_zeroblob64 sqlite3_api->bind_zeroblob64
#undef sqlite3_value_subtype
#define sqlite3_value_subtype sqlite3_api->value_subtype
#undef sqlite3_result_subtype
#define sqlite3_result_subtype sqlite3_api->result_subtype
#undef sqlite3_status64
#define sqlite3_status64 sqlite3_api->status64
#undef sqlite3_strlike
#define sqlite3_strlike sqlite3_api->strlike
#undef sqlite3_db_cacheflush
#define sqlite3_db_cacheflush sqlite3_api->db_cacheflush
#undef sqlite3_system_errno
#define sqlite3_system_errno sqlite3_api->system_errno
#undef sqlite3_trace_v2
#define sqlite3_trace_v2 sqlite3_api->trace_v2
#undef sqlite3_expanded_sql
#define sqlite3_expanded_sql sqlite3_api->expanded_sql
#undef sqlite3_set_last_insert_rowid
#define sqlite3_set_last_insert_rowid sqlite3_api->set_last_insert_rowid
#undef sqlite3_prepare_v3
#define sqlite3_prepare_v3 sqlite3_api->prepare_v3
#undef sqlite3_prepare16_v3
#define sqlite3_prepare16_v3 sqlite3_api->prepare16_v3
#undef sqlite3_bind_pointer
#define sqlite3_bind_pointer sqlite3_api->bind_pointer
#undef sqlite3_result_pointer
#define sqlite3_result_pointer sqlite3_api->result_pointer
#undef sqlite3_value_pointer
#define sqlite3_value_pointer sqlite3_api->value_pointer
#undef sqlite3_vtab_nochange
#define sqlite3_vtab_nochange sqlite3_api->vtab_nochange
#undef sqlite3_value_nochange
#define sqlite3_value_nochange sqlite3_api->value_nochange
#undef sqlite3_vtab_collation
#define sqlite3_vtab_collation sqlite3_api->vtab_collation
#undef sqlite3_keyword_count
#define sqlite3_keyword_count sqlite3_api->keyword_count
#undef sqlite3_keyword_name
#define sqlite3_keyword_name sqlite3_api->keyword_name
#undef sqlite3_keyword_check
#define sqlite3_keyword_check sqlite3_api->keyword_check
#undef sqlite3_str_new
#define sqlite3_str_new sqlite3_api->str_new
#undef sqlite3_str_finish
#define sqlite3_str_finish sqlite3_api->str_finish
#undef sqlite3_str_appendf
#define sqlite3_str_appendf sqlite3_api->str_appendf
#undef sqlite3_str_vappendf
#define sqlite3_str_vappendf sqlite3_api->str_vappendf
#undef sqlite3_str_append
#define sqlite3_str_append sqlite3_api->str_append
#undef sqlite3_str_appendall
#define sqlite3_str_appendall sqlite3_api->str_appendall
#undef sqlite3_str_appendchar
#define sqlite3_str_appendchar sqlite3_api->str_appendchar
#undef sqlite3_str_reset
#define sqlite3_str_reset sqlite3_api->str_reset
#undef sqlite3_str_errcode
#define sqlite3_str_errcode sqlite3_api->str_errcode
#undef sqlite3_str_length
#define sqlite3_str_length sqlite3_api->str_length
#undef sqlite3_str_value
#define sqlite3_str_value sqlite3_api->str_value
#undef sqlite3_create_window_function
#define sqlite3_create_window_function sqlite3_api->create_window_function
#undef sqlite3_normalized_sql
#define sqlite3_normalized_sql sqlite3_api->normalized_sql

#define SQLITE_EXTENSION_INIT1 dim shared as const sqlite3_api_routines ptr sqlite3_api = 0
#define SQLITE_EXTENSION_INIT2(v) sqlite3_api = v
#define SQLITE_EXTENSION_INIT3 extern as const sqlite3_api_routines ptr sqlite3_api

end extern
Last edited by srvaldez on Dec 14, 2018 6:29, edited 1 time in total.
srvaldez
Posts: 2109
Joined: Sep 25, 2005 21:54

Re: SQLite 3. Any update since 1.05 release 3 years ago?

Postby srvaldez » Dec 14, 2018 2:18

the import libs were faulty, so I removed them
will post them back if I can verify they work, but you really don't need the import lib, just as long the sqlite3.dll resides where the source and the executable are
tested the Sqlite3 static libs, seem to be ok
Last edited by srvaldez on Dec 14, 2018 12:04, edited 3 times in total.
srvaldez
Posts: 2109
Joined: Sep 25, 2005 21:54

Re: SQLite 3. Any update since 1.05 release 3 years ago?

Postby srvaldez » Dec 14, 2018 5:42

here's sqlite3_test with minor corrections
sqlite3_test.bas

Code: Select all

''
'' SQLite test, translated by Nex/marzec
''



#include once "sqlite3.bi"

const DEFAULT_DATABASE = "sqlite3_test.db"
const DEFAULT_QUERY      = "select * from features"

declare sub showusage( )

declare function callback cdecl _
   ( _
      byval NotUsed as any ptr, _
      byval argc as long, _
      byval argv as zstring ptr ptr, _
      byval colName as zstring ptr ptr _
   ) as long

   dim as sqlite3 ptr db
   dim as zstring ptr errMsg
   dim as string database_name, query

   if( __FB_ARGC__ > 3 ) then
      showusage
      end 1
   end if
   
   if( __FB_ARGC__ = 2 ) then
      database_name = command( 1 )
   else
      database_name = DEFAULT_DATABASE
   end if
   
   if( __FB_ARGC__ = 3 ) then
      query = command( 2 )
   else
      query = DEFAULT_QUERY
   end if
   
   if sqlite3_open( database_name, @db ) then
        print "Can't open database: "; *sqlite3_errmsg( db )
        sqlite3_close( db )
        end 1
   end if
   
   print "Using database: "; database_name
   print

   if sqlite3_exec( db, query, @callback, 0, @errMsg ) <> SQLITE_OK then

        print "SQL error: "; *errMsg
   end if

   sqlite3_close(db)

'':::::
function callback cdecl _
   ( _
      byval NotUsed as any ptr, _
      byval argc as long, _
      byval argv as zstring ptr ptr, _
      byval colName as zstring ptr ptr _
   ) as long
 
   dim as integer i
   dim as string text

   for i = 0 to argc - 1
      text = "NULL"
      if( argv[i] <> 0 ) then
         if *argv[i] <> 0 then
            text = *argv[i]
         end if
      end if
         
      print *colName[i], " = '"; text; "'"
   next
   
   print

   function = 0
   
end function

'':::::
sub showusage( )
   print "Usage: "; command( 0 ); " database ""query"""
end sub
wallyg
Posts: 88
Joined: May 08, 2009 7:08
Location: Tucson Arizona

Re: SQLite 3. Any update since 1.05 release 3 years ago?

Postby wallyg » Dec 14, 2018 8:46

I really appreciate all the help with this project. Thank you for taking the time to generate these files.

Wally
srvaldez
Posts: 2109
Joined: Sep 25, 2005 21:54

Re: SQLite 3. Any update since 1.05 release 3 years ago?

Postby srvaldez » Dec 14, 2018 8:53

I am glad that I was able to help :-)
srvaldez
Posts: 2109
Joined: Sep 25, 2005 21:54

Re: SQLite 3. Any update since 1.05 release 3 years ago?

Postby srvaldez » Dec 14, 2018 9:00

I am a total newbie to databases, so I need help with this
with the help of fbfrog I translated https://www.sqlite.org/src/file/ext/misc/rot13.c to FB but have no idea how to test for correctness

Code: Select all

#include once "sqlite3ext.bi"
SQLITE_EXTENSION_INIT1
''#include once "crt/assert.bi"
#include once "crt/string.bi"

extern "C"

private function rot13(byval c as ubyte) as ubyte
   if (c >= asc("a")) andalso (c <= asc("z")) then
      c += 13
      if c > asc("z") then
         c -= 26
      end if
   elseif (c >= asc("A")) andalso (c <= asc("Z")) then
      c += 13
      if c > asc("Z") then
         c -= 26
      end if
   end if
   return c
end function

private sub rot13func(byval context as sqlite3_context ptr, byval argc as long, byval argv as sqlite3_value ptr ptr)
   dim zIn as const ubyte ptr
   dim nIn as long
   dim zOut as ubyte ptr
   dim zToFree as ubyte ptr = 0
   dim i as long
   dim zTemp(0 to 99) as ubyte
   assert(-(argc = 1))
   if sqlite3_value_type(argv[0]) = SQLITE_NULL then
      return
   end if
   zIn = cptr(const ubyte ptr, sqlite3_value_text(argv[0]))
   nIn = sqlite3_value_bytes(argv[0])
   if nIn < (sizeof(zTemp) - 1) then
      zOut = @zTemp(0)
   else
      zOut = cptr(ubyte ptr,sqlite3_malloc64( nIn+1 ))
      zToFree = zOut
      if zOut = 0 then
         sqlite3_result_error_nomem(context)
         return
      end if
   end if
   for i=0 to nIn-1
      zOut[i] = rot13(zIn[I])
   next
   zOut[i] = 0
   sqlite3_result_text(context, cptr(zstring ptr, zOut), i, SQLITE_TRANSIENT)
   sqlite3_free(zToFree)
end sub

private function rot13CollFunc(byval notUsed as any ptr, byval nKey1 as long, byval pKey1 as const any ptr, byval nKey2 as long, byval pKey2 as const any ptr) as long
   dim zA as const ubyte ptr = cptr(const ubyte ptr, pKey1)
   dim zB as const ubyte ptr = cptr(const ubyte ptr, pKey2)
   dim i as long = 0
   dim x as long
   while i<nKey1 and i<nKey2
      x = clng(rot13(zA[i])) - clng(rot13(zB[i]))
      if x <> 0 then
         return x
      end if
      i+=1
   wend
   return nKey1 - nKey2
end function

private function sqlite3_rot_init(byval db as sqlite3 ptr, byval pzErrMsg as zstring ptr ptr, byval pApi as const sqlite3_api_routines ptr) as long
   dim rc as long = SQLITE_OK
   SQLITE_EXTENSION_INIT2(pApi)
   cast(any ptr, pzErrMsg)=0
   rc = sqlite3_create_function(db, "rot13", 1, SQLITE_UTF8, 0, @rot13func, 0, 0)
   if rc = SQLITE_OK then
      rc = sqlite3_create_collation(db, "rot13", SQLITE_UTF8, 0, @rot13CollFunc)
   end if
   return rc
end function

end extern
dasyar
Posts: 363
Joined: Dec 04, 2008 15:31

Re: SQLite 3. Any update since 1.05 release 3 years ago?

Postby dasyar » Jan 20, 2019 18:35

I just installed FreeBASIC for Linux, and I was trying to play around with sqlite, but when I compile my test program, it comes back with
ld: cannot find -lsqlite3.
Did the Linux version forget to include "sqlite3.bi"? I checked some of the directories for sqlit3.bi, but I could not find it anywhere.

Thanks
badidea
Posts: 1545
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: SQLite 3. Any update since 1.05 release 3 years ago?

Postby badidea » Jan 20, 2019 22:26

dasyar wrote:I just installed FreeBASIC for Linux, and I was trying to play around with sqlite, but when I compile my test program, it comes back with
ld: cannot find -lsqlite3.
Did the Linux version forget to include "sqlite3.bi"? I checked some of the directories for sqlit3.bi, but I could not find it anywhere.

"ld: cannot find ..." means that the shared library is not installed. You can probably install that with your distro's package manager. I my case, Ubuntu, libsqlite3-dev for the 64-bit version.

Return to “Libraries”

Who is online

Users browsing this forum: No registered users and 3 guests