Files
Maven/vendor/modernc.org/sqlite/lib/sqlite_g_000000000000003c.go
T
kami 6c92f85d10 feat(ecosystem): compliant Praxis/Hexis integration + vendored build
Bring the Nexus/Praxis/Hexis integration in line with
MAVEN_ECOSYSTEM_ARCHITECTURE.md:

- Praxis over HTTP: drop the in-process praxis.db open (praxisstore/
  praxistools) and call praxisd's /api/v1/tools/* API via a new praxisClient.
  Honors the "no component reads another's DB" invariant (AC#12).
  PraxisConfig.DBPath -> URL.
- Hexis confirmation gate: mutating capabilities (ReadOnly=false) now park a
  bound pendingHexis confirmation and require a spoken "да" before executing;
  read-only run immediately (AC#7, no auto attention->action).
- Capability safety: >1 verb match is ambiguous -> ask instead of firing the
  first; ambiguous Nexus resolution asks for clarification (AC#2).
- Correlation IDs on Hexis execute, recorded in the cross-service trace.
- Bug: importance arrives as JSON float64 over HTTP, not int.
- Tests: confirm-gate, decline, read-only, and ambiguity paths.

Build: vendor/ bakes in the hexis client (replace-directed at a sibling repo
outside the Docker context); Dockerfile builds from vendor and no longer
`go mod download`s the unreachable replace paths.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-19 20:24:33 +04:00

6700 lines
270 KiB
Go

// Code generated by modernc.org/undup from the per-target sqlite_*.go files; DO NOT EDIT.
//go:build (freebsd && 386) || (freebsd && amd64) || (freebsd && arm) || (freebsd && arm64)
package sqlite3
import (
"unsafe"
"modernc.org/libc"
)
const AT_EMPTY_PATH = 16384
const CLK_TCK = 128
const CLOCKS_PER_SEC = 128
const CLOCK_MONOTONIC = 4
const CLOCK_MONOTONIC_COARSE = 12
const CLOCK_MONOTONIC_FAST = 12
const CLOCK_MONOTONIC_PRECISE = 11
const CLOCK_PROCESS_CPUTIME_ID = 15
const CLOCK_REALTIME_COARSE = 10
const CLOCK_REALTIME_FAST = 10
const CLOCK_REALTIME_PRECISE = 9
const CLOCK_SECOND = 13
const CLOCK_THREAD_CPUTIME_ID = 14
const CLOCK_UPTIME_FAST = 8
const CLOCK_UPTIME_PRECISE = 7
const CLOSE_RANGE_CLOEXEC = 4
const CPUCLOCK_WHICH_PID = 0
const CPUCLOCK_WHICH_TID = 1
type Dl_serinfo = TDl_serinfo
type Dl_serpath = TDl_serpath
const EBADMSG = 89
const ECANCELED = 85
const ECAPMODE = 94
const EDOOFUS = 88
const EILSEQ = 86
const EINTEGRITY = 97
const ELAST = 97
const EMULTIHOP = 90
const ENOATTR = 87
const ENOLINK = 91
const ENOTCAPABLE = 93
const ENOTRECOVERABLE = 95
const EOWNERDEAD = 96
const EPROTO = 92
const FDSYNC = 16777216
const FD_NONE = -200
const FRDAHEAD = 512
const F_ADD_SEALS = 19
const F_CANCEL = 5
const F_DUP2FD = 10
const F_DUP2FD_CLOEXEC = 18
const F_DUPFD_CLOEXEC = 17
const F_GETLK = 11
const F_GET_SEALS = 20
const F_ISUNIONSTACK = 21
const F_KINFO = 22
const F_OGETLK = 7
const F_OSETLK = 8
const F_OSETLKW = 9
const F_RDAHEAD = 16
const F_READAHEAD = 15
const F_SETLK = 12
const F_SETLKW = 13
const F_SETLK_REMOTE = 14
const F_UNLCKSYS = 4
const H4DISC = 7
const INHERIT_COPY = 1
const INHERIT_NONE = 2
const INHERIT_SHARE = 0
const INHERIT_ZERO = 3
const IOCPARM_SHIFT = 13
const KCMP_FILE = 100
const KCMP_FILEOBJ = 101
const KCMP_FILES = 102
const KCMP_SIGHAND = 103
const KCMP_VM = 104
const L_cuserid = 17
const MADV_AUTOSYNC = 7
const MADV_CORE = 9
const MADV_NOCORE = 8
const MADV_NOSYNC = 6
const MADV_PROTECT = 10
const MAP_32BIT = 524288
const MAP_ALIGNED_SUPER = 16777216
const MAP_ALIGNMENT_MASK = 4278190080
const MAP_EXCL = 16384
const MAP_GUARD = 8192
const MAP_NOCORE = 131072
const MAP_NOSYNC = 2048
const MAP_PREFAULT_READ = 262144
const MAP_RESERVED0020 = 32
const MAP_RESERVED0040 = 64
const MAP_RESERVED0100 = 256
const MAP_STACK = 1024
const MFD_HUGE_16GB = 2281701376
const MFD_HUGE_16MB = 1610612736
const MFD_HUGE_1GB = 2013265920
const MFD_HUGE_1MB = 1342177280
const MFD_HUGE_256MB = 1879048192
const MFD_HUGE_2GB = 2080374784
const MFD_HUGE_2MB = 1409286144
const MFD_HUGE_32MB = 1677721600
const MFD_HUGE_512KB = 1275068416
const MFD_HUGE_512MB = 1946157056
const MFD_HUGE_64KB = 1073741824
const MFD_HUGE_8MB = 1543503872
const MFD_HUGE_MASK = 4227858432
const MFD_HUGE_SHIFT = 26
const MINCORE_SUPER = 96
const MS_SYNC = 0
const NETGRAPHDISC = 6
const O_CLOEXEC = 1048576
const O_DSYNC = 16777216
const O_EMPTY_PATH = 33554432
const O_EXEC = 262144
const O_PATH = 4194304
const O_RESOLVE_BENEATH = 8388608
const O_SEARCH = 262144
const O_TTY_INIT = 524288
const O_VERIFY = 2097152
const RFCENVG = 2048
const RFCFDG = 4096
const RFCNAMEG = 1024
const RFENVG = 2
const RFFDG = 4
const RFFLAGS = 2416930932
const RFHIGHPID = 262144
const RFKERNELONLY = 268828672
const RFLINUXTHPN = 65536
const RFMEM = 32
const RFNAMEG = 1
const RFNOTEG = 8
const RFNOWAIT = 64
const RFPPWAIT = 2147483648
const RFPROC = 16
const RFPROCDESC = 268435456
const RFSIGSHARE = 16384
const RFSPAWN = 2147483648
const RFSTOPPED = 131072
const RFTHREAD = 8192
const RFTSIGMASK = 255
const RFTSIGSHIFT = 20
const RFTSIGZMB = 524288
const RTLD_DEEPBIND = 16384
const RTLD_DI_MAX = 6
const RTLD_DI_ORIGIN = 6
const RTLD_DI_SERINFO = 4
const RTLD_DI_SERINFOSIZE = 5
const RTLD_MODEMASK = 3
const SBT_MAX = 9223372036854775807
const SFBSD_NAMEDATTR = 1
const SHM_ALLOW_SEALING = 1
const SHM_GROW_ON_WRITE = 2
const SHM_LARGEPAGE = 4
const SHM_LARGEPAGE_ALLOC_DEFAULT = 0
const SHM_LARGEPAGE_ALLOC_HARD = 2
const SHM_LARGEPAGE_ALLOC_NOWAIT = 1
const SHM_RENAME_EXCHANGE = 2
const SHM_RENAME_NOREPLACE = 1
const SPACECTL_DEALLOC = 1
const SPACECTL_F_SUPPORTED = 0
const SWAPOFF_FORCE = 1
type TDl_serinfo = struct {
Fdls_size Tsize_t
Fdls_cnt uint32
Fdls_serpath [1]TDl_serpath
}
type TDl_serpath = struct {
Fdls_name uintptr
Fdls_flags uint32
}
const TIME_MONOTONIC = 2
const TIOCM_DCD = 64
type T_RuneEntry = struct {
F__min t__rune_t
F__max t__rune_t
F__map t__rune_t
F__types uintptr
}
type Taccmode_t = int32
type Tc_caddr_t = uintptr
type Tclockinfo = struct {
Fhz int32
Ftick int32
Fspare int32
Fstathz int32
Fprofhz int32
}
type Tconstraint_handler_t = uintptr
type Tcpulevel_t = int32
type Tcpusetid_t = int32
type Tcpuwhich_t = int32
type Tdl_serinfo = TDl_serinfo
type Tdl_serpath = TDl_serpath
type Tdlfunc_t = uintptr
type Tfflags_t = uint32
type Tfiodgname_arg = struct {
Flen1 int32
Fbuf uintptr
}
type Tid_t = int64
type Tkpaddr_t = uint64
type Tksize_t = uint64
type Tkssize_t = int64
type Tkvaddr_t = uint64
type Tmqd_t = uintptr
type Tpthread_addr_t = uintptr
type Tpthread_attr_t = uintptr
type Tpthread_barrier_t = uintptr
type Tpthread_barrierattr_t = uintptr
type Tpthread_cond_t = uintptr
type Tpthread_condattr_t = uintptr
type Tpthread_mutex_t = uintptr
type Tpthread_mutexattr_t = uintptr
type Tpthread_once = struct {
Fstate int32
Fmutex Tpthread_mutex_t
}
type Tpthread_once_t = struct {
Fstate int32
Fmutex Tpthread_mutex_t
}
type Tpthread_rwlock_t = uintptr
type Tpthread_rwlockattr_t = uintptr
type Tpthread_spinlock_t = uintptr
type Tpthread_startroutine_t = uintptr
type Trlim_t = int64
type Trman_res_t = uint64
type Tsbintime_t = int64
type Tshm_largepage_conf = struct {
Fpsind int32
Falloc_policy int32
Fpad [10]int32
}
type Tvm_ooffset_t = uint64
type Tvm_pindex_t = uint64
const UF_ARCHIVE = 2048
const UF_NOUNLINK = 16
const UF_OFFLINE = 512
const UF_READONLY = 4096
const UF_REPARSE = 1024
const UF_SPARSE = 256
const UF_SYSTEM = 128
// C documentation
//
// /*
// ** Move an existing blob handle to point to a different row of the same
// ** database table.
// **
// ** If an error occurs, or if the specified row does not exist or does not
// ** contain a blob or text value, then an error code is returned and the
// ** database handle error code and message set. If this happens, then all
// ** subsequent calls to sqlite3_blob_xxx() functions (except blob_close())
// ** immediately return SQLITE_ABORT.
// */
func Xsqlite3_blob_reopen(tls *libc.TLS, pBlob uintptr, iRow Tsqlite3_int64) (r int32) {
bp := tls.Alloc(32)
defer tls.Free(32)
var db, p, v1 uintptr
var rc int32
var _ /* zErr at bp+0 */ uintptr
_, _, _, _ = db, p, rc, v1
p = pBlob
if p == uintptr(0) {
return _sqlite3MisuseError(tls, int32(106500))
}
db = (*TIncrblob)(unsafe.Pointer(p)).Fdb
Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex)
if (*TIncrblob)(unsafe.Pointer(p)).FpStmt == uintptr(0) {
/* If there is no statement handle, then the blob-handle has
** already been invalidated. Return SQLITE_ABORT in this case.
*/
rc = int32(SQLITE_ABORT)
} else {
(*TVdbe)(unsafe.Pointer((*TIncrblob)(unsafe.Pointer(p)).FpStmt)).Frc = SQLITE_OK
rc = _blobSeekToRow(tls, p, iRow, bp)
if rc != SQLITE_OK {
if **(**uintptr)(__ccgo_up(bp)) != 0 {
v1 = __ccgo_ts + 3942
} else {
v1 = libc.UintptrFromInt32(0)
}
_sqlite3ErrorWithMsg(tls, db, rc, v1, libc.VaList(bp+16, **(**uintptr)(__ccgo_up(bp))))
_sqlite3DbFree(tls, db, **(**uintptr)(__ccgo_up(bp)))
}
}
rc = _sqlite3ApiExit(tls, db, rc)
Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex)
return rc
}
/************** End of vdbeblob.c ********************************************/
/************** Begin file vdbesort.c ****************************************/
/*
** 2011-07-09
**
** 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 file contains code for the VdbeSorter object, used in concert with
** a VdbeCursor to sort large numbers of keys for CREATE INDEX statements
** or by SELECT statements with ORDER BY clauses that cannot be satisfied
** using indexes and without LIMIT clauses.
**
** The VdbeSorter object implements a multi-threaded external merge sort
** algorithm that is efficient even if the number of elements being sorted
** exceeds the available memory.
**
** Here is the (internal, non-API) interface between this module and the
** rest of the SQLite system:
**
** sqlite3VdbeSorterInit() Create a new VdbeSorter object.
**
** sqlite3VdbeSorterWrite() Add a single new row to the VdbeSorter
** object. The row is a binary blob in the
** OP_MakeRecord format that contains both
** the ORDER BY key columns and result columns
** in the case of a SELECT w/ ORDER BY, or
** the complete record for an index entry
** in the case of a CREATE INDEX.
**
** sqlite3VdbeSorterRewind() Sort all content previously added.
** Position the read cursor on the
** first sorted element.
**
** sqlite3VdbeSorterNext() Advance the read cursor to the next sorted
** element.
**
** sqlite3VdbeSorterRowkey() Return the complete binary blob for the
** row currently under the read cursor.
**
** sqlite3VdbeSorterCompare() Compare the binary blob for the row
** currently under the read cursor against
** another binary blob X and report if
** X is strictly less than the read cursor.
** Used to enforce uniqueness in a
** CREATE UNIQUE INDEX statement.
**
** sqlite3VdbeSorterClose() Close the VdbeSorter object and reclaim
** all resources.
**
** sqlite3VdbeSorterReset() Refurbish the VdbeSorter for reuse. This
** is like Close() followed by Init() only
** much faster.
**
** The interfaces above must be called in a particular order. Write() can
** only occur in between Init()/Reset() and Rewind(). Next(), Rowkey(), and
** Compare() can only occur in between Rewind() and Close()/Reset(). i.e.
**
** Init()
** for each record: Write()
** Rewind()
** Rowkey()/Compare()
** Next()
** Close()
**
** Algorithm:
**
** Records passed to the sorter via calls to Write() are initially held
** unsorted in main memory. Assuming the amount of memory used never exceeds
** a threshold, when Rewind() is called the set of records is sorted using
** an in-memory merge sort. In this case, no temporary files are required
** and subsequent calls to Rowkey(), Next() and Compare() read records
** directly from main memory.
**
** If the amount of space used to store records in main memory exceeds the
** threshold, then the set of records currently in memory are sorted and
** written to a temporary file in "Packed Memory Array" (PMA) format.
** A PMA created at this point is known as a "level-0 PMA". Higher levels
** of PMAs may be created by merging existing PMAs together - for example
** merging two or more level-0 PMAs together creates a level-1 PMA.
**
** The threshold for the amount of main memory to use before flushing
** records to a PMA is roughly the same as the limit configured for the
** page-cache of the main database. Specifically, the threshold is set to
** the value returned by "PRAGMA main.page_size" multiplied by
** that returned by "PRAGMA main.cache_size", in bytes.
**
** If the sorter is running in single-threaded mode, then all PMAs generated
** are appended to a single temporary file. Or, if the sorter is running in
** multi-threaded mode then up to (N+1) temporary files may be opened, where
** N is the configured number of worker threads. In this case, instead of
** sorting the records and writing the PMA to a temporary file itself, the
** calling thread usually launches a worker thread to do so. Except, if
** there are already N worker threads running, the main thread does the work
** itself.
**
** The sorter is running in multi-threaded mode if (a) the library was built
** with pre-processor symbol SQLITE_MAX_WORKER_THREADS set to a value greater
** than zero, and (b) worker threads have been enabled at runtime by calling
** "PRAGMA threads=N" with some value of N greater than 0.
**
** When Rewind() is called, any data remaining in memory is flushed to a
** final PMA. So at this point the data is stored in some number of sorted
** PMAs within temporary files on disk.
**
** If there are fewer than SORTER_MAX_MERGE_COUNT PMAs in total and the
** sorter is running in single-threaded mode, then these PMAs are merged
** incrementally as keys are retrieved from the sorter by the VDBE. The
** MergeEngine object, described in further detail below, performs this
** merge.
**
** Or, if running in multi-threaded mode, then a background thread is
** launched to merge the existing PMAs. Once the background thread has
** merged T bytes of data into a single sorted PMA, the main thread
** begins reading keys from that PMA while the background thread proceeds
** with merging the next T bytes of data. And so on.
**
** Parameter T is set to half the value of the memory threshold used
** by Write() above to determine when to create a new PMA.
**
** If there are more than SORTER_MAX_MERGE_COUNT PMAs in total when
** Rewind() is called, then a hierarchy of incremental-merges is used.
** First, T bytes of data from the first SORTER_MAX_MERGE_COUNT PMAs on
** disk are merged together. Then T bytes of data from the second set, and
** so on, such that no operation ever merges more than SORTER_MAX_MERGE_COUNT
** PMAs at a time. This done is to improve locality.
**
** If running in multi-threaded mode and there are more than
** SORTER_MAX_MERGE_COUNT PMAs on disk when Rewind() is called, then more
** than one background thread may be created. Specifically, there may be
** one background thread for each temporary file on disk, and one background
** thread to merge the output of each of the others to a single PMA for
** the main thread to read from.
*/
/* #include "sqliteInt.h" */
/* #include "vdbeInt.h" */
/*
** If SQLITE_DEBUG_SORTER_THREADS is defined, this module outputs various
** messages to stderr that may be helpful in understanding the performance
** characteristics of the sorter in multi-threaded mode.
*/
/*
** Hard-coded maximum amount of data to accumulate in memory before flushing
** to a level 0 PMA. The purpose of this limit is to prevent various integer
** overflows. 512MiB.
*/
// C documentation
//
// /*
// ** Open a new database handle.
// */
func Xsqlite3_open16(tls *libc.TLS, zFilename uintptr, ppDb uintptr) (r int32) {
var pVal, zFilename8 uintptr
var rc int32
var v1 Tu8
_, _, _, _ = pVal, rc, zFilename8, v1
**(**uintptr)(__ccgo_up(ppDb)) = uintptr(0)
rc = Xsqlite3_initialize(tls)
if rc != 0 {
return rc
}
if zFilename == uintptr(0) {
zFilename = __ccgo_ts + 26266
}
pVal = _sqlite3ValueNew(tls, uintptr(0))
_sqlite3ValueSetStr(tls, pVal, -int32(1), zFilename, uint8(SQLITE_UTF16LE), libc.UintptrFromInt32(0))
zFilename8 = _sqlite3ValueText(tls, pVal, uint8(SQLITE_UTF8))
if zFilename8 != 0 {
rc = _openDatabase(tls, zFilename8, ppDb, libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_OPEN_READWRITE)|libc.Int32FromInt32(SQLITE_OPEN_CREATE)), uintptr(0))
if rc == SQLITE_OK && !(libc.Int32FromUint16((*TSchema)(unsafe.Pointer((**(**TDb)(__ccgo_up((*Tsqlite3)(unsafe.Pointer(**(**uintptr)(__ccgo_up(ppDb)))).FaDb))).FpSchema)).FschemaFlags)&libc.Int32FromInt32(DB_SchemaLoaded) == libc.Int32FromInt32(DB_SchemaLoaded)) {
v1 = libc.Uint8FromInt32(SQLITE_UTF16LE)
(*Tsqlite3)(unsafe.Pointer(**(**uintptr)(__ccgo_up(ppDb)))).Fenc = v1
(*TSchema)(unsafe.Pointer((**(**TDb)(__ccgo_up((*Tsqlite3)(unsafe.Pointer(**(**uintptr)(__ccgo_up(ppDb)))).FaDb))).FpSchema)).Fenc = v1
}
} else {
rc = int32(SQLITE_NOMEM)
}
_sqlite3ValueFree(tls, pVal)
return rc & int32(0xff)
}
// C documentation
//
// /*
// ** Declare that a function has been overloaded by a virtual table.
// **
// ** If the function already exists as a regular global function, then
// ** this routine is a no-op. If the function does not exist, then create
// ** a new one that always throws a run-time error.
// **
// ** When virtual tables intend to provide an overloaded function, they
// ** should call this routine to make sure the global function exists.
// ** A global function must exist in order for name resolution to work
// ** properly.
// */
func Xsqlite3_overload_function(tls *libc.TLS, db uintptr, zName uintptr, nArg int32) (r int32) {
bp := tls.Alloc(16)
defer tls.Free(16)
var rc int32
var zCopy uintptr
_, _ = rc, zCopy
Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex)
rc = libc.BoolInt32(_sqlite3FindFunction(tls, db, zName, nArg, uint8(SQLITE_UTF8), uint8(0)) != uintptr(0))
Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex)
if rc != 0 {
return SQLITE_OK
}
zCopy = Xsqlite3_mprintf(tls, __ccgo_ts+3942, libc.VaList(bp+8, zName))
if zCopy == uintptr(0) {
return int32(SQLITE_NOMEM)
}
return Xsqlite3_create_function_v2(tls, db, zName, nArg, int32(SQLITE_UTF8), zCopy, __ccgo_fp(_sqlite3InvalidFunction), uintptr(0), uintptr(0), __ccgo_fp(Xsqlite3_free))
}
// C documentation
//
// /* Force an SQLITE_TOOBIG error. */
func Xsqlite3_result_error_toobig(tls *libc.TLS, pCtx uintptr) {
(*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError = int32(SQLITE_TOOBIG)
_sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, __ccgo_ts+5592, int64(-int32(1)), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0))
}
// C documentation
//
// /*
// ** Set the error code and error message associated with the database handle.
// **
// ** This routine is intended to be called by outside extensions (ex: the
// ** Session extension). Internal logic should invoke sqlite3Error() or
// ** sqlite3ErrorWithMsg() directly.
// */
func Xsqlite3_set_errmsg(tls *libc.TLS, db uintptr, errcode int32, zMsg uintptr) (r int32) {
bp := tls.Alloc(16)
defer tls.Free(16)
var rc int32
_ = rc
rc = SQLITE_OK
if !(_sqlite3SafetyCheckOk(tls, db) != 0) {
return _sqlite3MisuseError(tls, int32(190121))
}
Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex)
if zMsg != 0 {
_sqlite3ErrorWithMsg(tls, db, errcode, __ccgo_ts+3942, libc.VaList(bp+8, zMsg))
} else {
_sqlite3Error(tls, db, errcode)
}
rc = _sqlite3ApiExit(tls, db, rc)
Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex)
return rc
}
// C documentation
//
// /************** End of stmt.c ************************************************/
// /* Return the source-id for this library */
func Xsqlite3_sourceid(tls *libc.TLS) (r uintptr) {
return __ccgo_ts + 42537
}
// C documentation
//
// /*
// ** Register an unlock-notify callback.
// **
// ** This is called after connection "db" has attempted some operation
// ** but has received an SQLITE_LOCKED error because another connection
// ** (call it pOther) in the same process was busy using the same shared
// ** cache. pOther is found by looking at db->pBlockingConnection.
// **
// ** If there is no blocking connection, the callback is invoked immediately,
// ** before this routine returns.
// **
// ** If pOther is already blocked on db, then report SQLITE_LOCKED, to indicate
// ** a deadlock.
// **
// ** Otherwise, make arrangements to invoke xNotify when pOther drops
// ** its locks.
// **
// ** Each call to this routine overrides any prior callbacks registered
// ** on the same "db". If xNotify==0 then any prior callbacks are immediately
// ** cancelled.
// */
func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, __ccgo_fp_xNotify uintptr, _pArg uintptr) (r int32) {
bp := tls.Alloc(16)
defer tls.Free(16)
*(*uintptr)(unsafe.Pointer(bp)) = _pArg
var p, v2 uintptr
var rc int32
_, _, _ = p, rc, v2
rc = SQLITE_OK
Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex)
_enterMutex(tls)
if __ccgo_fp_xNotify == uintptr(0) {
_removeFromBlockedList(tls, db)
(*Tsqlite3)(unsafe.Pointer(db)).FpBlockingConnection = uintptr(0)
(*Tsqlite3)(unsafe.Pointer(db)).FpUnlockConnection = uintptr(0)
(*Tsqlite3)(unsafe.Pointer(db)).FxUnlockNotify = uintptr(0)
(*Tsqlite3)(unsafe.Pointer(db)).FpUnlockArg = uintptr(0)
} else {
if uintptr(0) == (*Tsqlite3)(unsafe.Pointer(db)).FpBlockingConnection {
/* The blocking transaction has been concluded. Or there never was a
** blocking transaction. In either case, invoke the notify callback
** immediately.
*/
(*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{__ccgo_fp_xNotify})))(tls, bp, int32(1))
} else {
p = (*Tsqlite3)(unsafe.Pointer(db)).FpBlockingConnection
for {
if !(p != 0 && p != db) {
break
}
goto _1
_1:
;
p = (*Tsqlite3)(unsafe.Pointer(p)).FpUnlockConnection
}
if p != 0 {
rc = int32(SQLITE_LOCKED) /* Deadlock detected. */
} else {
(*Tsqlite3)(unsafe.Pointer(db)).FpUnlockConnection = (*Tsqlite3)(unsafe.Pointer(db)).FpBlockingConnection
(*Tsqlite3)(unsafe.Pointer(db)).FxUnlockNotify = __ccgo_fp_xNotify
(*Tsqlite3)(unsafe.Pointer(db)).FpUnlockArg = **(**uintptr)(__ccgo_up(bp))
_removeFromBlockedList(tls, db)
_addToBlockedList(tls, db)
}
}
}
_leaveMutex(tls)
if rc != 0 {
v2 = __ccgo_ts + 26374
} else {
v2 = uintptr(0)
}
_sqlite3ErrorWithMsg(tls, db, rc, v2, 0)
Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex)
return rc
}
// C documentation
//
// /*
// ** Provide a database schema to the changegroup object.
// */
func Xsqlite3changegroup_schema(tls *libc.TLS, pGrp uintptr, db uintptr, zDb uintptr) (r int32) {
bp := tls.Alloc(16)
defer tls.Free(16)
var rc int32
_ = rc
rc = SQLITE_OK
if (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList != 0 || (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fdb != 0 {
/* Cannot add a schema after one or more calls to sqlite3changegroup_add(),
** or after sqlite3changegroup_schema() has already been called. */
rc = int32(SQLITE_MISUSE)
} else {
(*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FzDb = Xsqlite3_mprintf(tls, __ccgo_ts+3942, libc.VaList(bp+8, zDb))
if (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FzDb == uintptr(0) {
rc = int32(SQLITE_NOMEM)
} else {
(*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fdb = db
}
}
return rc
}
func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) (r int32) {
var pDb, zBegin, v1 uintptr
var rc int32
_, _, _, _ = pDb, rc, zBegin, v1
rc = (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc
if rc == int32(SQLITE_DONE) {
return SQLITE_OK
}
if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) {
if rc == SQLITE_OK {
rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+16120, uintptr(0), uintptr(0), uintptr(0))
}
}
/* Sync the db file */
if rc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_CKPT) {
pDb = (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpReal
rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(pDb)).FpMethods)).FxSync})))(tls, pDb, int32(SQLITE_SYNC_NORMAL))
}
(*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc
_rbuSaveState(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage)
rc = (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc
if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) {
if rc == SQLITE_OK {
rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+16120, uintptr(0), uintptr(0), uintptr(0))
}
if rc == SQLITE_OK {
if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) {
v1 = __ccgo_ts + 16105
} else {
v1 = __ccgo_ts + 34634
}
zBegin = v1
rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, zBegin, uintptr(0), uintptr(0), uintptr(0))
}
if rc == SQLITE_OK {
rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+34634, uintptr(0), uintptr(0), uintptr(0))
}
}
(*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc
return rc
}
const _CTYPE_N = 4194304
const _CurrentRuneLocale = 0
const _MADV_DONTNEED = 4
const _MADV_NORMAL = 0
const _MADV_RANDOM = 1
const _MADV_SEQUENTIAL = 2
const _MADV_WILLNEED = 3
const _NFDBITS = 0
const _PC_ACL_EXTENDED = 59
const _PC_ACL_NFS4 = 64
const _PC_ACL_PATH_MAX = 60
const _PC_ALLOC_SIZE_MIN = 10
const _PC_ASYNC_IO = 53
const _PC_CAP_PRESENT = 61
const _PC_DEALLOC_PRESENT = 65
const _PC_FILESIZEBITS = 12
const _PC_INF_PRESENT = 62
const _PC_MAC_PRESENT = 63
const _PC_MIN_HOLE_SIZE = 21
const _PC_PRIO_IO = 54
const _PC_SYMLINK_MAX = 18
const _PC_SYNC_IO = 55
const _POSIX2_SW_DEV = -1
const _POSIX2_VERSION = 199212
const _POSIX_ADVISORY_INFO = 200112
const _POSIX_PRIORITY_SCHEDULING = 0
const _POSIX_REALTIME_SIGNALS = 200112
const _POSIX_SHARED_MEMORY_OBJECTS = 200112
const _POSIX_THREAD_PRIORITY_SCHEDULING = 200112
const _POSIX_THREAD_PRIO_INHERIT = 200112
const _POSIX_THREAD_SAFE_FUNCTIONS = -1
const _PROT_ALL = 7
const _PROT_MAX_SHIFT = 16
const _RUNE_MAGIC_1 = "RuneMagi"
type _RuneLocale = T_RuneLocale
/*
* POSIX.1-2001 specifies _tolower() and _toupper() to be macros equivalent to
* tolower() and toupper() respectively, minus extra checking to ensure that
* the argument is a lower or uppercase letter respectively. We've chosen to
* implement these macros with the same error checking as tolower() and
* toupper() since this doesn't violate the specification itself, only its
* intent. We purposely leave _tolower() and _toupper() undocumented to
* discourage their use.
*
* XXX isascii() and toascii() should similarly be undocumented.
*/
/*
** Use a macro to replace memcpy() if compiled with SQLITE_INLINE_MEMCPY.
** This allows better measurements of where memcpy() is used when running
** cachegrind. But this macro version of memcpy() is very slow so it
** should not be used in production. This is a performance measurement
** hack only.
*/
/*
** If compiling for a processor that lacks floating point support,
** substitute integer for floating-point
*/
/*
** OMIT_TEMPDB is set to 1 if SQLITE_OMIT_TEMPDB is defined, or 0
** afterward. Having this macro allows us to cause the C compiler
** to omit code used by TEMP tables without messy #ifndef statements.
*/
/*
** The "file format" number is an integer that is incremented whenever
** the VDBE-level file format changes. The following macros define the
** the default file format for new databases and the maximum file format
** that the library can read.
*/
/*
** Determine whether triggers are recursive by default. This can be
** changed at run-time using a pragma.
*/
/*
** Provide a default value for SQLITE_TEMP_STORE in case it is not specified
** on the command-line
*/
/*
** If no value has been provided for SQLITE_MAX_WORKER_THREADS, or if
** SQLITE_TEMP_STORE is set to 3 (never use temporary files), set it
** to zero.
*/
/*
** The default initial allocation for the pagecache when using separate
** pagecaches for each database connection. A positive number is the
** number of pages. A negative number N translations means that a buffer
** of -1024*N bytes is allocated and used for as many pages as it will hold.
**
** The default value of "20" was chosen to minimize the run-time of the
** speedtest1 test program with options: --shrink-memory --reprepare
*/
/*
** Default value for the SQLITE_CONFIG_SORTERREF_SIZE option.
*/
/*
** The compile-time options SQLITE_MMAP_READWRITE and
** SQLITE_ENABLE_BATCH_ATOMIC_WRITE are not compatible with one another.
** You must choose one or the other (or neither) but not both.
*/
/*
** GCC does not define the offsetof() macro so we'll have to do it
** ourselves.
*/
/*
** sizeof64() is like sizeof(), but always returns a 64-bit value, even
** on 32-bit builds. This can help to avoid overflow by ensuring 64-bit
** arithmetic is used consistently in both 32-bit and 64-bit builds.
*/
/*
** Work around C99 "flex-array" syntax for pre-C99 compilers, so as
** to avoid complaints from -fsanitize=strict-bounds.
*/
/*
** Macros to compute minimum and maximum of two numbers.
*/
/*
** Swap two objects of type TYPE.
*/
/*
** Check to see if this machine uses EBCDIC. (Yes, believe it or
** not, there are still machines out there that use EBCDIC.)
*/
const _SC_CPUSET_SIZE = 122
const _SC_MAPPED_FILES = 29
const _SC_PAGESIZE = 47
const _SC_PAGE_SIZE = 47
const _SC_XOPEN_XCU_VERSION = 117
const _SIG_MAXSIG = 128
const _SIG_WORDS = 4
const _V6_ILP32_OFFBIG = 0
const _V6_LP64_OFF64 = 0
const _V6_LPBIG_OFFBIG = -1
const _XLOCALE_INLINE = 0
const _XLOCALE_RUN_FUNCTIONS_DEFINED = 1
const _XOPEN_CRYPT = -1
const __CC_SUPPORTS___INLINE = 1
const __CHAR_BIT = 8
const __EXT1_VISIBLE = 1
const __INT_MAX = 2147483647
const __INT_MIN = -2147483648
const __ISO_C_VISIBLE = 2023
const __KPRINTF_ATTRIBUTE__ = 1
const __LLONG_MAX = 9223372036854775807
const __LLONG_MIN = -9223372036854775808
const __OFF_MAX = 9223372036854775807
const __OFF_MIN = -9223372036854775808
const __QUAD_MAX = 9223372036854775807
const __QUAD_MIN = -9223372036854775808
const __S2OAP = 1
const __SCHAR_MAX = 127
const __SCHAR_MIN = -128
const __SHRT_MAX = 32767
const __SHRT_MIN = -32768
const __STDC_MB_MIGHT_NEQ_WC__ = 1
const __UCHAR_MAX = 255
const __UINT_MAX = 4294967295
const __ULLONG_MAX = 18446744073709551615
const __UQUAD_MAX = 18446744073709551615
const __USHRT_MAX = 65535
const __VERSION__ = "FreeBSD Clang 19.1.7 (https://github.com/llvm/llvm-project.git llvmorg-19.1.7-0-gcd708029e0b2)"
const __WORD_BIT = 32
const __XSI_VISIBLE = 800
type ___wchar_t = T___wchar_t
var __ccgo_ts1 = "ATOMIC_INTRINSICS=1\x00COMPILER=clang-19.1.7\x00DEFAULT_AUTOVACUUM\x00DEFAULT_CACHE_SIZE=-2000\x00DEFAULT_FILE_FORMAT=4\x00DEFAULT_JOURNAL_SIZE_LIMIT=-1\x00DEFAULT_MEMSTATUS=0\x00DEFAULT_MMAP_SIZE=0\x00DEFAULT_PAGE_SIZE=4096\x00DEFAULT_PCACHE_INITSZ=20\x00DEFAULT_RECURSIVE_TRIGGERS\x00DEFAULT_SECTOR_SIZE=4096\x00DEFAULT_SYNCHRONOUS=2\x00DEFAULT_WAL_AUTOCHECKPOINT=1000\x00DEFAULT_WAL_SYNCHRONOUS=2\x00DEFAULT_WORKER_THREADS=0\x00DIRECT_OVERFLOW_READ\x00DISABLE_INTRINSIC\x00ENABLE_COLUMN_METADATA\x00ENABLE_DBPAGE_VTAB\x00ENABLE_DBSTAT_VTAB\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_MATH_FUNCTIONS\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MALLOC_SOFT_LIMIT=1024\x00MAX_ATTACHED=10\x00MAX_COLUMN=2000\x00MAX_COMPOUND_SELECT=500\x00MAX_DEFAULT_PAGE_SIZE=8192\x00MAX_EXPR_DEPTH=1000\x00MAX_FUNCTION_ARG=1000\x00MAX_LENGTH=1000000000\x00MAX_LIKE_PATTERN_LENGTH=50000\x00MAX_MMAP_SIZE=0x7fff0000\x00MAX_PAGE_COUNT=0xfffffffe\x00MAX_PAGE_SIZE=65536\x00MAX_SQL_LENGTH=1000000000\x00MAX_TRIGGER_DEPTH=1000\x00MAX_VARIABLE_NUMBER=32766\x00MAX_VDBE_OP=250000000\x00MAX_WORKER_THREADS=8\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00TEMP_STORE=1\x00THREADSAFE=1\x00ANY\x00BLOB\x00INT\x00INTEGER\x00REAL\x00TEXT\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00subsec\x00subsecond\x00local time unavailable\x00auto\x00ceiling\x00floor\x00julianday\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00month\x00year\x00day\x0040f\x0050f\x0040f-20a-20d\x0050f-20a-20d\x00%02d\x00%2d\x00%06.3f\x00%04d-%02d-%02d\x00%04d\x00%03d\x00%.16g\x00PM\x00pm\x00AM\x00am\x00%02d:%02d\x00%.3f\x00%lld\x00%02d:%02d:%02d\x00%c%04d-%02d-%02d %02d:%02d:%06.3f\x00date\x00time\x00datetime\x00strftime\x00timediff\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x00out of memory\x00%\x00null\x00NaN\x00-Inf\x00\x00NULL\x00(NULL)\x00unistr('\x000123456789abcdef\x00.\x00(join-%u)\x00%u-ROW VALUES CLAUSE\x00(subquery-%u)\x00unrecognized token: \"%s\"\x00922337203685477580\x00+- \n\t0123456789\x000\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Init\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00IfNot\x00IsType\x00Not\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSizeBetween\x00SorterSort\x00Sort\x00Rewind\x00IfEmpty\x00SorterNext\x00Prev\x00Next\x00IdxLE\x00IdxGT\x00Or\x00And\x00IdxLT\x00IdxGE\x00IFindKey\x00RowSetRead\x00RowSetTest\x00Program\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00FkIfZero\x00IfPos\x00IfNotZero\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Filter\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00BeginSubrtn\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00FkCheck\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00TypeCheck\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00ReopenIdx\x00OpenRead\x00BitNot\x00OpenWrite\x00OpenDup\x00String8\x00OpenAutoindex\x00OpenEphemeral\x00SorterOpen\x00SequenceTest\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00Real\x00DropIndex\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VCheck\x00VInitIn\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00ClrSubtype\x00GetSubtype\x00SetSubtype\x00FilterAdd\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00psow\x00unix-excl\x00%s.lock\x00/var/tmp\x00/usr/tmp\x00/tmp\x00SQLITE_TMPDIR\x00TMPDIR\x00%s/etilqs_%llx%c\x00modeof\x00fsync\x00/dev/urandom\x00unix\x00unix-none\x00unix-dotfile\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00BEGIN IMMEDIATE; COMMIT;\x00ATTACH x AS %Q\x00-mj\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00PRAGMA table_list\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00:memory:\x00@ \x00\n\x00invalid page number %u\x002nd reference to page %u\x00Failed to read ptrmap key=%u\x00Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)\x00failed to get page %u\x00freelist leaf count too big on page %u\x00size\x00overflow list length\x00%s is %u but should be %u\x00Tree %u page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00Tree %u page %u cell %u: \x00Tree %u page %u right child: \x00Offset %u out of range %u..%u\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %u bytes reported as %u on page %u\x00Freelist: \x00max rootpage (%u) disagrees with header (%u)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %u: never used\x00Page %u: pointer map referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00.0\x00%!.*g\x00-\x00%s%s\x00k(%d\x00BINARY\x00B\x00N.\x00,%s%s%s\x00)\x00?\x008\x0016LE\x0016BE\x00%.18s-%s\x00%s(%d)\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00subrtnsig:%d,%s\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00bind on a busy prepared statement: [%s]\x00-- \x00%!.15g\x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00/* %s */ \x00/* unknown trigger */ \x00statement aborts at %d: %s; [%s%s]\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00%s constraint failed\x00%z: %s\x00cannot store %s value in %s column %s.%s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00into\x00out of\x00cannot change %s wal mode from within a transaction\x00database table is locked: %s\x00ValueList\x00-- %s\x00real\x00integer\x00cannot open value of type %s\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open table with generated columns: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00sqlite_\x00sqlite_temp_master\x00sqlite_temp_schema\x00sqlite_schema\x00main\x00*\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00coalesce\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: \"%s\" - should this be a string literal in single-quotes?\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00the \".\" operator\x00second argument to %#T() must be a constant between 0.0 and 1.0\x00not authorized to use function: %#T\x00non-deterministic functions\x00%#T() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %#T()\x00no such function: %#T\x00wrong number of arguments to function %#T()\x00FILTER may not be used with non-aggregate %#T()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00HAVING clause on a non-aggregate query\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x00s\x00IN(...) element has %d term%s - expected %d\x00too many arguments on function %T\x00ORDER BY may not be used with non-aggregate %#T()\x00unsafe use of %#T()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00true\x00false\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00CORRELATED \x00%sLIST SUBQUERY %d\x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x000x\x00hex literal too big: %s%#T\x00generated column loop on \"%s\"\x00blob\x00text\x00numeric\x00flexnum\x00none\x00misuse of aggregate: %#T()\x00unknown function: %#T()\x00RAISE() may only be used within a trigger-program\x00more than %d aggregate terms\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00SELECT CASE WHEN quick_check GLOB 'CHECK*' THEN raise(ABORT,'CHECK constraint failed') WHEN quick_check GLOB 'non-* value in*' THEN raise(ABORT,'type mismatch on DEFAULT') ELSE raise(ABORT,'NOT NULL constraint failed') END FROM pragma_quick_check(%Q,%Q) WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*' OR quick_check GLOB 'non-* value in*'\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00rename columns of\x00drop column from\x00edit constraints of\x00cannot %s %s \"%s\"\x00no such column: \"%T\"\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q)\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00 \x00error in %s %s%s%s: %s\x00CREATE \x00\"%w\" \x00%Q%s\x00%.*s%s\x00PRIMARY KEY\x00cannot drop %s column: \"%s\"\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00constraint may not be dropped: %s\x00no such constraint: %s\x00%.*s%s%s\x00%.*s, %s%s\x00%.*s %s%s\x00no such column: %s\x00%Q\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_constraint(sql, %s) WHERE type='table' AND tbl_name=%Q COLLATE nocase\x00%.*s\x00SELECT sqlite_fail('constraint failed', %d) FROM %Q.%Q AS x WHERE x.%.*s IS NULL\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_add_constraint(sqlite_drop_constraint(sql, %d), %.*Q, %d) WHERE type='table' AND tbl_name=%Q COLLATE nocase\x00SELECT sqlite_fail('constraint %q already exists', %d) FROM \"%w\".sqlite_master WHERE type='table' AND tbl_name=%Q COLLATE nocase AND sqlite_find_constraint(sql, %Q)\x00SELECT sqlite_fail('constraint failed', %d) FROM %Q.%Q WHERE (%.*s) IS NOT TRUE\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_add_constraint(sql, %.*Q, -1) WHERE type='table' AND tbl_name=%Q COLLATE nocase\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00sqlite_drop_constraint\x00sqlite_fail\x00sqlite_add_constraint\x00sqlite_find_constraint\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx COLLATE nocase\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00pragma_\x00json\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00%s %T already exists\x00there is already an index named %s\x00cannot use RETURNING in a trigger\x00sqlite_returning_%p\x00too many columns on %s\x00always\x00generated\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00unknown datatype for %s.%s: \"%s\"\x00missing datatype for %s.%s\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00SELECT*FROM\"%w\".\"%w\"\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00FIRST\x00LAST\x00unsupported use of NULLS %s\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00 UNIQUE\x00CREATE%s INDEX %.*s\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00ON\x00USING\x00a JOIN clause is required before %s\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00expressions\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00unsafe use of virtual table \"%s\"\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00integer overflow\x00%!.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!0.17g\x00%#Q\x00invalid Unicode escape\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00affinity\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00subtype\x00length\x00octet_length\x00instr\x00printf\x00format\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00unhex\x00concat\x00concat_ws\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00unistr\x00quote\x00unistr_quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00string_agg\x00glob\x00ceil\x00trunc\x00ln\x00log\x00log10\x00log2\x00exp\x00pow\x00power\x00mod\x00acos\x00asin\x00atan\x00atan2\x00cos\x00sin\x00tan\x00cosh\x00sinh\x00tanh\x00acosh\x00asinh\x00atanh\x00sqrt\x00radians\x00degrees\x00pi\x00sign\x00iif\x00if\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00SCAN %S\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00so\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00builtin\x00enc\x00narg\x00flags\x00schema\x00ncol\x00wr\x00strict\x00seqno\x00desc\x00coll\x00key\x00unique\x00origin\x00partial\x00wdth\x00hght\x00flgs\x00rowid\x00fkid\x00busy\x00checkpointed\x00file\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_list\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00exclusive\x00normal\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00utf8\x00utf16le\x00utf16be\x00w\x00a\x00sissii\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00reset\x00issisii\x00issisi\x00SELECT*FROM\"%w\"\x00shadow\x00sssiii\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00wrong # of entries in index \x00row not in PRIMARY KEY order for %s\x00NULL value in %s.%s\x00non-%s value in %s.%s\x00NUMERIC value in %s.%s\x00C\x00TEXT value in %s.%s\x00CHECK constraint failed in %s\x00index %s stores an imprecise floating-point value for row \x00row \x00 missing from index \x00rowid not at end-of-record for row \x00 of index \x00 values differ from index \x00non-unique entry in index \x00ok\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00unsupported encoding: %s\x00restart\x00noop\x00ANALYZE \"%w\".\"%w\"\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00rename\x00drop column\x00add column\x00drop constraint\x00error in %s %s after %s: %s\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x001\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown join type: %T%s%T%s%T\x00a NATURAL join may not have an ON or USING clause\x00cannot join using column %s - column not present in both tables\x00ambiguous reference to %s in USING()\x00CREATE BLOOM FILTER\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00LAST TERM OF \x00USE TEMP B-TREE FOR %sORDER BY\x00USE TEMP B-TREE FOR LAST %d TERMS OF ORDER BY\x00column%d\x00%.*z:%u\x00NUM\x00VIEWs and/or subqueries nested too deep\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00S\x00SCAN %d CONSTANT ROW%s\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00no such index: \"%s\"\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00%!S\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00..%s\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00USE TEMP B-TREE FOR %s(ORDER BY)\x00 USING COVERING INDEX \x00SCAN %s%s%s\x00table-function argument\x00ON clause\x00%s references tables to its right\x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00cannot create triggers on shadow tables\x00trigger %T already exists\x00cannot create trigger on system table\x00BEFORE\x00AFTER\x00cannot create %s trigger on view: %S\x00cannot create INSTEAD OF trigger on table: %S\x00trigger \"%s\" may not write to shadow table \"%s\"\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00DELETE\x00UPDATE\x00%s RETURNING is not available on virtual tables\x00RETURNING may not use \"TABLE.*\" wildcards\x00triggers nested too deep\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00vacuum_%016llx\x00ATTACH %Q AS %s\x00output file already exists\x00reserve\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO %s.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM %s.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO %s.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00syntax error\x00<expr>\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00SEARCH\x00SCAN\x00 EXISTS\x00%s %S%s\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00 USING INTEGER PRIMARY KEY (%s\x00>? AND %s\x00%c?)\x00 VIRTUAL TABLE INDEX \x000x%x:%s\x00%d:%s\x00 LEFT-JOIN\x00BLOOM FILTER ON %S (\x00rowid=?\x00MULTI-INDEX OR\x00INDEX %d\x00RIGHT-JOIN %s\x00regexp\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00internal query planner error\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00misuse of aggregate: %s()\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00near \"%T\": syntax error\x00ORDER BY\x00LIMIT\x00%s clause should come after %s not before\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00Recursion limit\x00unknown table option: %.*s\x00set list\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%T\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00shared\x00private\x00mode\x00ro\x00rw\x00rwc\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x00JSON nested too deep\x00JSON cannot hold BLOB values\x00malformed JSON\x00inf\x009.0e999\x00infinity\x00QNaN\x00SNaN\x00json_%s() needs an odd number of arguments\x00\"\\/bfnrt\x00-9e999\x009e999\x00inity\x00\\\"\x00\\u000b\x00\\u00\x00\\u0000\x00,\n\x00: \x00*]\x00not an array element: %Q\x00JSON path too deep\x00bad JSON path: %Q\x00@\x00[\x00#\x00.\"\x00\"\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00insert\x00set\x00array_insert\x00 \x00FLAGS parameter to json_valid() must be between 1 and 15\x00[]\x00}\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%lld]\x00.\"%.*s\"\x00.%.*s\x00$\x00jsonb\x00json_array\x00jsonb_array\x00json_array_insert\x00jsonb_array_insert\x00json_array_length\x00json_error_position\x00json_extract\x00jsonb_extract\x00->\x00->>\x00json_insert\x00jsonb_insert\x00json_object\x00jsonb_object\x00json_patch\x00jsonb_patch\x00json_pretty\x00json_quote\x00json_remove\x00jsonb_remove\x00json_replace\x00jsonb_replace\x00json_set\x00jsonb_set\x00json_type\x00json_valid\x00json_group_array\x00jsonb_group_array\x00json_group_object\x00jsonb_group_object\x00json_each\x00json_tree\x00jsonb_each\x00jsonb_tree\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00_node\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00,%.*s REAL\x00,%.*s INT\x00);\x00{%lld\x00 %g\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00%_rowid\x00%_parent\x00Mapping (%lld -> %lld) missing from %s table\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00In RTree %s.%s:\n%z\x00wrong number of arguments to function rtreecheck()\x00[%!g,%!g],\x00[%!g,%!g]]\x00<polyline points=\x00%c%g,%g\x00 %g,%g'\x00 %s\x00></polyline>\x00Too many columns for a geopoly table\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00geopoly\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql COLLATE nocase BETWEEN 'CREATE VIRTUAL' AND 'CREATE VIRTUAM'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00may not have\x00requires\x00table %q %s rbu_rowid column\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00 NOT NULL\x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00%z, %z\x00 WITHOUT ROWID\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00AND\x00WHERE\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00, _rowid_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00, 0 AS rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x000 AS \x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file:///%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00&\x00file:%s-vactmp?rbu_memory=1%s%s\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00rbu_exclusive_checkpoint\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00vacuum\x00update\x00database modified during rbu %s\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00/\x00overflow\x00%s%.3x+%.6x\x00%s%.3x/\x00internal\x00leaf\x00corrupted\x00SELECT * FROM (SELECT 'sqlite_schema' AS name,1 AS rootpage,'table' AS type UNION ALL SELECT name,rootpage,type FROM \"%w\".sqlite_schema WHERE rootpage!=0)\x00WHERE name=%Q\x00 ORDER BY name\x00dbstat\x00CREATE TABLE x(pgno INTEGER PRIMARY KEY, data BLOB, schema HIDDEN)\x00read-only\x00cannot delete\x00cannot insert\x00no such schema\x00bad page number\x00bad page value\x00failed to open transaction\x00sqlite_dbpage\x00SELECT 0, 'tbl', '', 0, '', 1, 0 UNION ALL SELECT 1, 'idx', '', 0, '', 2, 0 UNION ALL SELECT 2, 'stat', '', 0, '', 0, 0\x00PRAGMA '%q'.table_xinfo('%q')\x00SELECT\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00_rowid_, *\x00SELECT %s FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00%z%s\"%w\".\"%w\".\"%w\"\x00SELECT %s,%s FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00SELECT * FROM %Q.sqlite_schema\x00no such table: %s.%s\x00table schemas do not match\x00, 1\x00 AND (?6 OR ?3 IS stat)\x00tbl, idx\x00?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00tbl, ?2, stat\x00?%d\x00 AND (?%d OR ?%d IS %w.%w)\x00SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00 WHERE \x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00 IS ?\x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00PRAGMA table_list = %Q\x00SELECT %s FROM %Q WHERE (%s) IS (%s)\x00INSERT INTO %Q(%s) VALUES(%s)\x00SAVEPOINT update_op\x00ROLLBACK TO update_op\x00RELEASE update_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00undefined\x00invalid change: %s value in PK of old.* record\x00invalid change: defined value in PK of new.* record\x00un\x00invalid change: column %d - old.* value is %sdefined but new.* is %sdefined\x00invalid change: column %d is undefined\x00invalid change: null value in PK\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00wrong number of arguments to function fts5_get_locale()\x00non-integer argument passed to function fts5_get_locale()\x00snippet\x00highlight\x00bm25\x00fts5_get_locale\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00contentless_delete\x00malformed contentless_delete=... directive\x00contentless_unindexed\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00locale\x00malformed locale=... directive\x00columns\x00malformed detail=... directive\x00tokendata\x00malformed tokendata=... directive\x00unrecognized option: \"%.*s\"\x00rank\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00, NULL\x00, T.l%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00contentless_delete=1 requires a contentless table\x00contentless_delete=1 is incompatible with columnsize=0\x00contentless_unindexed=1 requires a contentless table\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00deletemerge\x00secure-delete\x00insttoken\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d or %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00phrase\x00fts5: %s queries are not supported (detail!=full)\x00fts5 expression tree is too large (maximum depth %d)\x00fts5: corruption found reading blob %lld from table \"%s\"\x00fts5: corruption on page %d, segment %d, table \"%s\"\x00fts5: corruption in table \"%s\"\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00\xff\x00\x00\x01\x00fts5: corrupt structure record for table \"%s\"\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term>? ORDER BY term ASC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00DELETE FROM '%q'.'%q_idx' WHERE (segid, (pgno/2)) = (?1, ?2)\x00REPLACE INTO %Q.'%q_config' VALUES ('version', %d)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00\x00\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00fts5: checksum mismatch for table \"%s\"\x00recursively defined fts5 content table\x00DESC\x00ASC\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00fts5: missing row %lld from content table %s\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00flush\x00%s a subset of columns on fts5 contentless-delete table: %s\x00%s contentless fts5 table: %s\x00cannot UPDATE\x00'delete' may not be used with a contentless_delete=1 table\x00cannot DELETE from contentless fts5 table: %s\x00fts5_locale() requires locale=1\x00no such cursor: %lld\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2026-06-26 20:14:12 d4c0e51e4aeb96955b99185ab9cde75c339e2c29c3f3f12428d364a10d782c62\x00config\x00malformed inverted index for FTS5 table %s.%s\x00unable to validate the inverted index for FTS5 table %s.%s: %s\x00fts5\x00fts5_source_id\x00fts5_locale\x00fts5_insttoken\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?%s)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz%s FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00%z%s?%d\x00%z,?%d\x00,?\x00,origin\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00, l%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00id INTEGER PRIMARY KEY, sz BLOB, origin INTEGER\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00DELETE FROM %Q.'%q_content';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00porter\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00trigram\x00ascii\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002026-06-26 20:14:12 d4c0e51e4aeb96955b99185ab9cde75c339e2c29c3f3f12428d364a10d782c62\x00"
const __clang_version__ = "19.1.7 (https://github.com/llvm/llvm-project.git llvmorg-19.1.7-0-gcd708029e0b2)"
const __isnan = 0
const __isnanf = 0
const __lockable = 0
const __no_lock_analysis = 0
const __writeonly = "__unused"
var _aAgg = [1]struct {
FxStep uintptr
FxFinal uintptr
FzName uintptr
}{
0: {
FzName: __ccgo_ts + 30200,
},
}
var _aAlterTableFuncs = [9]TFuncDef{
0: {
FnArg: int16(9),
FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)),
FzName: __ccgo_ts + 12653,
},
1: {
FnArg: int16(7),
FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)),
FzName: __ccgo_ts + 12674,
},
2: {
FnArg: int16(7),
FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)),
FzName: __ccgo_ts + 12694,
},
3: {
FnArg: int16(3),
FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)),
FzName: __ccgo_ts + 12713,
},
4: {
FnArg: int16(2),
FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)),
FzName: __ccgo_ts + 12732,
},
5: {
FnArg: int16(2),
FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)),
FzName: __ccgo_ts + 12755,
},
6: {
FnArg: int16(2),
FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)),
FzName: __ccgo_ts + 12778,
},
7: {
FnArg: int16(3),
FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)),
FzName: __ccgo_ts + 12790,
},
8: {
FnArg: int16(2),
FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)),
FzName: __ccgo_ts + 12812,
},
}
var _aCacheMode = [3]struct {
Fz uintptr
Fmode int32
}{
0: {
Fz: __ccgo_ts + 26170,
Fmode: int32(SQLITE_OPEN_SHAREDCACHE),
},
1: {
Fz: __ccgo_ts + 26177,
Fmode: int32(SQLITE_OPEN_PRIVATECACHE),
},
2: {},
}
var _aFunc = [12]struct {
FxFunc uintptr
FnArg int8
FbPure uint8
FzName uintptr
}{
0: {
FnArg: int8(1),
FbPure: uint8(1),
FzName: __ccgo_ts + 30057,
},
1: {
FnArg: int8(1),
FbPure: uint8(1),
FzName: __ccgo_ts + 30070,
},
2: {
FnArg: int8(1),
FbPure: uint8(1),
FzName: __ccgo_ts + 30083,
},
3: {
FnArg: int8(-int32(1)),
FbPure: uint8(1),
FzName: __ccgo_ts + 30096,
},
4: {
FnArg: int8(2),
FbPure: uint8(1),
FzName: __ccgo_ts + 30042,
},
5: {
FnArg: int8(3),
FbPure: uint8(1),
FzName: __ccgo_ts + 30108,
},
6: {
FnArg: int8(2),
FbPure: uint8(1),
FzName: __ccgo_ts + 30026,
},
7: {
FnArg: int8(1),
FzName: __ccgo_ts + 30131,
},
8: {
FnArg: int8(1),
FbPure: uint8(1),
FzName: __ccgo_ts + 30145,
},
9: {
FnArg: int8(7),
FbPure: uint8(1),
FzName: __ccgo_ts + 30158,
},
10: {
FnArg: int8(4),
FbPure: uint8(1),
FzName: __ccgo_ts + 30172,
},
11: {
FnArg: int8(1),
FbPure: uint8(1),
FzName: __ccgo_ts + 30188,
},
}
var _aMsg = [29]uintptr{
0: __ccgo_ts + 25357,
1: __ccgo_ts + 25370,
3: __ccgo_ts + 25386,
4: __ccgo_ts + 25411,
5: __ccgo_ts + 25425,
6: __ccgo_ts + 25444,
7: __ccgo_ts + 1672,
8: __ccgo_ts + 25469,
9: __ccgo_ts + 25506,
10: __ccgo_ts + 25518,
11: __ccgo_ts + 25533,
12: __ccgo_ts + 25566,
13: __ccgo_ts + 25584,
14: __ccgo_ts + 25609,
15: __ccgo_ts + 25638,
17: __ccgo_ts + 6241,
18: __ccgo_ts + 5592,
19: __ccgo_ts + 25655,
20: __ccgo_ts + 25673,
21: __ccgo_ts + 25691,
23: __ccgo_ts + 25725,
25: __ccgo_ts + 25746,
26: __ccgo_ts + 25772,
27: __ccgo_ts + 25795,
28: __ccgo_ts + 25816,
}
var _aOp = [4]struct {
FzOp uintptr
FeOp uint8
}{
0: {
FzOp: __ccgo_ts + 17814,
FeOp: uint8(SQLITE_INDEX_CONSTRAINT_MATCH),
},
1: {
FzOp: __ccgo_ts + 17148,
FeOp: uint8(SQLITE_INDEX_CONSTRAINT_GLOB),
},
2: {
FzOp: __ccgo_ts + 16607,
FeOp: uint8(SQLITE_INDEX_CONSTRAINT_LIKE),
},
3: {
FzOp: __ccgo_ts + 23936,
FeOp: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP),
},
}
var _aOpenMode = [5]struct {
Fz uintptr
Fmode int32
}{
0: {
Fz: __ccgo_ts + 26190,
Fmode: int32(SQLITE_OPEN_READONLY),
},
1: {
Fz: __ccgo_ts + 26193,
Fmode: int32(SQLITE_OPEN_READWRITE),
},
2: {
Fz: __ccgo_ts + 26196,
Fmode: libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE),
},
3: {
Fz: __ccgo_ts + 19035,
Fmode: int32(SQLITE_OPEN_MEMORY),
},
4: {},
}
var _aPragmaName = [66]TPragmaName{
0: {
FzName: __ccgo_ts + 18034,
FePragTyp: uint8(PragTyp_ANALYSIS_LIMIT),
FmPragFlg: uint8(PragFlg_Result0),
},
1: {
FzName: __ccgo_ts + 18049,
FePragTyp: uint8(PragTyp_HEADER_VALUE),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)),
FiArg: uint64(BTREE_APPLICATION_ID),
},
2: {
FzName: __ccgo_ts + 18064,
FePragTyp: uint8(PragTyp_AUTO_VACUUM),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)),
},
3: {
FzName: __ccgo_ts + 18076,
FePragTyp: uint8(PragTyp_FLAG),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)),
FiArg: uint64(SQLITE_AutoIndex),
},
4: {
FzName: __ccgo_ts + 18092,
FePragTyp: uint8(PragTyp_BUSY_TIMEOUT),
FmPragFlg: uint8(PragFlg_Result0),
FiPragCName: uint8(56),
FnPragCName: uint8(1),
},
5: {
FzName: __ccgo_ts + 18015,
FePragTyp: uint8(PragTyp_CACHE_SIZE),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)),
},
6: {
FzName: __ccgo_ts + 18105,
FePragTyp: uint8(PragTyp_CACHE_SPILL),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)),
},
7: {
FzName: __ccgo_ts + 18117,
FePragTyp: uint8(PragTyp_CASE_SENSITIVE_LIKE),
FmPragFlg: uint8(PragFlg_NoColumns),
},
8: {
FzName: __ccgo_ts + 18137,
FePragTyp: uint8(PragTyp_FLAG),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)),
FiArg: uint64(SQLITE_CellSizeCk),
},
9: {
FzName: __ccgo_ts + 18153,
FePragTyp: uint8(PragTyp_FLAG),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)),
FiArg: uint64(SQLITE_CkptFullFSync),
},
10: {
FzName: __ccgo_ts + 18174,
FePragTyp: uint8(PragTyp_COLLATION_LIST),
FmPragFlg: uint8(PragFlg_Result0),
FiPragCName: uint8(33),
FnPragCName: uint8(2),
},
11: {
FzName: __ccgo_ts + 18189,
FePragTyp: uint8(PragTyp_COMPILE_OPTIONS),
FmPragFlg: uint8(PragFlg_Result0),
},
12: {
FzName: __ccgo_ts + 18205,
FePragTyp: uint8(PragTyp_FLAG),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)),
FiArg: libc.Uint64FromInt32(libc.Int32FromInt32(0x00001)) << libc.Int32FromInt32(32),
},
13: {
FzName: __ccgo_ts + 18219,
FePragTyp: uint8(PragTyp_HEADER_VALUE),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)),
FiArg: uint64(BTREE_DATA_VERSION),
},
14: {
FzName: __ccgo_ts + 18232,
FePragTyp: uint8(PragTyp_DATABASE_LIST),
FmPragFlg: uint8(PragFlg_Result0),
FiPragCName: uint8(50),
FnPragCName: uint8(3),
},
15: {
FzName: __ccgo_ts + 18246,
FePragTyp: uint8(PragTyp_DEFAULT_CACHE_SIZE),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)),
FiPragCName: uint8(55),
FnPragCName: uint8(1),
},
16: {
FzName: __ccgo_ts + 18265,
FePragTyp: uint8(PragTyp_FLAG),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)),
FiArg: uint64(SQLITE_DeferFKs),
},
17: {
FzName: __ccgo_ts + 18284,
FePragTyp: uint8(PragTyp_FLAG),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)),
FiArg: uint64(SQLITE_NullCallback),
},
18: {
FzName: __ccgo_ts + 18307,
FePragTyp: uint8(PragTyp_ENCODING),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)),
},
19: {
FzName: __ccgo_ts + 18316,
FePragTyp: uint8(PragTyp_FOREIGN_KEY_CHECK),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)),
FiPragCName: uint8(43),
FnPragCName: uint8(4),
},
20: {
FzName: __ccgo_ts + 18334,
FePragTyp: uint8(PragTyp_FOREIGN_KEY_LIST),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)),
FnPragCName: uint8(8),
},
21: {
FzName: __ccgo_ts + 18351,
FePragTyp: uint8(PragTyp_FLAG),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)),
FiArg: uint64(SQLITE_ForeignKeys),
},
22: {
FzName: __ccgo_ts + 18364,
FePragTyp: uint8(PragTyp_HEADER_VALUE),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)),
},
23: {
FzName: __ccgo_ts + 18379,
FePragTyp: uint8(PragTyp_FLAG),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)),
FiArg: uint64(SQLITE_FullColNames),
},
24: {
FzName: __ccgo_ts + 18397,
FePragTyp: uint8(PragTyp_FLAG),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)),
FiArg: uint64(SQLITE_FullFSync),
},
25: {
FzName: __ccgo_ts + 18407,
FePragTyp: uint8(PragTyp_FUNCTION_LIST),
FmPragFlg: uint8(PragFlg_Result0),
FiPragCName: uint8(15),
FnPragCName: uint8(6),
},
26: {
FzName: __ccgo_ts + 18421,
FePragTyp: uint8(PragTyp_HARD_HEAP_LIMIT),
FmPragFlg: uint8(PragFlg_Result0),
},
27: {
FzName: __ccgo_ts + 18437,
FePragTyp: uint8(PragTyp_FLAG),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)),
FiArg: uint64(SQLITE_IgnoreChecks),
},
28: {
FzName: __ccgo_ts + 18462,
FePragTyp: uint8(PragTyp_INCREMENTAL_VACUUM),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_NoColumns)),
},
29: {
FzName: __ccgo_ts + 18481,
FePragTyp: uint8(PragTyp_INDEX_INFO),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)),
FiPragCName: uint8(27),
FnPragCName: uint8(3),
},
30: {
FzName: __ccgo_ts + 18492,
FePragTyp: uint8(PragTyp_INDEX_LIST),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)),
FiPragCName: uint8(33),
FnPragCName: uint8(5),
},
31: {
FzName: __ccgo_ts + 18503,
FePragTyp: uint8(PragTyp_INDEX_INFO),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)),
FiPragCName: uint8(27),
FnPragCName: uint8(6),
FiArg: uint64(1),
},
32: {
FzName: __ccgo_ts + 18515,
FePragTyp: uint8(PragTyp_INTEGRITY_CHECK),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)),
},
33: {
FzName: __ccgo_ts + 18531,
FePragTyp: uint8(PragTyp_JOURNAL_MODE),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)),
},
34: {
FzName: __ccgo_ts + 18544,
FePragTyp: uint8(PragTyp_JOURNAL_SIZE_LIMIT),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)),
},
35: {
FzName: __ccgo_ts + 18563,
FePragTyp: uint8(PragTyp_FLAG),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)),
FiArg: uint64(SQLITE_LegacyAlter),
},
36: {
FzName: __ccgo_ts + 18582,
FePragTyp: uint8(PragTyp_LOCKING_MODE),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)),
},
37: {
FzName: __ccgo_ts + 18595,
FePragTyp: uint8(PragTyp_PAGE_COUNT),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)),
},
38: {
FzName: __ccgo_ts + 18610,
FePragTyp: uint8(PragTyp_MMAP_SIZE),
},
39: {
FzName: __ccgo_ts + 18620,
FePragTyp: uint8(PragTyp_MODULE_LIST),
FmPragFlg: uint8(PragFlg_Result0),
FiPragCName: uint8(9),
FnPragCName: uint8(1),
},
40: {
FzName: __ccgo_ts + 18632,
FePragTyp: uint8(PragTyp_OPTIMIZE),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_NeedSchema)),
},
41: {
FzName: __ccgo_ts + 18641,
FePragTyp: uint8(PragTyp_PAGE_COUNT),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)),
},
42: {
FzName: __ccgo_ts + 18652,
FePragTyp: uint8(PragTyp_PAGE_SIZE),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)),
},
43: {
FzName: __ccgo_ts + 18662,
FePragTyp: uint8(PragTyp_PRAGMA_LIST),
FmPragFlg: uint8(PragFlg_Result0),
FiPragCName: uint8(9),
FnPragCName: uint8(1),
},
44: {
FzName: __ccgo_ts + 18674,
FePragTyp: uint8(PragTyp_FLAG),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)),
FiArg: uint64(SQLITE_QueryOnly),
},
45: {
FzName: __ccgo_ts + 18685,
FePragTyp: uint8(PragTyp_INTEGRITY_CHECK),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)),
},
46: {
FzName: __ccgo_ts + 18697,
FePragTyp: uint8(PragTyp_FLAG),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)),
FiArg: libc.Uint64FromInt32(libc.Int32FromInt32(0x00004)) << libc.Int32FromInt32(32),
},
47: {
FzName: __ccgo_ts + 18714,
FePragTyp: uint8(PragTyp_FLAG),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)),
FiArg: uint64(SQLITE_RecTriggers),
},
48: {
FzName: __ccgo_ts + 18733,
FePragTyp: uint8(PragTyp_FLAG),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)),
FiArg: uint64(SQLITE_ReverseOrder),
},
49: {
FzName: __ccgo_ts + 18759,
FePragTyp: uint8(PragTyp_HEADER_VALUE),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)),
FiArg: uint64(BTREE_SCHEMA_VERSION),
},
50: {
FzName: __ccgo_ts + 18774,
FePragTyp: uint8(PragTyp_SECURE_DELETE),
FmPragFlg: uint8(PragFlg_Result0),
},
51: {
FzName: __ccgo_ts + 18788,
FePragTyp: uint8(PragTyp_FLAG),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)),
FiArg: uint64(SQLITE_ShortColNames),
},
52: {
FzName: __ccgo_ts + 18807,
FePragTyp: uint8(PragTyp_SHRINK_MEMORY),
FmPragFlg: uint8(PragFlg_NoColumns),
},
53: {
FzName: __ccgo_ts + 18821,
FePragTyp: uint8(PragTyp_SOFT_HEAP_LIMIT),
FmPragFlg: uint8(PragFlg_Result0),
},
54: {
FzName: __ccgo_ts + 18837,
FePragTyp: uint8(PragTyp_SYNCHRONOUS),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)),
},
55: {
FzName: __ccgo_ts + 18849,
FePragTyp: uint8(PragTyp_TABLE_INFO),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)),
FiPragCName: uint8(8),
FnPragCName: uint8(6),
},
56: {
FzName: __ccgo_ts + 18860,
FePragTyp: uint8(PragTyp_TABLE_LIST),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1)),
FiPragCName: uint8(21),
FnPragCName: uint8(6),
},
57: {
FzName: __ccgo_ts + 18871,
FePragTyp: uint8(PragTyp_TABLE_INFO),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)),
FiPragCName: uint8(8),
FnPragCName: uint8(7),
FiArg: uint64(1),
},
58: {
FzName: __ccgo_ts + 18883,
FePragTyp: uint8(PragTyp_TEMP_STORE),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)),
},
59: {
FzName: __ccgo_ts + 18894,
FePragTyp: uint8(PragTyp_TEMP_STORE_DIRECTORY),
FmPragFlg: uint8(PragFlg_NoColumns1),
},
60: {
FzName: __ccgo_ts + 18915,
FePragTyp: uint8(PragTyp_THREADS),
FmPragFlg: uint8(PragFlg_Result0),
},
61: {
FzName: __ccgo_ts + 18923,
FePragTyp: uint8(PragTyp_FLAG),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)),
FiArg: uint64(SQLITE_TrustedSchema),
},
62: {
FzName: __ccgo_ts + 18938,
FePragTyp: uint8(PragTyp_HEADER_VALUE),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)),
FiArg: uint64(BTREE_USER_VERSION),
},
63: {
FzName: __ccgo_ts + 18951,
FePragTyp: uint8(PragTyp_WAL_AUTOCHECKPOINT),
},
64: {
FzName: __ccgo_ts + 18970,
FePragTyp: uint8(PragTyp_WAL_CHECKPOINT),
FmPragFlg: uint8(PragFlg_NeedSchema),
FiPragCName: uint8(47),
FnPragCName: uint8(3),
},
65: {
FzName: __ccgo_ts + 18985,
FePragTyp: uint8(PragTyp_FLAG),
FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)),
FiArg: libc.Uint64FromInt32(libc.Int32FromInt32(SQLITE_WriteSchema) | libc.Int32FromInt32(SQLITE_NoSchemaError)),
},
}
/* Number of pragmas: 68 on by default, 78 total. */
/************** End of pragma.h **********************************************/
/************** Continuing where we left off in pragma.c *********************/
/*
** When the 0x10 bit of PRAGMA optimize is set, any ANALYZE commands
** will be run with an analysis_limit set to the lessor of the value of
** the following macro or to the actual analysis_limit if it is non-zero,
** in order to prevent PRAGMA optimize from running for too long.
**
** The value of 2000 is chosen empirically so that the worst-case run-time
** for PRAGMA optimize does not exceed 100 milliseconds against a variety
** of test databases on a RaspberryPI-4 compiled using -Os and without
** -DSQLITE_DEBUG. Of course, your mileage may vary. For the purpose of
** this paragraph, "worst-case" means that ANALYZE ends up being
** run on every table in the database. The worst case typically only
** happens if PRAGMA optimize is run on a database file for which ANALYZE
** has not been previously run and the 0x10000 flag is included so that
** all tables are analyzed. The usual case for PRAGMA optimize is that
** no ANALYZE commands will be run at all, or if any ANALYZE happens it
** will be against a single table, so that expected timing for PRAGMA
** optimize on a PI-4 is more like 1 millisecond or less with the 0x10000
** flag or less than 100 microseconds without the 0x10000 flag.
**
** An analysis limit of 2000 is almost always sufficient for the query
** planner to fully characterize an index. The additional accuracy from
** a larger analysis is not usually helpful.
*/
var _aTable = [3]struct {
FzName uintptr
FzCols uintptr
}{
0: {
FzName: __ccgo_ts + 12835,
FzCols: __ccgo_ts + 12848,
},
1: {
FzName: __ccgo_ts + 12861,
FzCols: __ccgo_ts + 12874,
},
2: {
FzName: __ccgo_ts + 12902,
},
}
/*
** Recommended number of samples for sqlite_stat4
*/
// C documentation
//
// /*
// ** Implementation of the abs() function.
// **
// ** IMP: R-23979-26855 The abs(X) function returns the absolute value of
// ** the numeric argument X.
// */
func _absFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) {
var iVal Ti64
var rVal float64
_, _ = iVal, rVal
_ = argc
switch Xsqlite3_value_type(tls, **(**uintptr)(__ccgo_up(argv))) {
case int32(SQLITE_INTEGER):
iVal = Xsqlite3_value_int64(tls, **(**uintptr)(__ccgo_up(argv)))
if iVal < 0 {
if iVal == int64(-libc.Int32FromInt32(1))-(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)<<libc.Int32FromInt32(32)) {
/* IMP: R-31676-45509 If X is the integer -9223372036854775808
** then abs(X) throws an integer overflow error since there is no
** equivalent positive 64-bit two complement value. */
Xsqlite3_result_error(tls, context, __ccgo_ts+16460, -int32(1))
return
}
iVal = -iVal
}
Xsqlite3_result_int64(tls, context, iVal)
case int32(SQLITE_NULL):
/* IMP: R-37434-19929 Abs(X) returns NULL if X is NULL. */
Xsqlite3_result_null(tls, context)
default:
/* Because sqlite3_value_double() returns 0.0 if the argument is not
** something that can be converted into a number, we have:
** IMP: R-01992-00519 Abs(X) returns 0.0 if X is a string or blob
** that cannot be converted to a numeric value.
*/
rVal = Xsqlite3_value_double(tls, **(**uintptr)(__ccgo_up(argv)))
if rVal < libc.Float64FromInt32(0) {
rVal = -rVal
}
Xsqlite3_result_double(tls, context, rVal)
break
}
}
// C documentation
//
// /*
// ** Return a human-readable name for a constraint resolution action.
// */
func _actionName(tls *libc.TLS, action Tu8) (r uintptr) {
var zName uintptr
_ = zName
switch libc.Int32FromUint8(action) {
case int32(OE_SetNull):
zName = __ccgo_ts + 19104
case int32(OE_SetDflt):
zName = __ccgo_ts + 19113
case int32(OE_Cascade):
zName = __ccgo_ts + 19125
case int32(OE_Restrict):
zName = __ccgo_ts + 19133
default:
zName = __ccgo_ts + 19142
break
}
return zName
}
// C documentation
//
// /*
// ** Buffer pCons, which is nCons bytes in size, contains the text of a
// ** NOT NULL or CHECK constraint that will be inserted into a CREATE TABLE
// ** statement. If successful, this function returns the size of the buffer in
// ** bytes not including any trailing whitespace or "--" style comments. Or,
// ** if an OOM occurs, it returns 0 and sets db->mallocFailed to true.
// **
// ** C-style comments at the end are preserved. "--" style comments are
// ** removed because the comment terminator might be \000, and we are about
// ** to insert the pCons[] text into the middle of a larger string, and that
// ** will have the effect of removing the comment terminator and messing up
// ** the syntax.
// */
func _alterRtrimConstraint(tls *libc.TLS, db uintptr, pCons uintptr, nCons int32) (r int32) {
bp := tls.Alloc(32)
defer tls.Free(32)
var iEnd, iOff, nToken int32
var zTmp uintptr
var _ /* t at bp+0 */ int32
_, _, _, _ = iEnd, iOff, nToken, zTmp
zTmp = _sqlite3MPrintf(tls, db, __ccgo_ts+12048, libc.VaList(bp+16, nCons, pCons))
iOff = 0
iEnd = 0
if zTmp == uintptr(0) {
return 0
}
for int32(1) != 0 {
**(**int32)(__ccgo_up(bp)) = 0
nToken = int32(_sqlite3GetToken(tls, zTmp+uintptr(iOff), bp))
if **(**int32)(__ccgo_up(bp)) == int32(TK_ILLEGAL) {
break
}
if **(**int32)(__ccgo_up(bp)) != int32(TK_SPACE) && (**(**int32)(__ccgo_up(bp)) != int32(TK_COMMENT) || libc.Int32FromUint8(**(**Tu8)(__ccgo_up(zTmp + uintptr(iOff)))) != int32('-')) {
iEnd = iOff + nToken
}
iOff = iOff + nToken
}
_sqlite3DbFree(tls, db, zTmp)
return iEnd
}
var _attach_func = TFuncDef{
FnArg: int16(3),
FfuncFlags: uint32(SQLITE_UTF8),
FzName: __ccgo_ts + 13527,
}
var _az = [3]uintptr{
0: __ccgo_ts + 16105,
1: __ccgo_ts + 16127,
2: __ccgo_ts + 16111,
}
var _azAlterType = [4]uintptr{
0: __ccgo_ts + 19979,
1: __ccgo_ts + 19986,
2: __ccgo_ts + 19998,
3: __ccgo_ts + 20009,
}
var _azEnc = [4]uintptr{
1: __ccgo_ts + 19184,
2: __ccgo_ts + 19189,
3: __ccgo_ts + 19197,
}
/* Shared library endings to try if zFile cannot be loaded as written */
var _azEndings = [1]uintptr{
0: __ccgo_ts + 17586,
}
var _azErr = [5]uintptr{
0: __ccgo_ts + 24622,
1: __ccgo_ts + 24675,
2: __ccgo_ts + 24177,
3: __ccgo_ts + 24726,
4: __ccgo_ts + 24778,
}
// C documentation
//
// /*
// ** Column names appropriate for EXPLAIN or EXPLAIN QUERY PLAN.
// */
var _azExplainColNames8 = [12]uintptr{
0: __ccgo_ts + 5615,
1: __ccgo_ts + 5620,
2: __ccgo_ts + 5627,
3: __ccgo_ts + 5630,
4: __ccgo_ts + 5633,
5: __ccgo_ts + 5636,
6: __ccgo_ts + 5639,
7: __ccgo_ts + 5642,
8: __ccgo_ts + 5650,
9: __ccgo_ts + 5653,
10: __ccgo_ts + 5660,
11: __ccgo_ts + 5668,
}
var _azFormat = [2]uintptr{
0: __ccgo_ts + 28986,
1: __ccgo_ts + 28997,
}
var _azInsType = [3]uintptr{
0: __ccgo_ts + 26766,
1: __ccgo_ts + 26773,
2: __ccgo_ts + 26777,
}
var _azModeName = [6]uintptr{
0: __ccgo_ts + 19152,
1: __ccgo_ts + 19159,
2: __ccgo_ts + 19167,
3: __ccgo_ts + 19171,
4: __ccgo_ts + 19035,
5: __ccgo_ts + 19180,
}
var _azModule = [4]uintptr{
0: __ccgo_ts + 27364,
1: __ccgo_ts + 27374,
2: __ccgo_ts + 27384,
3: __ccgo_ts + 27395,
}
/* In SQLite core */
/* #include <stddef.h> */
/*
** If building separately, we will need some setup that is normally
** found in sqliteInt.h
*/
/* Macro to check for 4-byte alignment. Only used inside of assert() */
/* #include <string.h> */
/* #include <stdio.h> */
/* #include <assert.h> */
/* #include <stdlib.h> */
/* The following macro is used to suppress compiler warnings.
*/
var _azName1 = [3]uintptr{
0: __ccgo_ts + 27797,
1: __ccgo_ts + 5653,
2: __ccgo_ts + 17965,
}
var _azName2 = [5]uintptr{
0: __ccgo_ts + 40598,
1: __ccgo_ts + 37589,
2: __ccgo_ts + 27406,
3: __ccgo_ts + 38284,
4: __ccgo_ts + 13046,
}
var _azOne = [1]uintptr{
0: __ccgo_ts + 11543,
}
var _azSql = [8]uintptr{
0: __ccgo_ts + 27802,
1: __ccgo_ts + 27855,
2: __ccgo_ts + 27900,
3: __ccgo_ts + 27952,
4: __ccgo_ts + 28006,
5: __ccgo_ts + 28051,
6: __ccgo_ts + 28109,
7: __ccgo_ts + 28164,
}
// C documentation
//
// /*
// ** Directories to consider for temp files.
// */
var _azTempDirs = [6]uintptr{
2: __ccgo_ts + 3999,
3: __ccgo_ts + 4008,
4: __ccgo_ts + 4017,
5: __ccgo_ts + 1741,
}
var _azType = [4]uintptr{
0: __ccgo_ts + 5824,
1: __ccgo_ts + 5833,
2: __ccgo_ts + 5840,
3: __ccgo_ts + 5846,
}
var _azType1 = [6]uintptr{
0: __ccgo_ts + 1702,
1: __ccgo_ts + 14376,
2: __ccgo_ts + 14382,
3: __ccgo_ts + 14387,
4: __ccgo_ts + 14392,
5: __ccgo_ts + 14382,
}
var _azType2 = [5]uintptr{
0: __ccgo_ts + 6494,
1: __ccgo_ts + 6489,
2: __ccgo_ts + 8489,
3: __ccgo_ts + 8484,
4: __ccgo_ts + 1688,
}
// C documentation
//
// /*
// ** Check the integrity of the freelist or of an overflow page list.
// ** Verify that the number of pages on the list is N.
// */
func _checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage TPgno, N Tu32) {
bp := tls.Alloc(48)
defer tls.Free(48)
var expected, n Tu32
var i, nErrAtStart int32
var iFreePage TPgno
var pOvflData, v2 uintptr
var _ /* pOvflPage at bp+0 */ uintptr
_, _, _, _, _, _, _ = expected, i, iFreePage, n, nErrAtStart, pOvflData, v2
expected = N
nErrAtStart = (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr
for iPage != uint32(0) && (*TIntegrityCk)(unsafe.Pointer(pCheck)).FmxErr != 0 {
if _checkRef(tls, pCheck, iPage) != 0 {
break
}
N = N - 1
if _sqlite3PagerGet(tls, (*TIntegrityCk)(unsafe.Pointer(pCheck)).FpPager, iPage, bp, 0) != 0 {
_checkAppendMsg(tls, pCheck, __ccgo_ts+4487, libc.VaList(bp+16, iPage))
break
}
pOvflData = _sqlite3PagerGetData(tls, **(**uintptr)(__ccgo_up(bp)))
if isFreeList != 0 {
n = _sqlite3Get4byte(tls, pOvflData+4)
if (*TBtShared)(unsafe.Pointer((*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FautoVacuum != 0 {
_checkPtrmap(tls, pCheck, iPage, uint8(PTRMAP_FREEPAGE), uint32(0))
}
if n > (*TBtShared)(unsafe.Pointer((*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FusableSize/uint32(4)-uint32(2) {
_checkAppendMsg(tls, pCheck, __ccgo_ts+4509, libc.VaList(bp+16, iPage))
N = N - 1
} else {
i = 0
for {
if !(i < libc.Int32FromUint32(n)) {
break
}
iFreePage = _sqlite3Get4byte(tls, pOvflData+uintptr(int32(8)+i*int32(4)))
if (*TBtShared)(unsafe.Pointer((*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FautoVacuum != 0 {
_checkPtrmap(tls, pCheck, iFreePage, uint8(PTRMAP_FREEPAGE), uint32(0))
}
_checkRef(tls, pCheck, iFreePage)
goto _1
_1:
;
i = i + 1
}
N = N - n
}
} else {
/* If this database supports auto-vacuum and iPage is not the last
** page in this overflow list, check that the pointer-map entry for
** the following page matches iPage.
*/
if (*TBtShared)(unsafe.Pointer((*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FautoVacuum != 0 && N > uint32(0) {
i = libc.Int32FromUint32(_sqlite3Get4byte(tls, pOvflData))
_checkPtrmap(tls, pCheck, libc.Uint32FromInt32(i), uint8(PTRMAP_OVERFLOW2), iPage)
}
}
iPage = _sqlite3Get4byte(tls, pOvflData)
_sqlite3PagerUnref(tls, **(**uintptr)(__ccgo_up(bp)))
}
if N != 0 && nErrAtStart == (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr {
if isFreeList != 0 {
v2 = __ccgo_ts + 4548
} else {
v2 = __ccgo_ts + 4553
}
_checkAppendMsg(tls, pCheck, __ccgo_ts+4574, libc.VaList(bp+16, v2, expected-N, expected))
}
}
// C documentation
//
// /*
// ** Check that the entry in the pointer-map for page iChild maps to
// ** page iParent, pointer type ptrType. If not, append an error message
// ** to pCheck.
// */
func _checkPtrmap(tls *libc.TLS, pCheck uintptr, iChild TPgno, eType Tu8, iParent TPgno) {
bp := tls.Alloc(64)
defer tls.Free(64)
var rc int32
var _ /* ePtrmapType at bp+0 */ Tu8
var _ /* iPtrmapParent at bp+4 */ TPgno
_ = rc
rc = _ptrmapGet(tls, (*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt, iChild, bp, bp+4)
if rc != SQLITE_OK {
if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)<<libc.Int32FromInt32(8) {
_checkOom(tls, pCheck)
}
_checkAppendMsg(tls, pCheck, __ccgo_ts+4404, libc.VaList(bp+16, iChild))
return
}
if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(bp))) != libc.Int32FromUint8(eType) || **(**TPgno)(__ccgo_up(bp + 4)) != iParent {
_checkAppendMsg(tls, pCheck, __ccgo_ts+4433, libc.VaList(bp+16, iChild, libc.Int32FromUint8(eType), iParent, libc.Int32FromUint8(**(**Tu8)(__ccgo_up(bp))), **(**TPgno)(__ccgo_up(bp + 4))))
}
}
// C documentation
//
// /*
// ** Check that there is no open read-transaction on the b-tree passed as the
// ** second argument. If there is not, return SQLITE_OK. Otherwise, if there
// ** is an open read-transaction, return SQLITE_ERROR and leave an error
// ** message in database handle db.
// */
func _checkReadTransaction(tls *libc.TLS, db uintptr, p uintptr) (r int32) {
if _sqlite3BtreeTxnState(tls, p) != SQLITE_TXN_NONE {
_sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+5147, 0)
return int32(SQLITE_ERROR)
}
return SQLITE_OK
}
// C documentation
//
// /*
// ** Add 1 to the reference count for page iPage. If this is the second
// ** reference to the page, add an error message to pCheck->zErrMsg.
// ** Return 1 if there are 2 or more references to the page and 0 if
// ** if this is the first reference to the page.
// **
// ** Also check that the page number is in bounds.
// */
func _checkRef(tls *libc.TLS, pCheck uintptr, iPage TPgno) (r int32) {
bp := tls.Alloc(16)
defer tls.Free(16)
if iPage > (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnCkPage || iPage == uint32(0) {
_checkAppendMsg(tls, pCheck, __ccgo_ts+4356, libc.VaList(bp+8, iPage))
return int32(1)
}
if _getPageReferenced(tls, pCheck, iPage) != 0 {
_checkAppendMsg(tls, pCheck, __ccgo_ts+4379, libc.VaList(bp+8, iPage))
return int32(1)
}
_setPageReferenced(tls, pCheck, iPage)
return 0
}
var _detach_func = TFuncDef{
FnArg: int16(1),
FfuncFlags: uint32(SQLITE_UTF8),
FzName: __ccgo_ts + 13513,
}
func _disallowAggregatesInOrderByCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) {
bp := tls.Alloc(16)
defer tls.Free(16)
if libc.Int32FromUint8((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AGG_FUNCTION) && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) {
_sqlite3ErrorMsg(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, __ccgo_ts+24431, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8))))
}
return WRC_Continue
}
var _encnames = [4]uintptr{
0: __ccgo_ts + 5261,
1: __ccgo_ts + 5263,
2: __ccgo_ts + 5265,
3: __ccgo_ts + 5270,
}
var _encnames1 = [9]struct {
FzName uintptr
Fenc Tu8
}{
0: {
FzName: __ccgo_ts + 19794,
Fenc: uint8(SQLITE_UTF8),
},
1: {
FzName: __ccgo_ts + 19799,
Fenc: uint8(SQLITE_UTF8),
},
2: {
FzName: __ccgo_ts + 19805,
Fenc: uint8(SQLITE_UTF16LE),
},
3: {
FzName: __ccgo_ts + 19814,
Fenc: uint8(SQLITE_UTF16BE),
},
4: {
FzName: __ccgo_ts + 19823,
Fenc: uint8(SQLITE_UTF16LE),
},
5: {
FzName: __ccgo_ts + 19831,
Fenc: uint8(SQLITE_UTF16BE),
},
6: {
FzName: __ccgo_ts + 19839,
},
7: {
FzName: __ccgo_ts + 19846,
},
8: {},
}
// C documentation
//
// /*
// ** This routine is a helper for explainIndexRange() below
// **
// ** pStr holds the text of an expression that we are building up one term
// ** at a time. This routine adds a new term to the end of the expression.
// ** Terms are separated by AND so add the "AND" text for second and subsequent
// ** terms only.
// */
func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, iTerm int32, bAnd int32, zOp uintptr) {
var i int32
_ = i
if bAnd != 0 {
Xsqlite3_str_append(tls, pStr, __ccgo_ts+23627, int32(5))
}
if nTerm > int32(1) {
Xsqlite3_str_append(tls, pStr, __ccgo_ts+23633, int32(1))
}
i = 0
for {
if !(i < nTerm) {
break
}
if i != 0 {
Xsqlite3_str_append(tls, pStr, __ccgo_ts+14348, int32(1))
}
Xsqlite3_str_appendall(tls, pStr, _explainIndexColumnName(tls, pIdx, iTerm+i))
goto _1
_1:
;
i = i + 1
}
if nTerm > int32(1) {
Xsqlite3_str_append(tls, pStr, __ccgo_ts+5259, int32(1))
}
Xsqlite3_str_append(tls, pStr, zOp, int32(1))
if nTerm > int32(1) {
Xsqlite3_str_append(tls, pStr, __ccgo_ts+23633, int32(1))
}
i = 0
for {
if !(i < nTerm) {
break
}
if i != 0 {
Xsqlite3_str_append(tls, pStr, __ccgo_ts+14348, int32(1))
}
Xsqlite3_str_append(tls, pStr, __ccgo_ts+5261, int32(1))
goto _2
_2:
;
i = i + 1
}
if nTerm > int32(1) {
Xsqlite3_str_append(tls, pStr, __ccgo_ts+5259, int32(1))
}
}
// C documentation
//
// /*
// ** Argument pLevel describes a strategy for scanning table pTab. This
// ** function appends text to pStr that describes the subset of table
// ** rows scanned by the strategy in the form of an SQL expression.
// **
// ** For example, if the query:
// **
// ** SELECT * FROM t1 WHERE a=1 AND b>2;
// **
// ** is run and there is an index on (a, b), then this function returns a
// ** string similar to:
// **
// ** "a=? AND b>?"
// */
func _explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) {
bp := tls.Alloc(16)
defer tls.Free(16)
var i, j int32
var nEq, nSkip Tu16
var pIndex, z, v2 uintptr
_, _, _, _, _, _, _ = i, j, nEq, nSkip, pIndex, z, v2
pIndex = (*(*struct {
FnEq Tu16
FnBtm Tu16
FnTop Tu16
FnDistinctCol Tu16
FpIndex uintptr
FpOrderBy uintptr
})(unsafe.Pointer(pLoop + 24))).FpIndex
nEq = (*(*struct {
FnEq Tu16
FnBtm Tu16
FnTop Tu16
FnDistinctCol Tu16
FpIndex uintptr
FpOrderBy uintptr
})(unsafe.Pointer(pLoop + 24))).FnEq
nSkip = (*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip
if libc.Int32FromUint16(nEq) == 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&libc.Uint32FromInt32(libc.Int32FromInt32(WHERE_BTM_LIMIT)|libc.Int32FromInt32(WHERE_TOP_LIMIT)) == uint32(0) {
return
}
Xsqlite3_str_append(tls, pStr, __ccgo_ts+23635, int32(2))
i = 0
for {
if !(i < libc.Int32FromUint16(nEq)) {
break
}
z = _explainIndexColumnName(tls, pIndex, i)
if i != 0 {
Xsqlite3_str_append(tls, pStr, __ccgo_ts+23627, int32(5))
}
if i >= libc.Int32FromUint16(nSkip) {
v2 = __ccgo_ts + 23638
} else {
v2 = __ccgo_ts + 23643
}
Xsqlite3_str_appendf(tls, pStr, v2, libc.VaList(bp+8, z))
goto _1
_1:
;
i = i + 1
}
j = i
if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_BTM_LIMIT) != 0 {
_explainAppendTerm(tls, pStr, pIndex, libc.Int32FromUint16((*(*struct {
FnEq Tu16
FnBtm Tu16
FnTop Tu16
FnDistinctCol Tu16
FpIndex uintptr
FpOrderBy uintptr
})(unsafe.Pointer(pLoop + 24))).FnBtm), j, i, __ccgo_ts+23651)
i = int32(1)
}
if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_TOP_LIMIT) != 0 {
_explainAppendTerm(tls, pStr, pIndex, libc.Int32FromUint16((*(*struct {
FnEq Tu16
FnBtm Tu16
FnTop Tu16
FnDistinctCol Tu16
FpIndex uintptr
FpOrderBy uintptr
})(unsafe.Pointer(pLoop + 24))).FnTop), j, i, __ccgo_ts+23653)
}
Xsqlite3_str_append(tls, pStr, __ccgo_ts+5259, int32(1))
}
// C documentation
//
// /*
// ** Unless an "EXPLAIN QUERY PLAN" command is being processed, this function
// ** is a no-op. Otherwise, it adds a single row of output to the EQP result,
// ** where the caption is of the form:
// **
// ** "USE TEMP B-TREE FOR xxx"
// **
// ** where xxx is one of "DISTINCT", "ORDER BY" or "GROUP BY". Exactly which
// ** is determined by the zUsage argument.
// */
func _explainTempTable(tls *libc.TLS, pParse uintptr, zUsage uintptr) {
bp := tls.Alloc(16)
defer tls.Free(16)
_sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20520, libc.VaList(bp+8, zUsage))
}
/*
** Assign expression b to lvalue a. A second, no-op, version of this macro
** is provided when SQLITE_OMIT_EXPLAIN is defined. This allows the code
** in sqlite3Select() to assign values to structure member variables that
** only exist if SQLITE_OMIT_EXPLAIN is not defined without polluting the
** code with #ifndef directives.
*/
// C documentation
//
// /*
// ** Implementation of the fts5() function used by clients to obtain the
// ** API pointer.
// */
func _fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) {
var pGlobal, ppApi uintptr
_, _ = pGlobal, ppApi
pGlobal = Xsqlite3_user_data(tls, pCtx)
_ = nArg
ppApi = Xsqlite3_value_pointer(tls, **(**uintptr)(__ccgo_up(apArg)), __ccgo_ts+40494)
if ppApi != 0 {
**(**uintptr)(__ccgo_up(ppApi)) = pGlobal
}
}
func _fts5IndexCorruptIdx(tls *libc.TLS, pIdx uintptr) (r int32) {
bp := tls.Alloc(16)
defer tls.Free(16)
(*TFts5Index)(unsafe.Pointer(pIdx)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<<libc.Int32FromInt32(8)
_sqlite3Fts5ConfigErrmsg(tls, (*TFts5Index)(unsafe.Pointer(pIdx)).FpConfig, __ccgo_ts+38909, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(pIdx)).FpConfig)).FzName))
return libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<<libc.Int32FromInt32(8)
}
/* Size (in bytes) of an Fts5DlidxIter object with up to N levels */
func _fts5IndexCorruptIter(tls *libc.TLS, pIdx uintptr, pIter uintptr) (r int32) {
bp := tls.Alloc(32)
defer tls.Free(32)
(*TFts5Index)(unsafe.Pointer(pIdx)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<<libc.Int32FromInt32(8)
_sqlite3Fts5ConfigErrmsg(tls, (*TFts5Index)(unsafe.Pointer(pIdx)).FpConfig, __ccgo_ts+38857, libc.VaList(bp+8, (*TFts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno, (*TFts5StructureSegment)(unsafe.Pointer((*TFts5SegIter)(unsafe.Pointer(pIter)).FpSeg)).FiSegid, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(pIdx)).FpConfig)).FzName))
return libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<<libc.Int32FromInt32(8)
}
func _fts5IndexCorruptRowid(tls *libc.TLS, pIdx uintptr, iRowid Ti64) (r int32) {
bp := tls.Alloc(32)
defer tls.Free(32)
(*TFts5Index)(unsafe.Pointer(pIdx)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<<libc.Int32FromInt32(8)
_sqlite3Fts5ConfigErrmsg(tls, (*TFts5Index)(unsafe.Pointer(pIdx)).FpConfig, __ccgo_ts+38800, libc.VaList(bp+8, iRowid, (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(pIdx)).FpConfig)).FzName))
return libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<<libc.Int32FromInt32(8)
}
// C documentation
//
// /*
// ** Run an integrity check on the FTS5 data structures. Return a string
// ** if anything is found amiss. Return a NULL pointer if everything is
// ** OK.
// */
func _fts5IntegrityMethod(tls *libc.TLS, pVtab uintptr, zSchema uintptr, zTabname uintptr, isQuick int32, pzErr uintptr) (r int32) {
bp := tls.Alloc(32)
defer tls.Free(32)
var pTab uintptr
var rc, v1 int32
_, _, _ = pTab, rc, v1
pTab = pVtab
_ = isQuick
(*TFts5Config)(unsafe.Pointer((*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig)).FpzErrmsg = pzErr
rc = _sqlite3Fts5StorageIntegrity(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, 0)
if **(**uintptr)(__ccgo_up(pzErr)) == uintptr(0) && rc != SQLITE_OK {
if rc&int32(0xff) == int32(SQLITE_CORRUPT) {
**(**uintptr)(__ccgo_up(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+40605, libc.VaList(bp+8, zSchema, zTabname))
if **(**uintptr)(__ccgo_up(pzErr)) != 0 {
v1 = SQLITE_OK
} else {
v1 = int32(SQLITE_NOMEM)
}
rc = v1
} else {
**(**uintptr)(__ccgo_up(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+40651, libc.VaList(bp+8, zSchema, zTabname, Xsqlite3_errstr(tls, rc)))
}
} else {
if rc&int32(0xff) == int32(SQLITE_CORRUPT) {
rc = SQLITE_OK
}
}
_sqlite3Fts5IndexCloseReader(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex)
(*TFts5Config)(unsafe.Pointer((*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig)).FpzErrmsg = uintptr(0)
return rc
}
func _fts5PrepareStatement(tls *libc.TLS, ppStmt uintptr, pConfig uintptr, zFmt uintptr, va uintptr) (r int32) {
bp := tls.Alloc(32)
defer tls.Free(32)
var ap Tva_list
var rc int32
var zSql uintptr
var _ /* pRet at bp+0 */ uintptr
_, _, _ = ap, rc, zSql
**(**uintptr)(__ccgo_up(bp)) = uintptr(0)
ap = va
zSql = Xsqlite3_vmprintf(tls, zFmt, ap)
if zSql == uintptr(0) {
rc = int32(SQLITE_NOMEM)
} else {
rc = Xsqlite3_prepare_v3(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -int32(1), uint32(SQLITE_PREPARE_PERSISTENT), bp, uintptr(0))
if rc != SQLITE_OK {
_sqlite3Fts5ConfigErrmsg(tls, pConfig, __ccgo_ts+3942, libc.VaList(bp+16, Xsqlite3_errmsg(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb)))
}
Xsqlite3_free(tls, zSql)
}
_ = ap
**(**uintptr)(__ccgo_up(ppStmt)) = **(**uintptr)(__ccgo_up(bp))
return rc
}
// C documentation
//
// /*
// ** Implementation of fts5_source_id() function.
// */
func _fts5SourceIdFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apUnused uintptr) {
_ = nArg
_ = apUnused
Xsqlite3_result_text(tls, pCtx, __ccgo_ts+40507, -int32(1), uintptr(-libc.Int32FromInt32(1)))
}
// C documentation
//
// /*
// ** This function is called to handle an FTS INSERT command. In other words,
// ** an INSERT statement of the form:
// **
// ** INSERT INTO fts(fts) VALUES($pCmd)
// ** INSERT INTO fts(fts, rank) VALUES($pCmd, $pVal)
// **
// ** Argument pVal is the value assigned to column "fts" by the INSERT
// ** statement. This function returns SQLITE_OK if successful, or an SQLite
// ** error code if an error occurs.
// **
// ** The commands implemented by this function are documented in the "Special
// ** INSERT Directives" section of the documentation. It should be updated if
// ** more commands are added to this function.
// */
func _fts5SpecialInsert(tls *libc.TLS, pTab uintptr, zCmd uintptr, pVal uintptr) (r int32) {
bp := tls.Alloc(16)
defer tls.Free(16)
var bLoadConfig, iArg, nMerge, rc int32
var pConfig uintptr
var _ /* bError at bp+0 */ int32
_, _, _, _, _ = bLoadConfig, iArg, nMerge, pConfig, rc
pConfig = (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig
rc = SQLITE_OK
**(**int32)(__ccgo_up(bp)) = 0
bLoadConfig = 0
if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+39996, zCmd) {
if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL {
_fts5SetVtabError(tls, pTab, __ccgo_ts+40007, 0)
rc = int32(SQLITE_ERROR)
} else {
rc = _sqlite3Fts5StorageDeleteAll(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage)
}
bLoadConfig = int32(1)
} else {
if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+40087, zCmd) {
if _fts5IsContentless(tls, pTab, int32(1)) != 0 {
_fts5SetVtabError(tls, pTab, __ccgo_ts+40095, 0)
rc = int32(SQLITE_ERROR)
} else {
rc = _sqlite3Fts5StorageRebuild(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage)
}
bLoadConfig = int32(1)
} else {
if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+18632, zCmd) {
rc = _sqlite3Fts5StorageOptimize(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage)
} else {
if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+40151, zCmd) {
nMerge = Xsqlite3_value_int(tls, pVal)
rc = _sqlite3Fts5StorageMerge(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, nMerge)
} else {
if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+40157, zCmd) {
iArg = Xsqlite3_value_int(tls, pVal)
rc = _sqlite3Fts5StorageIntegrity(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iArg)
} else {
if 0 == Xsqlite3_stricmp(tls, __ccgo_ts+40173, zCmd) {
rc = _sqlite3Fts5FlushToDisk(tls, pTab)
} else {
rc = _sqlite3Fts5FlushToDisk(tls, pTab)
if rc == SQLITE_OK {
rc = _sqlite3Fts5IndexLoadConfig(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex)
}
if rc == SQLITE_OK {
rc = _sqlite3Fts5ConfigSetValue(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig, zCmd, pVal, bp)
}
if rc == SQLITE_OK {
if **(**int32)(__ccgo_up(bp)) != 0 {
rc = int32(SQLITE_ERROR)
} else {
rc = _sqlite3Fts5StorageConfigValue(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).FpStorage, zCmd, pVal, 0)
}
}
}
}
}
}
}
}
if rc == SQLITE_OK && bLoadConfig != 0 {
(*TFts5Config)(unsafe.Pointer((*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig)).FiCookie = (*TFts5Config)(unsafe.Pointer((*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig)).FiCookie - 1
rc = _sqlite3Fts5IndexLoadConfig(tls, (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex)
}
return rc
}
func _fts5StorageCount(tls *libc.TLS, p uintptr, zSuffix uintptr, pnRow uintptr) (r int32) {
bp := tls.Alloc(48)
defer tls.Free(48)
var pConfig, zSql uintptr
var rc int32
var _ /* pCnt at bp+0 */ uintptr
_, _, _ = pConfig, rc, zSql
pConfig = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig
zSql = Xsqlite3_mprintf(tls, __ccgo_ts+41800, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix))
if zSql == uintptr(0) {
rc = int32(SQLITE_NOMEM)
} else {
**(**uintptr)(__ccgo_up(bp)) = uintptr(0)
rc = Xsqlite3_prepare_v2(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -int32(1), bp, uintptr(0))
if rc == SQLITE_OK {
if int32(SQLITE_ROW) == Xsqlite3_step(tls, **(**uintptr)(__ccgo_up(bp))) {
**(**Ti64)(__ccgo_up(pnRow)) = Xsqlite3_column_int64(tls, **(**uintptr)(__ccgo_up(bp)), 0)
}
rc = Xsqlite3_finalize(tls, **(**uintptr)(__ccgo_up(bp)))
}
}
Xsqlite3_free(tls, zSql)
return rc
}
func _fts5StorageRenameOne(tls *libc.TLS, pConfig uintptr, pRc uintptr, zTail uintptr, zName uintptr) {
bp := tls.Alloc(48)
defer tls.Free(48)
if **(**int32)(__ccgo_up(pRc)) == SQLITE_OK {
**(**int32)(__ccgo_up(pRc)) = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+41444, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail))
}
}
// C documentation
//
// /*
// ** Translate a string containing an fts5vocab table type to an
// ** FTS5_VOCAB_XXX constant. If successful, set *peType to the output
// ** value and return SQLITE_OK. Otherwise, set *pzErr to an error message
// ** and return SQLITE_ERROR.
// */
func _fts5VocabTableType(tls *libc.TLS, zType uintptr, pzErr uintptr, peType uintptr) (r int32) {
bp := tls.Alloc(32)
defer tls.Free(32)
var zCopy uintptr
var _ /* rc at bp+0 */ int32
_ = zCopy
**(**int32)(__ccgo_up(bp)) = SQLITE_OK
zCopy = _sqlite3Fts5Strndup(tls, bp, zType, -int32(1))
if **(**int32)(__ccgo_up(bp)) == SQLITE_OK {
_sqlite3Fts5Dequote(tls, zCopy)
if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+42217) == 0 {
**(**int32)(__ccgo_up(peType)) = FTS5_VOCAB_COL
} else {
if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+42221) == 0 {
**(**int32)(__ccgo_up(peType)) = int32(FTS5_VOCAB_ROW)
} else {
if Xsqlite3_stricmp(tls, zCopy, __ccgo_ts+42225) == 0 {
**(**int32)(__ccgo_up(peType)) = int32(FTS5_VOCAB_INSTANCE)
} else {
**(**uintptr)(__ccgo_up(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+42234, libc.VaList(bp+16, zCopy))
**(**int32)(__ccgo_up(bp)) = int32(SQLITE_ERROR)
}
}
}
Xsqlite3_free(tls, zCopy)
}
return **(**int32)(__ccgo_up(bp))
}
// C documentation
//
// /*
// ** The following routine is called if the stack overflows.
// */
func _fts5yyStackOverflow(tls *libc.TLS, fts5yypParser uintptr) {
var pParse uintptr
_ = pParse
pParse = (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse
for (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos > (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yystack {
_fts5yy_pop_parser_stack(tls, fts5yypParser)
}
/* Here code is inserted which will execute if the parser
** stack every overflows */
/******** Begin %stack_overflow code ******************************************/
_sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+37088, 0)
/******** End %stack_overflow code ********************************************/
(*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument var */
}
/*
** Print tracing information for a SHIFT action
*/
// C documentation
//
// /*
// ** The following code executes when a syntax error first occurs.
// */
func _fts5yy_syntax_error(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor int32, fts5yyminor TFts5Token) {
bp := tls.Alloc(32)
defer tls.Free(32)
var pParse uintptr
_ = pParse
pParse = (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse
/************ Begin %syntax_error code ****************************************/
_ = fts5yymajor /* Silence a compiler warning */
_sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+37116, libc.VaList(bp+8, fts5yyminor.Fn, fts5yyminor.Fp))
/************ End %syntax_error code ******************************************/
(*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument variable */
}
// C documentation
//
// /*
// ** Rtree virtual table module xBestIndex method. There are three
// ** table scan strategies to choose from (in order from most to
// ** least desirable):
// **
// ** idxNum idxStr Strategy
// ** ------------------------------------------------
// ** 1 "rowid" Direct lookup by rowid.
// ** 2 "rtree" R-tree overlap query using geopoly_overlap()
// ** 3 "rtree" R-tree within query using geopoly_within()
// ** 4 "fullscan" full-table scan.
// ** ------------------------------------------------
// */
func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) {
var iFuncTerm, iRowidTerm, idxNum, ii int32
var p uintptr
_, _, _, _, _ = iFuncTerm, iRowidTerm, idxNum, ii, p
iRowidTerm = -int32(1)
iFuncTerm = -int32(1)
idxNum = 0
_ = tab
ii = 0
for {
if !(ii < (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
break
}
p = (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(ii)*12
if !((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fusable != 0) {
goto _1
}
if (*Tsqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn < 0 && libc.Int32FromUint8((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == int32(SQLITE_INDEX_CONSTRAINT_EQ) {
iRowidTerm = ii
break
}
if (*Tsqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn == 0 && libc.Int32FromUint8((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) >= int32(SQLITE_INDEX_CONSTRAINT_FUNCTION) {
/* p->op==SQLITE_INDEX_CONSTRAINT_FUNCTION for geopoly_overlap()
** p->op==(SQLITE_INDEX_CONTRAINT_FUNCTION+1) for geopoly_within().
** See geopolyFindFunction() */
iFuncTerm = ii
idxNum = libc.Int32FromUint8((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) - int32(SQLITE_INDEX_CONSTRAINT_FUNCTION) + int32(2)
}
goto _1
_1:
;
ii = ii + 1
}
if iRowidTerm >= 0 {
(*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(1)
(*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 17965
(**(**Tsqlite3_index_constraint_usage)(__ccgo_up((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).FargvIndex = int32(1)
(**(**Tsqlite3_index_constraint_usage)(__ccgo_up((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).Fomit = uint8(1)
(*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(30)
(*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(1)
(*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxFlags = int32(SQLITE_INDEX_SCAN_UNIQUE)
return SQLITE_OK
}
if iFuncTerm >= 0 {
(*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum
(*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 29971
(**(**Tsqlite3_index_constraint_usage)(__ccgo_up((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).FargvIndex = int32(1)
(**(**Tsqlite3_index_constraint_usage)(__ccgo_up((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).Fomit = uint8(0)
(*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(300)
(*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(10)
return SQLITE_OK
}
(*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(4)
(*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 29977
(*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(3e+06)
(*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(100000)
return SQLITE_OK
}
// C documentation
//
// /*
// ** Report that geopoly_overlap() is an overloaded function suitable
// ** for use in xBestIndex.
// */
func _geopolyFindFunction(tls *libc.TLS, pVtab uintptr, nArg int32, zName uintptr, __ccgo_fp_pxFunc uintptr, ppArg uintptr) (r int32) {
_ = pVtab
_ = nArg
if Xsqlite3_stricmp(tls, zName, __ccgo_ts+30026) == 0 {
**(**uintptr)(__ccgo_up(__ccgo_fp_pxFunc)) = __ccgo_fp(_geopolyOverlapFunc)
**(**uintptr)(__ccgo_up(ppArg)) = uintptr(0)
return int32(SQLITE_INDEX_CONSTRAINT_FUNCTION)
}
if Xsqlite3_stricmp(tls, zName, __ccgo_ts+30042) == 0 {
**(**uintptr)(__ccgo_up(__ccgo_fp_pxFunc)) = __ccgo_fp(_geopolyWithinFunc)
**(**uintptr)(__ccgo_up(ppArg)) = uintptr(0)
return libc.Int32FromInt32(SQLITE_INDEX_CONSTRAINT_FUNCTION) + libc.Int32FromInt32(1)
}
return 0
}
// C documentation
//
// /*
// ** SQL function: geopoly_json(X)
// **
// ** Interpret X as a polygon and render it as a JSON array
// ** of coordinates. Or, if X is not a valid polygon, return NULL.
// */
func _geopolyJsonFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) {
bp := tls.Alloc(32)
defer tls.Free(32)
var db, p, x uintptr
var i int32
_, _, _, _ = db, i, p, x
p = _geopolyFuncParam(tls, context, **(**uintptr)(__ccgo_up(argv)), uintptr(0))
_ = argc
if p != 0 {
db = Xsqlite3_context_db_handle(tls, context)
x = Xsqlite3_str_new(tls, db)
Xsqlite3_str_append(tls, x, __ccgo_ts+26672, int32(1))
i = 0
for {
if !(i < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex) {
break
}
Xsqlite3_str_appendf(tls, x, __ccgo_ts+29835, libc.VaList(bp+8, float64(**(**TGeoCoord)(__ccgo_up(p + 8 + uintptr(i*int32(2))*4))), float64(**(**TGeoCoord)(__ccgo_up(p + 8 + uintptr(i*int32(2)+int32(1))*4)))))
goto _1
_1:
;
i = i + 1
}
Xsqlite3_str_appendf(tls, x, __ccgo_ts+29846, libc.VaList(bp+8, float64(**(**TGeoCoord)(__ccgo_up(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(**(**TGeoCoord)(__ccgo_up(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4)))))
Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -int32(1), __ccgo_fp(Xsqlite3_free))
Xsqlite3_free(tls, p)
}
}
// C documentation
//
// /*
// ** Interpret the given string as an auto-vacuum mode value.
// **
// ** The following strings, "none", "full" and "incremental" are
// ** acceptable, as are their numeric equivalents: 0, 1 and 2 respectively.
// */
func _getAutoVacuum(tls *libc.TLS, z uintptr) (r int32) {
var i, v1 int32
_, _ = i, v1
if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+8510) {
return BTREE_AUTOVACUUM_NONE
}
if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+19018) {
return int32(BTREE_AUTOVACUUM_FULL)
}
if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+19023) {
return int32(BTREE_AUTOVACUUM_INCR)
}
i = _sqlite3Atoi(tls, z)
if i >= 0 && i <= int32(2) {
v1 = i
} else {
v1 = 0
}
return libc.Int32FromUint8(libc.Uint8FromInt32(v1))
}
// C documentation
//
// /*
// ** Interpret the given string as a locking mode value.
// */
func _getLockingMode(tls *libc.TLS, z uintptr) (r int32) {
if z != 0 {
if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+19001) {
return int32(PAGER_LOCKINGMODE_EXCLUSIVE)
}
if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+19011) {
return PAGER_LOCKINGMODE_NORMAL
}
}
return -int32(1)
}
// C documentation
//
// /*
// ** Parameter zName is the name of a table that is about to be altered
// ** (either with ALTER TABLE ... RENAME TO or ALTER TABLE ... ADD COLUMN).
// ** If the table is a system table, this function leaves an error message
// ** in pParse->zErr (system tables may not be altered) and returns non-zero.
// **
// ** Or, if zName is not a system table, zero is returned.
// */
func _isAlterableTable(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int32) {
bp := tls.Alloc(16)
defer tls.Free(16)
if 0 == Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6758, int32(7)) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != uint32(0) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) != 0 {
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8645, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName))
return int32(1)
}
return 0
}
// C documentation
//
// /*
// ** Return true if the pExpr term from the RETURNING clause argument
// ** list is of the form "*". Raise an error if the terms if of the
// ** form "table.*".
// */
func _isAsteriskTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr) (r int32) {
if libc.Int32FromUint8((*TExpr)(unsafe.Pointer(pTerm)).Fop) == int32(TK_ASTERISK) {
return int32(1)
}
if libc.Int32FromUint8((*TExpr)(unsafe.Pointer(pTerm)).Fop) != int32(TK_DOT) {
return 0
}
if libc.Int32FromUint8((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pTerm)).FpRight)).Fop) != int32(TK_ASTERISK) {
return 0
}
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22524, 0)
return int32(1)
}
// C documentation
//
// /*
// ** Parameter pTab is the subject of an ALTER TABLE ... RENAME COLUMN
// ** command. This function checks if the table is a view or virtual
// ** table (columns of views or virtual tables may not be renamed). If so,
// ** it loads an error message into pParse and returns non-zero.
// **
// ** Or, if pTab is not a view or virtual table, zero is returned.
// */
func _isRealTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iOp int32) (r int32) {
bp := tls.Alloc(32)
defer tls.Free(32)
var azMsg [3]uintptr
var zType uintptr
_, _ = azMsg, zType
zType = uintptr(0)
if libc.Int32FromUint8((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) {
zType = __ccgo_ts + 11117
}
if libc.Int32FromUint8((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) {
zType = __ccgo_ts + 11122
}
if zType != 0 {
azMsg = [3]uintptr{
0: __ccgo_ts + 11136,
1: __ccgo_ts + 11154,
2: __ccgo_ts + 11171,
}
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11191, libc.VaList(bp+8, azMsg[iOp], zType, (*TTable)(unsafe.Pointer(pTab)).FzName))
return int32(1)
}
return 0
}
// C documentation
//
// /*
// ** Return TRUE (non-zero) if zTab is a valid name for the schema table pTab.
// */
func _isValidSchemaTableName(tls *libc.TLS, zTab uintptr, pTab uintptr, zDb uintptr) (r int32) {
var zLegacy uintptr
_ = zLegacy
if Xsqlite3_strnicmp(tls, zTab, __ccgo_ts+6758, int32(7)) != 0 {
return 0
}
zLegacy = (*TTable)(unsafe.Pointer(pTab)).FzName
if libc.Xstrcmp(tls, zLegacy+uintptr(7), __ccgo_ts+6766+7) == 0 {
if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6785+7) == 0 {
return int32(1)
}
if zDb == uintptr(0) {
return 0
}
if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6286+7) == 0 {
return int32(1)
}
if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6804+7) == 0 {
return int32(1)
}
} else {
if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6804+7) == 0 {
return int32(1)
}
}
return 0
}
// C documentation
//
// /*
// ** Generate a path error.
// **
// ** The specifics of the error are determined by the rc argument.
// **
// ** rc error
// ** ----------------- ----------------------
// ** JSON_LOOKUP_ARRAY "not an array"
// ** JSON_LOOKUP_TOODEEP "JSON nested too deep"
// ** JSON_LOOKUP_ERROR "malformed JSON"
// ** otherwise... "bad JSON path"
// **
// ** If ctx is not NULL then push the error message into ctx and return NULL.
// ** If ctx is NULL, then return the text of the error message.
// */
func _jsonBadPathError(tls *libc.TLS, ctx uintptr, zPath uintptr, rc int32) (r uintptr) {
bp := tls.Alloc(16)
defer tls.Free(16)
var zMsg uintptr
_ = zMsg
if rc == libc.Int32FromUint32(JSON_LOOKUP_NOTARRAY) {
zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+26608, libc.VaList(bp+8, zPath))
} else {
if rc == libc.Int32FromUint32(JSON_LOOKUP_ERROR) {
zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+26460, 0)
} else {
if rc == libc.Int32FromUint32(JSON_LOOKUP_TOODEEP) {
zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+26633, 0)
} else {
zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+26652, libc.VaList(bp+8, zPath))
}
}
}
if ctx == uintptr(0) {
return zMsg
}
if zMsg != 0 {
Xsqlite3_result_error(tls, ctx, zMsg, -int32(1))
Xsqlite3_free(tls, zMsg)
} else {
Xsqlite3_result_error_nomem(tls, ctx)
}
return uintptr(0)
}
// C documentation
//
// /*
// ** json_replace(JSON, PATH, VALUE, ...)
// **
// ** Replace the value at PATH with VALUE. If PATH does not already exist,
// ** this routine is a no-op. If JSON or PATH is malformed, throw an error.
// */
func _jsonReplaceFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) {
if argc < int32(1) {
return
}
if argc&int32(1) == 0 {
_jsonWrongNumArgs(tls, ctx, __ccgo_ts+17070)
return
}
_jsonInsertIntoBlob(tls, ctx, argc, argv, int32(JEDIT_REPL))
}
// C documentation
//
// /*
// ** Report the wrong number of arguments for json_insert(), json_replace()
// ** or json_set().
// */
func _jsonWrongNumArgs(tls *libc.TLS, pCtx uintptr, zFuncName uintptr) {
bp := tls.Alloc(16)
defer tls.Free(16)
var zMsg uintptr
_ = zMsg
zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+26506, libc.VaList(bp+8, zFuncName))
Xsqlite3_result_error(tls, pCtx, zMsg, -int32(1))
Xsqlite3_free(tls, zMsg)
}
/****************************************************************************
** Utility routines for dealing with the binary BLOB representation of JSON
****************************************************************************/
// C documentation
//
// /* Human-readable names for the JSONB values. The index for each
// ** string must correspond to the JSONB_* integer above.
// */
var _jsonbType = [17]uintptr{
0: __ccgo_ts + 1688,
1: __ccgo_ts + 8180,
2: __ccgo_ts + 8185,
3: __ccgo_ts + 6494,
4: __ccgo_ts + 6494,
5: __ccgo_ts + 6489,
6: __ccgo_ts + 6489,
7: __ccgo_ts + 8489,
8: __ccgo_ts + 8489,
9: __ccgo_ts + 8489,
10: __ccgo_ts + 8489,
11: __ccgo_ts + 26397,
12: __ccgo_ts + 26403,
13: __ccgo_ts + 1702,
14: __ccgo_ts + 1702,
15: __ccgo_ts + 1702,
16: __ccgo_ts + 1702,
}
// C documentation
//
// /*
// ** Check a single element of the JSONB in pParse for validity.
// **
// ** The element to be checked starts at offset i and must end at on the
// ** last byte before iEnd.
// **
// ** Return 0 if everything is correct. Return the 1-based byte offset of the
// ** error if a problem is detected. (In other words, if the error is at offset
// ** 0, return 1).
// */
func _jsonbValidityCheck(tls *libc.TLS, pParse uintptr, i Tu32, iEnd Tu32, iDepth Tu32) (r Tu32) {
bp := tls.Alloc(16)
defer tls.Free(16)
var cnt, j, k, n, sub, sub1, szC Tu32
var seen, x Tu8
var z uintptr
var v1 uint32
var _ /* c at bp+4 */ Tu32
var _ /* sz at bp+0 */ Tu32
_, _, _, _, _, _, _, _, _, _, _ = cnt, j, k, n, seen, sub, sub1, szC, x, z, v1
if iDepth > uint32(JSON_MAX_DEPTH) {
return i + uint32(1)
}
**(**Tu32)(__ccgo_up(bp)) = uint32(0)
n = _jsonbPayloadSize(tls, pParse, i, bp)
if n == uint32(0) {
return i + uint32(1)
} /* Checked by caller */
if i+n+**(**Tu32)(__ccgo_up(bp)) != iEnd {
return i + uint32(1)
} /* Checked by caller */
z = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob
x = libc.Uint8FromInt32(libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(i)))) & int32(0x0f))
switch libc.Int32FromUint8(x) {
case JSONB_NULL:
fallthrough
case int32(JSONB_TRUE):
fallthrough
case int32(JSONB_FALSE):
if n+**(**Tu32)(__ccgo_up(bp)) == uint32(1) {
v1 = uint32(0)
} else {
v1 = i + uint32(1)
}
return v1
case int32(JSONB_INT):
if **(**Tu32)(__ccgo_up(bp)) < uint32(1) {
return i + uint32(1)
}
j = i + n
if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) == int32('-') {
j = j + 1
if **(**Tu32)(__ccgo_up(bp)) < uint32(2) {
return i + uint32(1)
}
}
k = i + n + **(**Tu32)(__ccgo_up(bp))
for j < k {
if libc.Int32FromUint8(_sqlite3CtypeMap[**(**Tu8)(__ccgo_up(z + uintptr(j)))])&int32(0x04) != 0 {
j = j + 1
} else {
return j + uint32(1)
}
}
return uint32(0)
case int32(JSONB_INT5):
if **(**Tu32)(__ccgo_up(bp)) < uint32(3) {
return i + uint32(1)
}
j = i + n
if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) == int32('-') {
if **(**Tu32)(__ccgo_up(bp)) < uint32(4) {
return i + uint32(1)
}
j = j + 1
}
if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) != int32('0') {
return i + uint32(1)
}
if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1))))) != int32('x') && libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1))))) != int32('X') {
return j + uint32(2)
}
j = j + uint32(2)
k = i + n + **(**Tu32)(__ccgo_up(bp))
for j < k {
if libc.Int32FromUint8(_sqlite3CtypeMap[**(**Tu8)(__ccgo_up(z + uintptr(j)))])&int32(0x08) != 0 {
j = j + 1
} else {
return j + uint32(1)
}
}
return uint32(0)
case int32(JSONB_FLOAT):
fallthrough
case int32(JSONB_FLOAT5):
seen = uint8(0) /* 0: initial. 1: '.' seen 2: 'e' seen */
if **(**Tu32)(__ccgo_up(bp)) < uint32(2) {
return i + uint32(1)
}
j = i + n
k = j + **(**Tu32)(__ccgo_up(bp))
if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) == int32('-') {
j = j + 1
if **(**Tu32)(__ccgo_up(bp)) < uint32(3) {
return i + uint32(1)
}
}
if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) == int32('.') {
if libc.Int32FromUint8(x) == int32(JSONB_FLOAT) {
return j + uint32(1)
}
if !(libc.Int32FromUint8(_sqlite3CtypeMap[**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1))))])&libc.Int32FromInt32(0x04) != 0) {
return j + uint32(1)
}
j = j + uint32(2)
seen = uint8(1)
} else {
if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) == int32('0') && libc.Int32FromUint8(x) == int32(JSONB_FLOAT) {
if j+uint32(3) > k {
return j + uint32(1)
}
if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1))))) != int32('.') && libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1))))) != int32('e') && libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1))))) != int32('E') {
return j + uint32(1)
}
j = j + 1
}
}
for {
if !(j < k) {
break
}
if libc.Int32FromUint8(_sqlite3CtypeMap[**(**Tu8)(__ccgo_up(z + uintptr(j)))])&int32(0x04) != 0 {
goto _2
}
if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) == int32('.') {
if libc.Int32FromUint8(seen) > 0 {
return j + uint32(1)
}
if libc.Int32FromUint8(x) == int32(JSONB_FLOAT) && (j == k-uint32(1) || !(libc.Int32FromUint8(_sqlite3CtypeMap[**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1))))])&libc.Int32FromInt32(0x04) != 0)) {
return j + uint32(1)
}
seen = uint8(1)
goto _2
}
if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) == int32('e') || libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) == int32('E') {
if libc.Int32FromUint8(seen) == int32(2) {
return j + uint32(1)
}
if j == k-uint32(1) {
return j + uint32(1)
}
if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1))))) == int32('+') || libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1))))) == int32('-') {
j = j + 1
if j == k-uint32(1) {
return j + uint32(1)
}
}
seen = uint8(2)
goto _2
}
return j + uint32(1)
goto _2
_2:
;
j = j + 1
}
if libc.Int32FromUint8(seen) == 0 {
return i + uint32(1)
}
return uint32(0)
case int32(JSONB_TEXT):
j = i + n
k = j + **(**Tu32)(__ccgo_up(bp))
for j < k {
if !(_jsonIsOk[**(**Tu8)(__ccgo_up(z + uintptr(j)))] != 0) && libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) != int32('\'') {
return j + uint32(1)
}
j = j + 1
}
return uint32(0)
case int32(JSONB_TEXTJ):
fallthrough
case int32(JSONB_TEXT5):
j = i + n
k = j + **(**Tu32)(__ccgo_up(bp))
for j < k {
if !(_jsonIsOk[**(**Tu8)(__ccgo_up(z + uintptr(j)))] != 0) && libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) != int32('\'') {
if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) == int32('"') {
if libc.Int32FromUint8(x) == int32(JSONB_TEXTJ) {
return j + uint32(1)
}
} else {
if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) <= int32(0x1f) {
/* Control characters in JSON5 string literals are ok */
if libc.Int32FromUint8(x) == int32(JSONB_TEXTJ) {
return j + uint32(1)
}
} else {
if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) != int32('\\') || j+uint32(1) >= k {
return j + uint32(1)
} else {
if libc.Xstrchr(tls, __ccgo_ts+26549, libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1)))))) != uintptr(0) {
j = j + 1
} else {
if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1))))) == int32('u') {
if j+uint32(5) >= k {
return j + uint32(1)
}
if !(_jsonIs4Hex(tls, z+uintptr(j+uint32(2))) != 0) {
return j + uint32(1)
}
j = j + 1
} else {
if libc.Int32FromUint8(x) != int32(JSONB_TEXT5) {
return j + uint32(1)
} else {
**(**Tu32)(__ccgo_up(bp + 4)) = uint32(0)
szC = _jsonUnescapeOneChar(tls, z+uintptr(j), k-j, bp+4)
if **(**Tu32)(__ccgo_up(bp + 4)) == uint32(JSON_INVALID_CHAR) {
return j + uint32(1)
}
j = j + (szC - uint32(1))
}
}
}
}
}
}
}
j = j + 1
}
return uint32(0)
case int32(JSONB_TEXTRAW):
return uint32(0)
case int32(JSONB_ARRAY):
j = i + n
k = j + **(**Tu32)(__ccgo_up(bp))
for j < k {
**(**Tu32)(__ccgo_up(bp)) = uint32(0)
n = _jsonbPayloadSize(tls, pParse, j, bp)
if n == uint32(0) {
return j + uint32(1)
}
if j+n+**(**Tu32)(__ccgo_up(bp)) > k {
return j + uint32(1)
}
sub = _jsonbValidityCheck(tls, pParse, j, j+n+**(**Tu32)(__ccgo_up(bp)), iDepth+uint32(1))
if sub != 0 {
return sub
}
j = j + (n + **(**Tu32)(__ccgo_up(bp)))
}
return uint32(0)
case int32(JSONB_OBJECT):
cnt = uint32(0)
j = i + n
k = j + **(**Tu32)(__ccgo_up(bp))
for j < k {
**(**Tu32)(__ccgo_up(bp)) = uint32(0)
n = _jsonbPayloadSize(tls, pParse, j, bp)
if n == uint32(0) {
return j + uint32(1)
}
if j+n+**(**Tu32)(__ccgo_up(bp)) > k {
return j + uint32(1)
}
if cnt&uint32(1) == uint32(0) {
x = libc.Uint8FromInt32(libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) & int32(0x0f))
if libc.Int32FromUint8(x) < int32(JSONB_TEXT) || libc.Int32FromUint8(x) > int32(JSONB_TEXTRAW) {
return j + uint32(1)
}
}
sub1 = _jsonbValidityCheck(tls, pParse, j, j+n+**(**Tu32)(__ccgo_up(bp)), iDepth+uint32(1))
if sub1 != 0 {
return sub1
}
cnt = cnt + 1
j = j + (n + **(**Tu32)(__ccgo_up(bp)))
}
if cnt&uint32(1) != uint32(0) {
return j + uint32(1)
}
return uint32(0)
default:
return i + uint32(1)
}
return r
}
// C documentation
//
// /*
// ** Load content from the sqlite_stat4 table into
// ** the Index.aSample[] arrays of all indices.
// */
func _loadStat4(tls *libc.TLS, db uintptr, zDb uintptr) (r int32) {
var pStat4, v1 uintptr
var rc int32
var v2 bool
_, _, _, _ = pStat4, rc, v1, v2
rc = SQLITE_OK
if v2 = (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0); v2 {
v1 = _sqlite3FindTable(tls, db, __ccgo_ts+12861, zDb)
pStat4 = v1
}
if v2 && v1 != uintptr(0) && libc.Int32FromUint8((*TTable)(unsafe.Pointer(pStat4)).FeTabType) == TABTYP_NORM {
rc = _loadStatTbl(tls, db, __ccgo_ts+13087, __ccgo_ts+13156, zDb)
}
return rc
}
// C documentation
//
// /*
// ** File control method. For custom operations on an memdb-file.
// */
func _memdbFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r int32) {
bp := tls.Alloc(32)
defer tls.Free(32)
var iLimit Tsqlite3_int64
var p uintptr
var rc int32
_, _, _ = iLimit, p, rc
p = (*TMemFile)(unsafe.Pointer(pFile)).FpStore
rc = int32(SQLITE_NOTFOUND)
_memdbEnter(tls, p)
if op == int32(SQLITE_FCNTL_VFSNAME) {
**(**uintptr)(__ccgo_up(pArg)) = Xsqlite3_mprintf(tls, __ccgo_ts+4120, libc.VaList(bp+8, (*TMemStore)(unsafe.Pointer(p)).FaData, (*TMemStore)(unsafe.Pointer(p)).Fsz))
rc = SQLITE_OK
}
if op == int32(SQLITE_FCNTL_SIZE_LIMIT) {
iLimit = **(**Tsqlite3_int64)(__ccgo_up(pArg))
if iLimit < (*TMemStore)(unsafe.Pointer(p)).Fsz {
if iLimit < 0 {
iLimit = (*TMemStore)(unsafe.Pointer(p)).FszMax
} else {
iLimit = (*TMemStore)(unsafe.Pointer(p)).Fsz
}
}
(*TMemStore)(unsafe.Pointer(p)).FszMax = iLimit
**(**Tsqlite3_int64)(__ccgo_up(pArg)) = iLimit
rc = SQLITE_OK
}
_memdbLeave(tls, p)
return rc
}
// C documentation
//
// /*
// ** Populate buffer zOut with the full canonical pathname corresponding
// ** to the pathname in zPath. zOut is guaranteed to point to a buffer
// ** of at least (INST_MAX_PATHNAME+1) bytes.
// */
func _memdbFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) (r int32) {
bp := tls.Alloc(16)
defer tls.Free(16)
_ = pVfs
Xsqlite3_snprintf(tls, nOut, zOut, __ccgo_ts+3942, libc.VaList(bp+8, zPath))
return SQLITE_OK
}
var _memdb_vfs = Tsqlite3_vfs{
FiVersion: int32(2),
FmxPathname: int32(1024),
FzName: __ccgo_ts + 4114,
}
// C documentation
//
// /*
// ** Handle the special case of a compound-select that originates from a
// ** VALUES clause. By handling this as a special case, we avoid deep
// ** recursion, and thus do not need to enforce the SQLITE_LIMIT_COMPOUND_SELECT
// ** on a VALUES clause.
// **
// ** Because the Select object originates from a VALUES clause:
// ** (1) There is no LIMIT or OFFSET or else there is a LIMIT of exactly 1
// ** (2) All terms are UNION ALL
// ** (3) There is no ORDER BY clause
// **
// ** The "LIMIT of exactly 1" case of condition (1) comes about when a VALUES
// ** clause occurs within scalar expression (ex: "SELECT (VALUES(1),(2),(3))").
// ** The sqlite3CodeSubselect will have added the LIMIT 1 clause in tht case.
// ** Since the limit is exactly 1, we only need to evaluate the left-most VALUES.
// */
func _multiSelectValues(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r int32) {
bp := tls.Alloc(32)
defer tls.Free(32)
var bShowAll, nRow, rc int32
var v1 uintptr
_, _, _, _ = bShowAll, nRow, rc, v1
nRow = int32(1)
rc = 0
bShowAll = libc.BoolInt32((*TSelect)(unsafe.Pointer(p)).FpLimit == uintptr(0))
for cond := true; cond; cond = int32(1) != 0 {
if (*TSelect)(unsafe.Pointer(p)).FpWin != 0 {
return -int32(1)
}
if (*TSelect)(unsafe.Pointer(p)).FpPrior == uintptr(0) {
break
}
p = (*TSelect)(unsafe.Pointer(p)).FpPrior
nRow = nRow + bShowAll
}
if nRow == int32(1) {
v1 = __ccgo_ts + 1702
} else {
v1 = __ccgo_ts + 20807
}
_sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20809, libc.VaList(bp+8, nRow, v1))
for p != 0 {
_selectInnerLoop(tls, pParse, p, -int32(1), uintptr(0), uintptr(0), pDest, int32(1), int32(1))
if !(bShowAll != 0) {
break
}
(*TSelect)(unsafe.Pointer(p)).FnSelectRow = int16(nRow)
p = (*TSelect)(unsafe.Pointer(p)).FpNext
}
return rc
}
// C documentation
//
// /*
// ** Report an error that an expression is not valid for some set of
// ** pNC->ncFlags values determined by validMask.
// **
// ** static void notValid(
// ** Parse *pParse, // Leave error message here
// ** NameContext *pNC, // The name context
// ** const char *zMsg, // Type of error
// ** int validMask, // Set of contexts for which prohibited
// ** Expr *pExpr // Invalidate this expression on error
// ** ){...}
// **
// ** As an optimization, since the conditional is almost always false
// ** (because errors are rare), the conditional is moved outside of the
// ** function call using a macro.
// */
func _notValidImpl(tls *libc.TLS, pParse uintptr, pNC uintptr, zMsg uintptr, pExpr uintptr, pError uintptr) {
bp := tls.Alloc(32)
defer tls.Free(32)
var zIn uintptr
_ = zIn
zIn = __ccgo_ts + 7100
if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IdxExpr) != 0 {
zIn = __ccgo_ts + 7128
} else {
if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IsCheck) != 0 {
zIn = __ccgo_ts + 7146
} else {
if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_GenCol) != 0 {
zIn = __ccgo_ts + 7164
}
}
}
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7182, libc.VaList(bp+8, zMsg, zIn))
if pExpr != 0 {
(*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL)
}
_sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pError)
}
// C documentation
//
// /*
// ** Implementation of ntile(). This assumes that the window frame has
// ** been coerced to:
// **
// ** ROWS CURRENT ROW AND UNBOUNDED FOLLOWING
// */
func _ntileStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) {
var p uintptr
_ = p
_ = nArg
p = Xsqlite3_aggregate_context(tls, pCtx, int32(24))
if p != 0 {
if (*TNtileCtx)(unsafe.Pointer(p)).FnTotal == 0 {
(*TNtileCtx)(unsafe.Pointer(p)).FnParam = Xsqlite3_value_int64(tls, **(**uintptr)(__ccgo_up(apArg)))
if (*TNtileCtx)(unsafe.Pointer(p)).FnParam <= 0 {
Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24233, -int32(1))
}
}
(*TNtileCtx)(unsafe.Pointer(p)).FnTotal = (*TNtileCtx)(unsafe.Pointer(p)).FnTotal + 1
}
}
// C documentation
//
// /* Add a single new term to an ExprList that is used to store a
// ** list of identifiers. Report an error if the ID list contains
// ** a COLLATE clause or an ASC or DESC keyword, except ignore the
// ** error while parsing a legacy schema.
// */
func _parserAddExprIdListTerm(tls *libc.TLS, pParse uintptr, pPrior uintptr, pIdToken uintptr, hasCollate int32, sortOrder int32) (r uintptr) {
bp := tls.Alloc(32)
defer tls.Free(32)
var p uintptr
_ = p
p = _sqlite3ExprListAppend(tls, pParse, pPrior, uintptr(0))
if (hasCollate != 0 || sortOrder != -int32(1)) && libc.Int32FromUint8((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0 {
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+24943, libc.VaList(bp+8, (*TToken)(unsafe.Pointer(pIdToken)).Fn, (*TToken)(unsafe.Pointer(pIdToken)).Fz))
}
_sqlite3ExprListSetName(tls, pParse, p, pIdToken, int32(1))
return p
}
/**************** End of %include directives **********************************/
/* These constants specify the various numeric values for terminal symbols.
***************** Begin token definitions *************************************/
/**************** End token definitions ***************************************/
// C documentation
//
// /*
// ** Generate a syntax error
// */
func _parserSyntaxError(tls *libc.TLS, pParse uintptr, p uintptr) {
bp := tls.Alloc(16)
defer tls.Free(16)
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+24828, libc.VaList(bp+8, p))
}
// C documentation
//
// /* Names of columns for pragmas that return multi-column result
// ** or that return single-column results where the name of the
// ** result column is different from the name of the pragma
// */
var _pragCName = [57]uintptr{
0: __ccgo_ts + 5650,
1: __ccgo_ts + 17782,
2: __ccgo_ts + 9379,
3: __ccgo_ts + 17786,
4: __ccgo_ts + 17791,
5: __ccgo_ts + 17794,
6: __ccgo_ts + 17804,
7: __ccgo_ts + 17814,
8: __ccgo_ts + 17820,
9: __ccgo_ts + 17824,
10: __ccgo_ts + 17829,
11: __ccgo_ts + 17834,
12: __ccgo_ts + 17842,
13: __ccgo_ts + 17853,
14: __ccgo_ts + 17856,
15: __ccgo_ts + 17824,
16: __ccgo_ts + 17863,
17: __ccgo_ts + 17829,
18: __ccgo_ts + 17871,
19: __ccgo_ts + 17875,
20: __ccgo_ts + 17880,
21: __ccgo_ts + 17886,
22: __ccgo_ts + 17824,
23: __ccgo_ts + 17829,
24: __ccgo_ts + 17893,
25: __ccgo_ts + 17898,
26: __ccgo_ts + 17901,
27: __ccgo_ts + 17908,
28: __ccgo_ts + 17820,
29: __ccgo_ts + 17824,
30: __ccgo_ts + 17914,
31: __ccgo_ts + 17919,
32: __ccgo_ts + 17924,
33: __ccgo_ts + 17782,
34: __ccgo_ts + 17824,
35: __ccgo_ts + 17928,
36: __ccgo_ts + 17935,
37: __ccgo_ts + 17942,
38: __ccgo_ts + 13050,
39: __ccgo_ts + 13046,
40: __ccgo_ts + 17950,
41: __ccgo_ts + 17955,
42: __ccgo_ts + 17960,
43: __ccgo_ts + 9379,
44: __ccgo_ts + 17965,
45: __ccgo_ts + 5653,
46: __ccgo_ts + 17971,
47: __ccgo_ts + 17976,
48: __ccgo_ts + 17167,
49: __ccgo_ts + 17981,
50: __ccgo_ts + 17782,
51: __ccgo_ts + 17824,
52: __ccgo_ts + 17994,
53: __ccgo_ts + 17999,
54: __ccgo_ts + 18008,
55: __ccgo_ts + 18015,
56: __ccgo_ts + 18026,
}
// C documentation
//
// /*
// ** Create zero or more entries in the output for the SQL functions
// ** defined by FuncDef p.
// */
func _pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, showInternFuncs int32) {
bp := tls.Alloc(64)
defer tls.Free(64)
var mask Tu32
var zType uintptr
_, _ = mask, zType
mask = libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_INNOCUOUS) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL))
if showInternFuncs != 0 {
mask = uint32(0xffffffff)
}
for {
if !(p != 0) {
break
}
if (*TFuncDef)(unsafe.Pointer(p)).FxSFunc == uintptr(0) {
goto _1
}
if (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_INTERNAL) != uint32(0) && showInternFuncs == 0 {
goto _1
}
if (*TFuncDef)(unsafe.Pointer(p)).FxValue != uintptr(0) {
zType = __ccgo_ts + 19205
} else {
if (*TFuncDef)(unsafe.Pointer(p)).FxFinalize != uintptr(0) {
zType = __ccgo_ts + 19207
} else {
zType = __ccgo_ts + 7911
}
}
_sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+19209, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, _azEnc[(*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK)], int32((*TFuncDef)(unsafe.Pointer(p)).FnArg), (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&mask^uint32(SQLITE_INNOCUOUS)))
goto _1
_1:
;
p = (*TFuncDef)(unsafe.Pointer(p)).FpNext
}
}
// C documentation
//
// /*
// ** Prepare the SQL statement in buffer zSql against database handle db.
// ** If successful, set *ppStmt to point to the new statement and return
// ** SQLITE_OK.
// **
// ** Otherwise, if an error does occur, set *ppStmt to NULL and return
// ** an SQLite error code. Additionally, set output variable *pzErrmsg to
// ** point to a buffer containing an error message. It is the responsibility
// ** of the caller to (eventually) free this buffer using sqlite3_free().
// */
func _prepareAndCollectError(tls *libc.TLS, db uintptr, ppStmt uintptr, pzErrmsg uintptr, zSql uintptr) (r int32) {
bp := tls.Alloc(16)
defer tls.Free(16)
var rc int32
_ = rc
rc = Xsqlite3_prepare_v2(tls, db, zSql, -int32(1), ppStmt, uintptr(0))
if rc != SQLITE_OK {
**(**uintptr)(__ccgo_up(pzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+3942, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db)))
**(**uintptr)(__ccgo_up(ppStmt)) = uintptr(0)
}
return rc
}
// C documentation
//
// /*
// ** The SELECT statement iterating through the keys for the current object
// ** (p->objiter.pSelect) currently points to a valid row. However, there
// ** is something wrong with the rbu_control value in the rbu_control value
// ** stored in the (p->nCol+1)'th column. Set the error code and error message
// ** of the RBU handle to something reflecting this.
// */
func _rbuBadControlError(tls *libc.TLS, p uintptr) {
(*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR)
(*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31744, 0)
}
// C documentation
//
// /*
// ** If there is a "*-oal" file in the file-system corresponding to the
// ** target database in the file-system, delete it. If an error occurs,
// ** leave an error code and error message in the rbu handle.
// */
func _rbuDeleteOalFile(tls *libc.TLS, p uintptr) {
bp := tls.Alloc(32)
defer tls.Free(32)
var zOal uintptr
var _ /* pVfs at bp+0 */ uintptr
_ = zOal
zOal = _rbuMPrintf(tls, p, __ccgo_ts+33750, libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget))
if zOal != 0 {
**(**uintptr)(__ccgo_up(bp)) = uintptr(0)
Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6818, int32(SQLITE_FCNTL_VFS_POINTER), bp)
(*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp)))).FxDelete})))(tls, **(**uintptr)(__ccgo_up(bp)), zOal, 0)
Xsqlite3_free(tls, zOal)
}
}
// C documentation
//
// /*
// ** Return true if the database handle passed as the only argument
// ** was opened with the rbu_exclusive_checkpoint=1 URI parameter
// ** specified. Or false otherwise.
// */
func _rbuExclusiveCheckpoint(tls *libc.TLS, db uintptr) (r int32) {
var zUri uintptr
_ = zUri
zUri = Xsqlite3_db_filename(tls, db, uintptr(0))
return Xsqlite3_uri_boolean(tls, zUri, __ccgo_ts+33725, 0)
}
// C documentation
//
// /*
// ** Finalize the statement passed as the second argument.
// **
// ** If the sqlite3_finalize() call indicates that an error occurs, and the
// ** rbu handle error code is not already set, set the error code and error
// ** message accordingly.
// */
func _rbuFinalize(tls *libc.TLS, p uintptr, pStmt uintptr) {
bp := tls.Alloc(16)
defer tls.Free(16)
var db uintptr
var rc int32
_, _ = db, rc
db = Xsqlite3_db_handle(tls, pStmt)
rc = Xsqlite3_finalize(tls, pStmt)
if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && rc != SQLITE_OK {
(*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc
(*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+3942, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db)))
}
}
// C documentation
//
// /*
// ** Take an EXCLUSIVE lock on the database file. Return SQLITE_OK if
// ** successful, or an SQLite error code otherwise.
// */
func _rbuLockDatabase(tls *libc.TLS, db uintptr) (r int32) {
bp := tls.Alloc(16)
defer tls.Free(16)
var rc int32
var _ /* fd at bp+0 */ uintptr
_ = rc
rc = SQLITE_OK
**(**uintptr)(__ccgo_up(bp)) = uintptr(0)
Xsqlite3_file_control(tls, db, __ccgo_ts+6818, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp)
if **(**uintptr)(__ccgo_up(bp)) != 0 {
Xsqlite3_file_control(tls, db, __ccgo_ts+6818, int32(SQLITE_FCNTL_FILE_POINTER), bp)
rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp)))).FpMethods)).FxLock})))(tls, **(**uintptr)(__ccgo_up(bp)), int32(SQLITE_LOCK_SHARED))
if rc == SQLITE_OK {
rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp)))).FpMethods)).FxUnlock})))(tls, **(**uintptr)(__ccgo_up(bp)), SQLITE_LOCK_NONE)
}
Xsqlite3_file_control(tls, db, __ccgo_ts+6818, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp)
} else {
Xsqlite3_file_control(tls, db, __ccgo_ts+6818, int32(SQLITE_FCNTL_FILE_POINTER), bp)
}
if rc == SQLITE_OK && (*Tsqlite3_file)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp)))).FpMethods != 0 {
rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp)))).FpMethods)).FxLock})))(tls, **(**uintptr)(__ccgo_up(bp)), int32(SQLITE_LOCK_SHARED))
if rc == SQLITE_OK {
rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp)))).FpMethods)).FxLock})))(tls, **(**uintptr)(__ccgo_up(bp)), int32(SQLITE_LOCK_EXCLUSIVE))
}
}
return rc
}
func _rbuOpenDbhandle(tls *libc.TLS, p uintptr, zName uintptr, bUseVfs int32) (r uintptr) {
bp := tls.Alloc(32)
defer tls.Free(32)
var flags int32
var v1 uintptr
var _ /* db at bp+0 */ uintptr
_, _ = flags, v1
**(**uintptr)(__ccgo_up(bp)) = uintptr(0)
if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK {
flags = libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE) | libc.Int32FromInt32(SQLITE_OPEN_URI)
if bUseVfs != 0 {
v1 = (*Tsqlite3rbu)(unsafe.Pointer(p)).FzVfsName
} else {
v1 = uintptr(0)
}
(*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_open_v2(tls, zName, bp, flags, v1)
if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc != 0 {
(*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+3942, libc.VaList(bp+16, Xsqlite3_errmsg(tls, **(**uintptr)(__ccgo_up(bp)))))
Xsqlite3_close(tls, **(**uintptr)(__ccgo_up(bp)))
**(**uintptr)(__ccgo_up(bp)) = uintptr(0)
}
}
return **(**uintptr)(__ccgo_up(bp))
}
// C documentation
//
// /*
// ** This function is called as part of initializing or reinitializing an
// ** incremental checkpoint.
// **
// ** It populates the sqlite3rbu.aFrame[] array with the set of
// ** (wal frame -> db page) copy operations required to checkpoint the
// ** current wal file, and obtains the set of shm locks required to safely
// ** perform the copy operations directly on the file-system.
// **
// ** If argument pState is not NULL, then the incremental checkpoint is
// ** being resumed. In this case, if the checksum of the wal-index-header
// ** following recovery is not the same as the checksum saved in the RbuState
// ** object, then the rbu handle is set to DONE state. This occurs if some
// ** other client appends a transaction to the wal file in the middle of
// ** an incremental checkpoint.
// */
func _rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) {
var nSectorSize, rc2, v1 int32
var pDb, pWal uintptr
_, _, _, _, _ = nSectorSize, pDb, pWal, rc2, v1
/* If pState is NULL, then the wal file may not have been opened and
** recovered. Running a read-statement here to ensure that doing so
** does not interfere with the "capture" process below. */
if pState == uintptr(0) {
(*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = 0
if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK {
(*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+33644, uintptr(0), uintptr(0), uintptr(0))
}
}
/* Assuming no error has occurred, run a "restart" checkpoint with the
** sqlite3rbu.eStage variable set to CAPTURE. This turns on the following
** special behaviour in the rbu VFS:
**
** * If the exclusive shm WRITER or READ0 lock cannot be obtained,
** the checkpoint fails with SQLITE_BUSY (normally SQLite would
** proceed with running a passive checkpoint instead of failing).
**
** * Attempts to read from the *-wal file or write to the database file
** do not perform any IO. Instead, the frame/page combinations that
** would be read/written are recorded in the sqlite3rbu.aFrame[]
** array.
**
** * Calls to xShmLock(UNLOCK) to release the exclusive shm WRITER,
** READ0 and CHECKPOINT locks taken as part of the checkpoint are
** no-ops. These locks will not be released until the connection
** is closed.
**
** * Attempting to xSync() the database file causes an SQLITE_NOTICE
** error.
**
** As a result, unless an error (i.e. OOM or SQLITE_BUSY) occurs, the
** checkpoint below fails with SQLITE_NOTICE, and leaves the aFrame[]
** array populated with a set of (frame -> page) mappings. Because the
** WRITER, CHECKPOINT and READ0 locks are still held, it is safe to copy
** data from the wal file into the database file according to the
** contents of aFrame[].
*/
if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK {
(*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CAPTURE)
rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+33690, uintptr(0), uintptr(0), uintptr(0))
if rc2 != int32(SQLITE_NOTICE) {
(*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc2
}
}
if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FnFrame > 0 {
(*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CKPT)
if pState != 0 {
v1 = (*TRbuState)(unsafe.Pointer(pState)).FnRow
} else {
v1 = 0
}
(*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep = v1
(*Tsqlite3rbu)(unsafe.Pointer(p)).FaBuf = _rbuMalloc(tls, p, int64((*Tsqlite3rbu)(unsafe.Pointer(p)).Fpgsz))
(*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum = _rbuShmChecksum(tls, p)
}
if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK {
if (*Tsqlite3rbu)(unsafe.Pointer(p)).FnFrame == 0 || pState != 0 && (*TRbuState)(unsafe.Pointer(pState)).FiWalCksum != (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum {
(*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_DONE)
(*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_DONE)
} else {
pDb = (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpReal
pWal = (*Trbu_file)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd)).FpReal
nSectorSize = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(pDb)).FpMethods)).FxSectorSize})))(tls, pDb)
if nSectorSize > (*Tsqlite3rbu)(unsafe.Pointer(p)).Fpgsz {
(*Tsqlite3rbu)(unsafe.Pointer(p)).FnPagePerSector = nSectorSize / (*Tsqlite3rbu)(unsafe.Pointer(p)).Fpgsz
} else {
(*Tsqlite3rbu)(unsafe.Pointer(p)).FnPagePerSector = int32(1)
}
/* Call xSync() on the wal file. This causes SQLite to sync the
** directory in which the target database and the wal file reside, in
** case it has not been synced since the rename() call in
** rbuMoveOalFile(). */
(*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(pWal)).FpMethods)).FxSync})))(tls, pWal, int32(SQLITE_SYNC_NORMAL))
}
}
}
// C documentation
//
// /*
// ** File control method. For custom operations on an rbuVfs-file.
// */
func _rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r int32) {
bp := tls.Alloc(32)
defer tls.Free(32)
var p, pRbu, pRbu1, pRbuVfs, xControl, zIn, zOut uintptr
var rc int32
var _ /* dummy at bp+0 */ uintptr
_, _, _, _, _, _, _, _ = p, pRbu, pRbu1, pRbuVfs, rc, xControl, zIn, zOut
p = pFile
xControl = (*Tsqlite3_io_methods)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods)).FxFileControl
if op == int32(SQLITE_FCNTL_RBU) {
pRbu = pArg
/* First try to find another RBU vfs lower down in the vfs stack. If
** one is found, this vfs will operate in pass-through mode. The lower
** level vfs will do the special RBU handling. */
rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xControl})))(tls, (*Trbu_file)(unsafe.Pointer(p)).FpReal, op, pArg)
if rc == int32(SQLITE_NOTFOUND) {
/* Now search for a zipvfs instance lower down in the VFS stack. If
** one is found, this is an error. */
**(**uintptr)(__ccgo_up(bp)) = uintptr(0)
rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xControl})))(tls, (*Trbu_file)(unsafe.Pointer(p)).FpReal, int32(SQLITE_FCNTL_ZIPVFS), bp)
if rc == SQLITE_OK {
rc = int32(SQLITE_ERROR)
(*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+34709, 0)
} else {
if rc == int32(SQLITE_NOTFOUND) {
(*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FpTargetFd = p
(*Trbu_file)(unsafe.Pointer(p)).FpRbu = pRbu
_rbuMainlistAdd(tls, p)
if (*Trbu_file)(unsafe.Pointer(p)).FpWalFd != 0 {
(*Trbu_file)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpWalFd)).FpRbu = pRbu
}
rc = SQLITE_OK
}
}
}
return rc
} else {
if op == int32(SQLITE_FCNTL_RBUCNT) {
pRbu1 = pArg
(*Tsqlite3rbu)(unsafe.Pointer(pRbu1)).FnRbu = (*Tsqlite3rbu)(unsafe.Pointer(pRbu1)).FnRbu + 1
(*Tsqlite3rbu)(unsafe.Pointer(pRbu1)).FpRbuFd = p
(*Trbu_file)(unsafe.Pointer(p)).FbNolock = uint8(1)
}
}
rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xControl})))(tls, (*Trbu_file)(unsafe.Pointer(p)).FpReal, op, pArg)
if rc == SQLITE_OK && op == int32(SQLITE_FCNTL_VFSNAME) {
pRbuVfs = (*Trbu_file)(unsafe.Pointer(p)).FpRbuVfs
zIn = **(**uintptr)(__ccgo_up(pArg))
zOut = Xsqlite3_mprintf(tls, __ccgo_ts+34732, libc.VaList(bp+16, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn))
**(**uintptr)(__ccgo_up(pArg)) = zOut
if zOut == uintptr(0) {
rc = int32(SQLITE_NOMEM)
}
}
return rc
}
// C documentation
//
// /*
// ** Generate VM code to replace any double-quoted strings (but not double-quoted
// ** identifiers) within the "sql" column of the sqlite_schema table in
// ** database zDb with their single-quoted equivalents. If argument bTemp is
// ** not true, similarly update all SQL statements in the sqlite_schema table
// ** of the temp db.
// */
func _renameFixQuotes(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32) {
bp := tls.Alloc(32)
defer tls.Free(32)
_sqlite3NestedParse(tls, pParse, __ccgo_ts+9022, libc.VaList(bp+8, zDb, zDb))
if bTemp == 0 {
_sqlite3NestedParse(tls, pParse, __ccgo_ts+9169, 0)
}
}
// C documentation
//
// /*
// ** Reset the SQL statement passed as the first argument. Return a copy
// ** of the value returned by sqlite3_reset().
// **
// ** If an error has occurred, then set *pzErrmsg to point to a buffer
// ** containing an error message. It is the responsibility of the caller
// ** to eventually free this buffer using sqlite3_free().
// */
func _resetAndCollectError(tls *libc.TLS, pStmt uintptr, pzErrmsg uintptr) (r int32) {
bp := tls.Alloc(16)
defer tls.Free(16)
var rc int32
_ = rc
rc = Xsqlite3_reset(tls, pStmt)
if rc != SQLITE_OK {
**(**uintptr)(__ccgo_up(pzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+3942, libc.VaList(bp+8, Xsqlite3_errmsg(tls, Xsqlite3_db_handle(tls, pStmt))))
}
return rc
}
// C documentation
//
// /*
// ** Generate an ORDER BY or GROUP BY term out-of-range error.
// */
func _resolveOutOfRangeError(tls *libc.TLS, pParse uintptr, zType uintptr, i int32, mx int32, pError uintptr) {
bp := tls.Alloc(32)
defer tls.Free(32)
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7571, libc.VaList(bp+8, i, zType, mx))
_sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pError)
}
// C documentation
//
// /*
// ** The second and subsequent arguments to this function are a printf()
// ** style format string and arguments. This function formats the string and
// ** appends it to the report being accumulated in pCheck.
// */
func _rtreeCheckAppendMsg(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintptr) {
bp := tls.Alloc(32)
defer tls.Free(32)
var ap Tva_list
var z, v1 uintptr
_, _, _ = ap, z, v1
ap = va
if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK && (*TRtreeCheck)(unsafe.Pointer(pCheck)).FnErr < int32(RTREE_CHECK_MAX_ERROR) {
z = Xsqlite3_vmprintf(tls, zFmt, ap)
if z == uintptr(0) {
(*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM)
} else {
if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport != 0 {
v1 = __ccgo_ts + 4354
} else {
v1 = __ccgo_ts + 1702
}
(*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, __ccgo_ts+29053, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport, v1, z))
if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzReport == uintptr(0) {
(*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = int32(SQLITE_NOMEM)
}
}
(*TRtreeCheck)(unsafe.Pointer(pCheck)).FnErr = (*TRtreeCheck)(unsafe.Pointer(pCheck)).FnErr + 1
}
_ = ap
}
// C documentation
//
// /*
// ** Argument pCell points to an array of coordinates stored on an rtree page.
// ** This function checks that the coordinates are internally consistent (no
// ** x1>x2 conditions) and adds an error message to the RtreeCheck object
// ** if they are not.
// **
// ** Additionally, if pParent is not NULL, then it is assumed to point to
// ** the array of coordinates on the parent page that bound the page
// ** containing pCell. In this case it is also verified that the two
// ** sets of coordinates are mutually consistent and an error message added
// ** to the RtreeCheck object if they are not.
// */
func _rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode Ti64, iCell int32, pCell uintptr, pParent uintptr) {
bp := tls.Alloc(48)
defer tls.Free(48)
var i, v2, v3 int32
var v5 bool
var _ /* c1 at bp+0 */ TRtreeCoord
var _ /* c2 at bp+4 */ TRtreeCoord
var _ /* p1 at bp+8 */ TRtreeCoord
var _ /* p2 at bp+12 */ TRtreeCoord
_, _, _, _ = i, v2, v3, v5
i = 0
for {
if !(i < (*TRtreeCheck)(unsafe.Pointer(pCheck)).FnDim) {
break
}
_readCoord(tls, pCell+uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(2)*i), bp)
_readCoord(tls, pCell+uintptr(int32(4)*(int32(2)*i+int32(1))), bp+4)
/* printf("%e, %e\n", c1.u.f, c2.u.f); */
if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FbInt != 0 {
v2 = libc.BoolInt32(*(*int32)(unsafe.Pointer(bp)) > *(*int32)(unsafe.Pointer(bp + 4)))
} else {
v2 = libc.BoolInt32(*(*TRtreeValue)(unsafe.Pointer(bp)) > *(*TRtreeValue)(unsafe.Pointer(bp + 4)))
}
if v2 != 0 {
_rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+29359, libc.VaList(bp+24, i, iCell, iNode))
}
if pParent != 0 {
_readCoord(tls, pParent+uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(2)*i), bp+8)
_readCoord(tls, pParent+uintptr(int32(4)*(int32(2)*i+int32(1))), bp+12)
if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FbInt != 0 {
v2 = libc.BoolInt32(*(*int32)(unsafe.Pointer(bp)) < *(*int32)(unsafe.Pointer(bp + 8)))
} else {
v2 = libc.BoolInt32(*(*TRtreeValue)(unsafe.Pointer(bp)) < *(*TRtreeValue)(unsafe.Pointer(bp + 8)))
}
if v5 = v2 != 0; !v5 {
if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FbInt != 0 {
v3 = libc.BoolInt32(*(*int32)(unsafe.Pointer(bp + 4)) > *(*int32)(unsafe.Pointer(bp + 12)))
} else {
v3 = libc.BoolInt32(*(*TRtreeValue)(unsafe.Pointer(bp + 4)) > *(*TRtreeValue)(unsafe.Pointer(bp + 12)))
}
}
if v5 || v3 != 0 {
_rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+29407, libc.VaList(bp+24, i, iCell, iNode))
}
}
goto _1
_1:
;
i = i + 1
}
}
// C documentation
//
// /*
// ** The second argument to this function must be either "_rowid" or
// ** "_parent". This function checks that the number of entries in the
// ** %_rowid or %_parent table is exactly nExpect. If not, it adds
// ** an error message to the report in the RtreeCheck object indicated
// ** by the first argument.
// */
func _rtreeCheckCount(tls *libc.TLS, pCheck uintptr, zTbl uintptr, nExpect Ti64) {
bp := tls.Alloc(32)
defer tls.Free(32)
var nActual Ti64
var pCount uintptr
_, _ = nActual, pCount
if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK {
pCount = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+29593, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl))
if pCount != 0 {
if Xsqlite3_step(tls, pCount) == int32(SQLITE_ROW) {
nActual = Xsqlite3_column_int64(tls, pCount, 0)
if nActual != nExpect {
_rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+29624, libc.VaList(bp+8, zTbl, nExpect, nActual))
}
}
(*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = Xsqlite3_finalize(tls, pCount)
}
}
}
// C documentation
//
// /*
// ** Run rtreecheck() checks on node iNode, which is at depth iDepth within
// ** the r-tree structure. Argument aParent points to the array of coordinates
// ** that bound node iNode on the parent node.
// **
// ** If any problems are discovered, an error message is appended to the
// ** report accumulated in the RtreeCheck object.
// */
func _rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintptr, iNode Ti64) {
bp := tls.Alloc(48)
defer tls.Free(48)
var aNode, pCell uintptr
var i, nCell int32
var iVal Ti64
var _ /* nNode at bp+0 */ int32
_, _, _, _, _ = aNode, i, iVal, nCell, pCell
aNode = uintptr(0)
**(**int32)(__ccgo_up(bp)) = 0
aNode = _rtreeCheckGetNode(tls, pCheck, iNode, bp)
if aNode != 0 {
if **(**int32)(__ccgo_up(bp)) < int32(4) {
_rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+29474, libc.VaList(bp+16, iNode, **(**int32)(__ccgo_up(bp))))
} else { /* Used to iterate through cells */
if aParent == uintptr(0) {
iDepth = _readInt16(tls, aNode)
if iDepth > int32(RTREE_MAX_DEPTH) {
_rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+29508, libc.VaList(bp+16, iDepth))
Xsqlite3_free(tls, aNode)
return
}
}
nCell = _readInt16(tls, aNode+2)
if int32(4)+nCell*(int32(8)+(*TRtreeCheck)(unsafe.Pointer(pCheck)).FnDim*int32(2)*int32(4)) > **(**int32)(__ccgo_up(bp)) {
_rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+29538, libc.VaList(bp+16, iNode, nCell, **(**int32)(__ccgo_up(bp))))
} else {
i = 0
for {
if !(i < nCell) {
break
}
pCell = aNode + uintptr(int32(4)+i*(int32(8)+(*TRtreeCheck)(unsafe.Pointer(pCheck)).FnDim*int32(2)*int32(4)))
iVal = _readInt64(tls, pCell)
_rtreeCheckCellCoord(tls, pCheck, iNode, i, pCell+8, aParent)
if iDepth > 0 {
_rtreeCheckMapping(tls, pCheck, 0, iVal, iNode)
_rtreeCheckNode(tls, pCheck, iDepth-int32(1), pCell+8, iVal)
(*TRtreeCheck)(unsafe.Pointer(pCheck)).FnNonLeaf = (*TRtreeCheck)(unsafe.Pointer(pCheck)).FnNonLeaf + 1
} else {
_rtreeCheckMapping(tls, pCheck, int32(1), iVal, iNode)
(*TRtreeCheck)(unsafe.Pointer(pCheck)).FnLeaf = (*TRtreeCheck)(unsafe.Pointer(pCheck)).FnLeaf + 1
}
goto _1
_1:
;
i = i + 1
}
}
}
Xsqlite3_free(tls, aNode)
}
}
// C documentation
//
// /*
// ** A constraint has failed while inserting a row into an rtree table.
// ** Assuming no OOM error occurs, this function sets the error message
// ** (at pRtree->base.zErrMsg) to an appropriate value and returns
// ** SQLITE_CONSTRAINT.
// **
// ** Parameter iCol is the index of the leftmost column involved in the
// ** constraint failure. If it is 0, then the constraint that failed is
// ** the unique constraint on the id column. Otherwise, it is the rtree
// ** (c1<=c2) constraint on columns iCol and iCol+1 that has failed.
// **
// ** If an OOM occurs, SQLITE_NOMEM is returned instead of SQLITE_CONSTRAINT.
// */
func _rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) (r int32) {
bp := tls.Alloc(48)
defer tls.Free(48)
var rc, v1 int32
var zCol, zCol1, zCol2, zSql uintptr
var _ /* pStmt at bp+0 */ uintptr
_, _, _, _, _, _ = rc, zCol, zCol1, zCol2, zSql, v1
**(**uintptr)(__ccgo_up(bp)) = uintptr(0)
zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27507, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName))
if zSql != 0 {
rc = Xsqlite3_prepare_v2(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, -int32(1), bp, uintptr(0))
} else {
rc = int32(SQLITE_NOMEM)
}
Xsqlite3_free(tls, zSql)
if rc == SQLITE_OK {
if iCol == 0 {
zCol = Xsqlite3_column_name(tls, **(**uintptr)(__ccgo_up(bp)), 0)
(*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+27527, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol))
} else {
zCol1 = Xsqlite3_column_name(tls, **(**uintptr)(__ccgo_up(bp)), iCol)
zCol2 = Xsqlite3_column_name(tls, **(**uintptr)(__ccgo_up(bp)), iCol+int32(1))
(*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+27559, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2))
}
}
Xsqlite3_finalize(tls, **(**uintptr)(__ccgo_up(bp)))
if rc == SQLITE_OK {
v1 = int32(SQLITE_CONSTRAINT)
} else {
v1 = rc
}
return v1
}
// C documentation
//
// /*
// ** Rtree virtual table module xDestroy method.
// */
func _rtreeDestroy(tls *libc.TLS, pVtab uintptr) (r int32) {
bp := tls.Alloc(64)
defer tls.Free(64)
var pRtree, zCreate uintptr
var rc int32
_, _, _ = pRtree, rc, zCreate
pRtree = pVtab
zCreate = Xsqlite3_mprintf(tls, __ccgo_ts+27411, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName))
if !(zCreate != 0) {
rc = int32(SQLITE_NOMEM)
} else {
_nodeBlobReset(tls, pRtree)
rc = Xsqlite3_exec(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zCreate, uintptr(0), uintptr(0), uintptr(0))
Xsqlite3_free(tls, zCreate)
}
if rc == SQLITE_OK {
_rtreeRelease(tls, pRtree)
}
return rc
}
// C documentation
//
// /*
// ** Implementation of the xIntegrity method for Rtree.
// */
func _rtreeIntegrity(tls *libc.TLS, pVtab uintptr, zSchema uintptr, zName uintptr, isQuick int32, pzErr uintptr) (r int32) {
bp := tls.Alloc(32)
defer tls.Free(32)
var pRtree uintptr
var rc int32
_, _ = pRtree, rc
pRtree = pVtab
_ = zSchema
_ = zName
_ = isQuick
rc = _rtreeCheckTable(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, pzErr)
if rc == SQLITE_OK && **(**uintptr)(__ccgo_up(pzErr)) != 0 {
**(**uintptr)(__ccgo_up(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+29765, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, **(**uintptr)(__ccgo_up(pzErr))))
if **(**uintptr)(__ccgo_up(pzErr)) == uintptr(0) {
rc = int32(SQLITE_NOMEM)
}
}
return rc
}
// C documentation
//
// /*
// ** This function populates the pRtree->nRowEst variable with an estimate
// ** of the number of rows in the virtual table. If possible, this is based
// ** on sqlite_stat1 data. Otherwise, use RTREE_DEFAULT_ROWEST.
// */
func _rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) (r int32) {
bp := tls.Alloc(32)
defer tls.Free(32)
var nRow Ti64
var rc, v1 int32
var zFmt, zSql uintptr
var v2 int64
var _ /* p at bp+0 */ uintptr
_, _, _, _, _, _ = nRow, rc, zFmt, zSql, v1, v2
zFmt = __ccgo_ts + 27741
nRow = int64(RTREE_MIN_ROWEST)
rc = Xsqlite3_table_column_metadata(tls, db, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, __ccgo_ts+12835, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0))
if rc != SQLITE_OK {
(*TRtree)(unsafe.Pointer(pRtree)).FnRowEst = int64(RTREE_DEFAULT_ROWEST)
if rc == int32(SQLITE_ERROR) {
v1 = SQLITE_OK
} else {
v1 = rc
}
return v1
}
zSql = Xsqlite3_mprintf(tls, zFmt, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName))
if zSql == uintptr(0) {
rc = int32(SQLITE_NOMEM)
} else {
rc = Xsqlite3_prepare_v2(tls, db, zSql, -int32(1), bp, uintptr(0))
if rc == SQLITE_OK {
if Xsqlite3_step(tls, **(**uintptr)(__ccgo_up(bp))) == int32(SQLITE_ROW) {
nRow = Xsqlite3_column_int64(tls, **(**uintptr)(__ccgo_up(bp)), 0)
}
rc = Xsqlite3_finalize(tls, **(**uintptr)(__ccgo_up(bp)))
}
Xsqlite3_free(tls, zSql)
}
if nRow > int64(libc.Int32FromInt32(RTREE_MIN_ROWEST)) {
v2 = nRow
} else {
v2 = int64(libc.Int32FromInt32(RTREE_MIN_ROWEST))
}
(*TRtree)(unsafe.Pointer(pRtree)).FnRowEst = v2
return rc
}
// C documentation
//
// /*
// ** The xRename method for rtree module virtual tables.
// */
func _rtreeRename(tls *libc.TLS, pVtab uintptr, zNewName uintptr) (r int32) {
bp := tls.Alloc(80)
defer tls.Free(80)
var pRtree, zSql uintptr
var rc int32
_, _, _ = pRtree, rc, zSql
pRtree = pVtab
rc = int32(SQLITE_NOMEM)
zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27596, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName))
if zSql != 0 {
_nodeBlobReset(tls, pRtree)
rc = Xsqlite3_exec(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0))
Xsqlite3_free(tls, zSql)
}
return rc
}
// C documentation
//
// /* This routine implements an SQL function that returns the "depth" parameter
// ** from the front of a blob that is an r-tree node. For example:
// **
// ** SELECT rtreedepth(data) FROM rt_node WHERE nodeno=1;
// **
// ** The depth value is 0 for all nodes other than the root node, and the root
// ** node always has nodeno=1, so the example above is the primary use for this
// ** routine. This routine is intended for testing and analysis only.
// */
func _rtreedepth(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) {
var zBlob uintptr
_ = zBlob
_ = nArg
if Xsqlite3_value_type(tls, **(**uintptr)(__ccgo_up(apArg))) != int32(SQLITE_BLOB) || Xsqlite3_value_bytes(tls, **(**uintptr)(__ccgo_up(apArg))) < int32(2) {
Xsqlite3_result_error(tls, ctx, __ccgo_ts+29020, -int32(1))
} else {
zBlob = Xsqlite3_value_blob(tls, **(**uintptr)(__ccgo_up(apArg)))
if zBlob != 0 {
Xsqlite3_result_int(tls, ctx, _readInt16(tls, zBlob))
} else {
Xsqlite3_result_error_nomem(tls, ctx)
}
}
}
// C documentation
//
// /*
// ** Attempt to apply the change that the iterator passed as the first argument
// ** currently points to to the database. If a conflict is encountered, invoke
// ** the conflict handler callback.
// **
// ** The difference between this function and sessionApplyOne() is that this
// ** function handles the case where the conflict-handler is invoked and
// ** returns SQLITE_CHANGESET_REPLACE - indicating that the change should be
// ** retried in some manner.
// */
func _sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply uintptr, __ccgo_fp_xConflict uintptr, pCtx uintptr) (r int32) {
bp := tls.Alloc(16)
defer tls.Free(16)
var rc int32
var _ /* bReplace at bp+0 */ int32
var _ /* bRetry at bp+4 */ int32
_ = rc
**(**int32)(__ccgo_up(bp)) = 0
**(**int32)(__ccgo_up(bp + 4)) = 0
rc = _sessionApplyOneOp(tls, pIter, pApply, __ccgo_fp_xConflict, pCtx, bp, bp+4)
if rc == SQLITE_OK {
/* If the bRetry flag is set, the change has not been applied due to an
** SQLITE_CHANGESET_DATA problem (i.e. this is an UPDATE or DELETE and
** a row with the correct PK is present in the db, but one or more other
** fields do not contain the expected values) and the conflict handler
** returned SQLITE_CHANGESET_REPLACE. In this case retry the operation,
** but pass NULL as the final argument so that sessionApplyOneOp() ignores
** the SQLITE_CHANGESET_DATA problem. */
if **(**int32)(__ccgo_up(bp + 4)) != 0 {
rc = _sessionApplyOneOp(tls, pIter, pApply, __ccgo_fp_xConflict, pCtx, uintptr(0), uintptr(0))
} else {
if **(**int32)(__ccgo_up(bp)) != 0 {
rc = Xsqlite3_exec(tls, db, __ccgo_ts+36325, uintptr(0), uintptr(0), uintptr(0))
if rc == SQLITE_OK {
rc = _sessionBindRow(tls, pIter, __ccgo_fp(Xsqlite3changeset_new), (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FabPK, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete)
Xsqlite3_bind_int(tls, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol+int32(1), int32(1))
}
if rc == SQLITE_OK {
Xsqlite3_step(tls, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete)
rc = Xsqlite3_reset(tls, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete)
}
if rc == SQLITE_OK {
rc = _sessionApplyOneOp(tls, pIter, pApply, __ccgo_fp_xConflict, pCtx, uintptr(0), uintptr(0))
}
if rc == SQLITE_OK {
rc = Xsqlite3_exec(tls, db, __ccgo_ts+36346, uintptr(0), uintptr(0), uintptr(0))
}
}
}
}
return rc
}
func _sessionDiffFindModified(tls *libc.TLS, pSession uintptr, pTab uintptr, zFrom uintptr, zExpr uintptr) (r int32) {
bp := tls.Alloc(80)
defer tls.Free(80)
var iRowid Ti64
var pDiffCtx, z1, z2, zExpr2, zStmt uintptr
var rc int32
var v1 int64
var _ /* pStmt at bp+0 */ uintptr
_, _, _, _, _, _, _, _ = iRowid, pDiffCtx, rc, z1, z2, zExpr2, zStmt, v1
rc = SQLITE_OK
zExpr2 = _sessionExprCompareOther(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FnCol, (*Tsqlite3_session)(unsafe.Pointer(pSession)).FzDb, zFrom, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, (*TSessionTable)(unsafe.Pointer(pTab)).FazCol, (*TSessionTable)(unsafe.Pointer(pTab)).FabPK)
if zExpr2 == uintptr(0) {
rc = int32(SQLITE_NOMEM)
} else {
z1 = _sessionAllCols(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).FzDb, pTab)
z2 = _sessionAllCols(tls, zFrom, pTab)
zStmt = Xsqlite3_mprintf(tls, __ccgo_ts+35548, libc.VaList(bp+16, z1, z2, (*Tsqlite3_session)(unsafe.Pointer(pSession)).FzDb, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, zFrom, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, zExpr, zExpr2))
if zStmt == uintptr(0) || z1 == uintptr(0) || z2 == uintptr(0) {
rc = int32(SQLITE_NOMEM)
} else {
rc = Xsqlite3_prepare_v2(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb, zStmt, -int32(1), bp, uintptr(0))
if rc == SQLITE_OK {
pDiffCtx = (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx
(*TSessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FpStmt = **(**uintptr)(__ccgo_up(bp))
(*TSessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FnOldOff = (*TSessionTable)(unsafe.Pointer(pTab)).FnCol
for int32(SQLITE_ROW) == Xsqlite3_step(tls, **(**uintptr)(__ccgo_up(bp))) {
if (*TSessionTable)(unsafe.Pointer(pTab)).FbRowid != 0 {
v1 = Xsqlite3_column_int64(tls, **(**uintptr)(__ccgo_up(bp)), 0)
} else {
v1 = 0
}
iRowid = v1
_sessionPreupdateOneChange(tls, int32(SQLITE_UPDATE), iRowid, pSession, pTab)
}
rc = Xsqlite3_finalize(tls, **(**uintptr)(__ccgo_up(bp)))
}
}
Xsqlite3_free(tls, zStmt)
Xsqlite3_free(tls, z1)
Xsqlite3_free(tls, z2)
}
return rc
}
func _sessionPrepare(tls *libc.TLS, db uintptr, pp uintptr, pzErrmsg uintptr, zSql uintptr) (r int32) {
bp := tls.Alloc(16)
defer tls.Free(16)
var rc int32
_ = rc
rc = Xsqlite3_prepare_v2(tls, db, zSql, -int32(1), pp, uintptr(0))
if pzErrmsg != 0 && rc != SQLITE_OK {
**(**uintptr)(__ccgo_up(pzErrmsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+3942, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db)))
}
return rc
}
func _sessionSelectFindNew(tls *libc.TLS, zDb1 uintptr, zDb2 uintptr, bRowid int32, zTbl uintptr, zExpr uintptr) (r uintptr) {
bp := tls.Alloc(64)
defer tls.Free(64)
var zRet, zSel, v1 uintptr
_, _, _ = zRet, zSel, v1
if bRowid != 0 {
v1 = __ccgo_ts + 35439
} else {
v1 = __ccgo_ts + 6823
}
zSel = v1
zRet = Xsqlite3_mprintf(tls, __ccgo_ts+35450, libc.VaList(bp+8, zSel, zDb1, zTbl, zDb2, zTbl, zExpr))
return zRet
}
// C documentation
//
// /*
// ** Check if table zTab in the "main" database of db is a WITHOUT ROWID
// ** table.
// **
// ** If no error occurs, return SQLITE_OK and set output variable (*pbWR) to
// ** true if zTab is a WITHOUT ROWID table, or false otherwise. Or, if an
// ** error does occur, return an SQLite error code. The final value of (*pbWR)
// ** is undefined in this case.
// */
func _sessionTableIsWithoutRowid(tls *libc.TLS, db uintptr, zTab uintptr, pbWR uintptr) (r int32) {
bp := tls.Alloc(32)
defer tls.Free(32)
var rc int32
var zSql uintptr
var _ /* pList at bp+0 */ uintptr
_, _ = rc, zSql
**(**uintptr)(__ccgo_up(bp)) = uintptr(0)
zSql = uintptr(0)
rc = SQLITE_OK
zSql = Xsqlite3_mprintf(tls, __ccgo_ts+36365, libc.VaList(bp+16, zTab))
if zSql == uintptr(0) {
rc = int32(SQLITE_NOMEM)
} else {
rc = Xsqlite3_prepare_v2(tls, db, zSql, -int32(1), bp, uintptr(0))
Xsqlite3_free(tls, zSql)
}
if rc == SQLITE_OK {
Xsqlite3_step(tls, **(**uintptr)(__ccgo_up(bp)))
**(**int32)(__ccgo_up(pbWR)) = Xsqlite3_column_int(tls, **(**uintptr)(__ccgo_up(bp)), int32(4))
rc = Xsqlite3_finalize(tls, **(**uintptr)(__ccgo_up(bp)))
}
return rc
}
// C documentation
//
// /*
// ** Do an authorization check using the code and arguments given. Return
// ** either SQLITE_OK (zero) or SQLITE_IGNORE or SQLITE_DENY. If SQLITE_DENY
// ** is returned, then the error count and error message in pParse are
// ** modified appropriately.
// */
func _sqlite3AuthCheck(tls *libc.TLS, pParse uintptr, code int32, zArg1 uintptr, zArg2 uintptr, zArg3 uintptr) (r int32) {
var db uintptr
var rc int32
_, _ = db, rc
db = (*TParse)(unsafe.Pointer(pParse)).Fdb
/* Don't do any authorization checks if the database is initializing
** or if the parser is being invoked from within sqlite3_declare_vtab.
*/
if (*Tsqlite3)(unsafe.Pointer(db)).FxAuth == uintptr(0) || (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 || libc.Int32FromUint8((*TParse)(unsafe.Pointer(pParse)).FeParseMode) != PARSE_MODE_NORMAL {
return SQLITE_OK
}
/* EVIDENCE-OF: R-43249-19882 The third through sixth parameters to the
** callback are either NULL pointers or zero-terminated strings that
** contain additional details about the action to be authorized.
**
** The following testcase() macros show that any of the 3rd through 6th
** parameters can be either NULL or a string. */
rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAuth})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAuthArg, code, zArg1, zArg2, zArg3, (*TParse)(unsafe.Pointer(pParse)).FzAuthContext)
if rc == int32(SQLITE_DENY) {
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13673, 0)
(*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_AUTH)
} else {
if rc != SQLITE_OK && rc != int32(SQLITE_IGNORE) {
rc = int32(SQLITE_DENY)
_sqliteAuthBadReturnCode(tls, pParse)
}
}
return rc
}
func _sqlite3CantopenError(tls *libc.TLS, lineno int32) (r int32) {
return _sqlite3ReportError(tls, int32(SQLITE_CANTOPEN), lineno, __ccgo_ts+26321)
}
// C documentation
//
// /*
// ** Close an existing SQLite database
// */
func _sqlite3Close(tls *libc.TLS, db uintptr, forceZombie int32) (r int32) {
var p uintptr
_ = p
if !(db != 0) {
/* EVIDENCE-OF: R-63257-11740 Calling sqlite3_close() or
** sqlite3_close_v2() with a NULL pointer argument is a harmless no-op. */
return SQLITE_OK
}
if !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) {
return _sqlite3MisuseError(tls, int32(188636))
}
Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex)
if libc.Int32FromUint8((*Tsqlite3)(unsafe.Pointer(db)).FmTrace)&int32(SQLITE_TRACE_CLOSE) != 0 {
(*(*func(*libc.TLS, Tu32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*uintptr)(unsafe.Pointer(&(*Tsqlite3)(unsafe.Pointer(db)).Ftrace))})))(tls, uint32(SQLITE_TRACE_CLOSE), (*Tsqlite3)(unsafe.Pointer(db)).FpTraceArg, db, uintptr(0))
}
/* Force xDisconnect calls on all virtual tables */
_disconnectAllVtab(tls, db)
/* If a transaction is open, the disconnectAllVtab() call above
** will not have called the xDisconnect() method on any virtual
** tables in the db->aVTrans[] array. The following sqlite3VtabRollback()
** call will do so. We need to do this before the check for active
** SQL statements below, as the v-table implementation may be storing
** some prepared statements internally.
*/
_sqlite3VtabRollback(tls, db)
/* Legacy behavior (sqlite3_close() behavior) is to return
** SQLITE_BUSY if the connection can not be closed immediately.
*/
if !(forceZombie != 0) && _connectionIsBusy(tls, db) != 0 {
_sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+25289, 0)
Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex)
return int32(SQLITE_BUSY)
}
for (*Tsqlite3)(unsafe.Pointer(db)).FpDbData != 0 {
p = (*Tsqlite3)(unsafe.Pointer(db)).FpDbData
(*Tsqlite3)(unsafe.Pointer(db)).FpDbData = (*TDbClientData)(unsafe.Pointer(p)).FpNext
if (*TDbClientData)(unsafe.Pointer(p)).FxDestructor != 0 {
(*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TDbClientData)(unsafe.Pointer(p)).FxDestructor})))(tls, (*TDbClientData)(unsafe.Pointer(p)).FpData)
}
Xsqlite3_free(tls, p)
}
/* Convert the connection into a zombie and then close it.
*/
(*Tsqlite3)(unsafe.Pointer(db)).FeOpenState = uint8(SQLITE_STATE_ZOMBIE)
_sqlite3LeaveMutexAndCloseZombie(tls, db)
return SQLITE_OK
}
func _sqlite3CorruptError(tls *libc.TLS, lineno int32) (r int32) {
return _sqlite3ReportError(tls, int32(SQLITE_CORRUPT), lineno, __ccgo_ts+26294)
}
// C documentation
//
// /*
// ** Invoke this routine to register the "dbpage" virtual table module
// */
func _sqlite3DbpageRegister(tls *libc.TLS, db uintptr) (r int32) {
return Xsqlite3_create_module(tls, db, __ccgo_ts+35178, uintptr(unsafe.Pointer(&_dbpage_module)), uintptr(0))
}
// C documentation
//
// /*
// ** Invoke this routine to register the "dbstat" virtual table module
// */
func _sqlite3DbstatRegister(tls *libc.TLS, db uintptr) (r int32) {
return Xsqlite3_create_module(tls, db, __ccgo_ts+34993, uintptr(unsafe.Pointer(&_dbstat_module)), uintptr(0))
}
// C documentation
//
// /*
// ** Generate VDBE code for a COMMIT or ROLLBACK statement.
// ** Code for ROLLBACK is generated if eType==TK_ROLLBACK. Otherwise
// ** code is generated for a COMMIT.
// */
func _sqlite3EndTransaction(tls *libc.TLS, pParse uintptr, eType int32) {
var isRollback int32
var v, v1 uintptr
_, _, _ = isRollback, v, v1
isRollback = libc.BoolInt32(eType == int32(TK_ROLLBACK))
if isRollback != 0 {
v1 = __ccgo_ts + 16111
} else {
v1 = __ccgo_ts + 16120
}
if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), v1, uintptr(0), uintptr(0)) != 0 {
return
}
v = _sqlite3GetVdbe(tls, pParse)
if v != 0 {
_sqlite3VdbeAddOp2(tls, v, int32(OP_AutoCommit), int32(1), isRollback)
}
}
// C documentation
//
// /*
// ** Write code that will raise an error if the table described by
// ** zDb and zTab is not empty.
// */
func _sqlite3ErrorIfNotEmpty(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zErr uintptr) {
bp := tls.Alloc(32)
defer tls.Free(32)
_sqlite3NestedParse(tls, pParse, __ccgo_ts+10253, libc.VaList(bp+8, zErr, zDb, zTab))
}
// C documentation
//
// /*
// ** Check to see if a function is usable according to current access
// ** rules:
// **
// ** SQLITE_FUNC_DIRECT - Only usable from top-level SQL
// **
// ** SQLITE_FUNC_UNSAFE - Usable if TRUSTED_SCHEMA or from
// ** top-level SQL
// **
// ** If the function is not usable, create an error.
// */
func _sqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pDef uintptr) {
bp := tls.Alloc(16)
defer tls.Free(16)
if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&libc.Uint32FromInt32(libc.Int32FromInt32(EP_FromDDL)) != uint32(0) || libc.Int32FromUint8((*TParse)(unsafe.Pointer(pParse)).FprepFlags)&int32(SQLITE_PREPARE_FROM_DDL) != 0 {
if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_DIRECT) != uint32(0) || (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&uint64(SQLITE_TrustedSchema) == uint64(0) {
/* Functions prohibited in triggers and views if:
** (1) tagged with SQLITE_DIRECTONLY
** (2) not tagged with SQLITE_INNOCUOUS (which means it
** is tagged with SQLITE_FUNC_UNSAFE) and
** SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning
** that the schema is possibly tainted).
*/
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8041, libc.VaList(bp+8, pExpr))
}
}
}
// C documentation
//
// /*
// ** Report an error when attempting to use an ORDER BY clause within
// ** the arguments of a non-aggregate function.
// */
func _sqlite3ExprOrderByAggregateError(tls *libc.TLS, pParse uintptr, p uintptr) {
bp := tls.Alloc(16)
defer tls.Free(16)
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7991, libc.VaList(bp+8, p))
}
// C documentation
//
// /*
// ** Create the shadow table named zPost, with definition zDefn. Return
// ** SQLITE_OK if successful, or an SQLite error code otherwise.
// */
func _sqlite3Fts5CreateTable(tls *libc.TLS, pConfig uintptr, zPost uintptr, zDefn uintptr, bWithout int32, pzErr uintptr) (r int32) {
bp := tls.Alloc(64)
defer tls.Free(64)
var rc int32
var v1 uintptr
var _ /* zErr at bp+0 */ uintptr
_, _ = rc, v1
**(**uintptr)(__ccgo_up(bp)) = uintptr(0)
if bWithout != 0 {
v1 = __ccgo_ts + 32081
} else {
v1 = __ccgo_ts + 1702
}
rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, bp, __ccgo_ts+41486, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, v1))
if **(**uintptr)(__ccgo_up(bp)) != 0 {
**(**uintptr)(__ccgo_up(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+41516, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, **(**uintptr)(__ccgo_up(bp))))
Xsqlite3_free(tls, **(**uintptr)(__ccgo_up(bp)))
}
return rc
}
// C documentation
//
// /*
// ** Drop all shadow tables. Return SQLITE_OK if successful or an SQLite error
// ** code otherwise.
// */
func _sqlite3Fts5DropAll(tls *libc.TLS, pConfig uintptr) (r int32) {
bp := tls.Alloc(64)
defer tls.Free(64)
var rc int32
_ = rc
rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+41264, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName))
if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 {
rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+41368, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName))
}
if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL {
rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+41406, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName))
}
return rc
}
// C documentation
//
// /*
// ** Apply colset pColset to expression node pExpr and all of its descendents.
// */
func _sqlite3Fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pExpr uintptr, pColset uintptr) {
bp := tls.Alloc(16)
defer tls.Free(16)
var _ /* pFree at bp+0 */ uintptr
**(**uintptr)(__ccgo_up(bp)) = pColset
if (*TFts5Config)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail == int32(FTS5_DETAIL_NONE) {
_sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+38637, 0)
} else {
_fts5ParseSetColset(tls, pParse, pExpr, pColset, bp)
}
Xsqlite3_free(tls, **(**uintptr)(__ccgo_up(bp)))
}
// C documentation
//
// /*
// ** Delete all entries in the FTS5 index.
// */
func _sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) (r int32) {
bp := tls.Alloc(48)
defer tls.Free(48)
var pConfig uintptr
var rc int32
_, _ = pConfig, rc
pConfig = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig
(*TFts5Storage)(unsafe.Pointer(p)).FbTotalsValid = 0
/* Delete the contents of the %_data and %_docsize tables. */
rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+41692, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName))
if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 {
rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+41742, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName))
}
if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == int32(FTS5_CONTENT_UNINDEXED) {
rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+41771, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName))
}
/* Reinitialize the %_data table. This call creates the initial structure
** and averages records. */
if rc == SQLITE_OK {
rc = _sqlite3Fts5IndexReinit(tls, (*TFts5Storage)(unsafe.Pointer(p)).FpIndex)
}
if rc == SQLITE_OK {
rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+38466, uintptr(0), int32(FTS5_CURRENT_VERSION))
}
return rc
}
func _sqlite3Fts5StorageRename(tls *libc.TLS, pStorage uintptr, zName uintptr) (r int32) {
bp := tls.Alloc(16)
defer tls.Free(16)
var pConfig uintptr
var _ /* rc at bp+0 */ int32
_ = pConfig
pConfig = (*TFts5Storage)(unsafe.Pointer(pStorage)).FpConfig
**(**int32)(__ccgo_up(bp)) = _sqlite3Fts5StorageSync(tls, pStorage)
_fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+27406, zName)
_fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+13046, zName)
_fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+40598, zName)
if (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 {
_fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+38284, zName)
}
if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL {
_fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+37589, zName)
}
return **(**int32)(__ccgo_up(bp))
}
// C documentation
//
// /*
// ** Return true if the tokenizer described by p->azArg[] is the trigram
// ** tokenizer. This tokenizer needs to be loaded before xBestIndex is
// ** called for the first time in order to correctly handle LIKE/GLOB.
// */
func _sqlite3Fts5TokenizerPreload(tls *libc.TLS, p uintptr) (r int32) {
return libc.BoolInt32((*TFts5TokenizerConfig)(unsafe.Pointer(p)).FnArg >= int32(1) && 0 == Xsqlite3_stricmp(tls, **(**uintptr)(__ccgo_up((*TFts5TokenizerConfig)(unsafe.Pointer(p)).FazArg)), __ccgo_ts+42203))
}
func _sqlite3Fts5VocabInit(tls *libc.TLS, pGlobal uintptr, db uintptr) (r int32) {
var p uintptr
_ = p
p = pGlobal
return Xsqlite3_create_module_v2(tls, db, __ccgo_ts+42527, uintptr(unsafe.Pointer(&_fts5Vocab)), p, uintptr(0))
}
// C documentation
//
// /*
// ** This function is responsible for invoking the collation factory callback
// ** or substituting a collation sequence of a different encoding when the
// ** requested collation sequence is not available in the desired encoding.
// **
// ** If it is not NULL, then pColl must point to the database native encoding
// ** collation sequence with name zName, length nName.
// **
// ** The return value is either the collation sequence to be used in database
// ** db for collation type name zName, length nName, or NULL, if no collation
// ** sequence can be found. If no collation is found, leave an error message.
// **
// ** See also: sqlite3LocateCollSeq(), sqlite3FindCollSeq()
// */
func _sqlite3GetCollSeq(tls *libc.TLS, pParse uintptr, enc Tu8, pColl uintptr, zName uintptr) (r uintptr) {
bp := tls.Alloc(16)
defer tls.Free(16)
var db, p uintptr
_, _ = db, p
db = (*TParse)(unsafe.Pointer(pParse)).Fdb
p = pColl
if !(p != 0) {
p = _sqlite3FindCollSeq(tls, db, enc, zName, 0)
}
if !(p != 0) || !((*TCollSeq)(unsafe.Pointer(p)).FxCmp != 0) {
/* No collation sequence of this type for this encoding is registered.
** Call the collation factory to see if it can supply us with one.
*/
_callCollNeeded(tls, db, libc.Int32FromUint8(enc), zName)
p = _sqlite3FindCollSeq(tls, db, enc, zName, 0)
}
if p != 0 && !((*TCollSeq)(unsafe.Pointer(p)).FxCmp != 0) && _synthCollSeq(tls, db, p) != 0 {
p = uintptr(0)
}
if p == uintptr(0) {
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16316, libc.VaList(bp+8, zName))
(*TParse)(unsafe.Pointer(pParse)).Frc = libc.Int32FromInt32(SQLITE_ERROR) | libc.Int32FromInt32(1)<<libc.Int32FromInt32(8)
}
return p
}
// C documentation
//
// /*
// ** The following is the implementation of an SQL function that always
// ** fails with an error message stating that the function is used in the
// ** wrong context. The sqlite3_overload_function() API might construct
// ** SQL function that use this routine so that the functions will exist
// ** for name resolution but are actually overloaded by the xFindFunction
// ** method of virtual tables.
// */
func _sqlite3InvalidFunction(tls *libc.TLS, context uintptr, NotUsed int32, NotUsed2 uintptr) {
bp := tls.Alloc(16)
defer tls.Free(16)
var zErr, zName uintptr
_, _ = zErr, zName
zName = Xsqlite3_user_data(tls, context)
_ = NotUsed
_ = NotUsed2
zErr = Xsqlite3_mprintf(tls, __ccgo_ts+25976, libc.VaList(bp+8, zName))
Xsqlite3_result_error(tls, context, zErr, -int32(1))
Xsqlite3_free(tls, zErr)
}
// C documentation
//
// /*
// ** Check to make sure the given table is writable.
// **
// ** If pTab is not writable -> generate an error message and return 1.
// ** If pTab is writable but other errors have occurred -> return 1.
// ** If pTab is writable and no prior errors -> return 0;
// */
func _sqlite3IsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr, pTrigger uintptr) (r int32) {
bp := tls.Alloc(16)
defer tls.Free(16)
if _tabIsReadOnly(tls, pParse, pTab) != 0 {
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16380, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName))
return int32(1)
}
if libc.Int32FromUint8((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) && (pTrigger == uintptr(0) || (*TTrigger)(unsafe.Pointer(pTrigger)).FbReturning != 0 && (*TTrigger)(unsafe.Pointer(pTrigger)).FpNext == uintptr(0)) {
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16409, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName))
return int32(1)
}
return 0
}
// C documentation
//
// /*
// ** Return TRUE if the given string is a row-id column name.
// */
func _sqlite3IsRowid(tls *libc.TLS, z uintptr) (r int32) {
if _sqlite3StrICmp(tls, z, __ccgo_ts+8191) == 0 {
return int32(1)
}
if _sqlite3StrICmp(tls, z, __ccgo_ts+8199) == 0 {
return int32(1)
}
if _sqlite3StrICmp(tls, z, __ccgo_ts+8205) == 0 {
return int32(1)
}
return 0
}
// C documentation
//
// /*
// ** Check the input string to see if it is "true" or "false" (in any case).
// **
// ** If the string is.... Return
// ** "true" EP_IsTrue
// ** "false" EP_IsFalse
// ** anything else 0
// */
func _sqlite3IsTrueOrFalse(tls *libc.TLS, zIn uintptr) (r Tu32) {
if _sqlite3StrICmp(tls, zIn, __ccgo_ts+8180) == 0 {
return uint32(EP_IsTrue)
}
if _sqlite3StrICmp(tls, zIn, __ccgo_ts+8185) == 0 {
return uint32(EP_IsFalse)
}
return uint32(0)
}
func _sqlite3MisuseError(tls *libc.TLS, lineno int32) (r int32) {
return _sqlite3ReportError(tls, int32(SQLITE_MISUSE), lineno, __ccgo_ts+26314)
}
// C documentation
//
// /*
// ** Open the sqlite_schema table stored in database number iDb for
// ** writing. The table is opened using cursor 0.
// */
func _sqlite3OpenSchemaTable(tls *libc.TLS, p uintptr, iDb int32) {
var v uintptr
_ = v
v = _sqlite3GetVdbe(tls, p)
_sqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), __ccgo_ts+6286)
_sqlite3VdbeAddOp4Int(tls, v, int32(OP_OpenWrite), 0, int32(SCHEMA_ROOT), iDb, int32(5))
if (*TParse)(unsafe.Pointer(p)).FnTab == 0 {
(*TParse)(unsafe.Pointer(p)).FnTab = int32(1)
}
}
// C documentation
//
// /*
// ** This function is called when the user invokes "PRAGMA wal_checkpoint",
// ** "PRAGMA wal_blocking_checkpoint" or calls the sqlite3_wal_checkpoint()
// ** or wal_blocking_checkpoint() API functions.
// **
// ** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL or RESTART.
// */
func _sqlite3PagerCheckpoint(tls *libc.TLS, pPager uintptr, db uintptr, eMode int32, pnLog uintptr, pnCkpt uintptr) (r int32) {
var rc int32
var v1 uintptr
_, _ = rc, v1
rc = SQLITE_OK
if (*TPager)(unsafe.Pointer(pPager)).FpWal == uintptr(0) && libc.Int32FromUint8((*TPager)(unsafe.Pointer(pPager)).FjournalMode) == int32(PAGER_JOURNALMODE_WAL) {
/* This only happens when a database file is zero bytes in size opened and
** then "PRAGMA journal_mode=WAL" is run and then sqlite3_wal_checkpoint()
** is invoked without any intervening transactions. We need to start
** a transaction to initialize pWal. The PRAGMA table_list statement is
** used for this since it starts transactions on every database file,
** including all ATTACHed databases. This seems expensive for a single
** sqlite3_wal_checkpoint() call, but it happens very rarely.
** https://sqlite.org/forum/forumpost/fd0f19d229156939
*/
Xsqlite3_exec(tls, db, __ccgo_ts+4260, uintptr(0), uintptr(0), uintptr(0))
}
if (*TPager)(unsafe.Pointer(pPager)).FpWal != 0 {
if eMode <= SQLITE_CHECKPOINT_PASSIVE {
v1 = uintptr(0)
} else {
v1 = (*TPager)(unsafe.Pointer(pPager)).FxBusyHandler
}
rc = _sqlite3WalCheckpoint(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, db, eMode, v1, (*TPager)(unsafe.Pointer(pPager)).FpBusyHandlerArg, libc.Int32FromUint8((*TPager)(unsafe.Pointer(pPager)).FwalSyncFlags), int32((*TPager)(unsafe.Pointer(pPager)).FpageSize), (*TPager)(unsafe.Pointer(pPager)).FpTmpSpace, pnLog, pnCkpt)
}
return rc
}
// C documentation
//
// /*
// ** Return the preferred table name for system tables. Translate legacy
// ** names into the new preferred names, as appropriate.
// */
func _sqlite3PreferredTableName(tls *libc.TLS, zName uintptr) (r uintptr) {
if Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6758, int32(7)) == 0 {
if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6286+7) == 0 {
return __ccgo_ts + 6804
}
if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6766+7) == 0 {
return __ccgo_ts + 6785
}
}
return zName
}
// C documentation
//
// /*
// ** Re-register the built-in LIKE functions. The caseSensitive
// ** parameter determines whether or not the LIKE operator is case
// ** sensitive.
// */
func _sqlite3RegisterLikeFunctions(tls *libc.TLS, db uintptr, caseSensitive int32) {
var flags, nArg int32
var pDef, pInfo uintptr
_, _, _, _ = flags, nArg, pDef, pInfo
if caseSensitive != 0 {
pInfo = uintptr(unsafe.Pointer(&_likeInfoAlt))
flags = libc.Int32FromInt32(SQLITE_FUNC_LIKE) | libc.Int32FromInt32(SQLITE_FUNC_CASE)
} else {
pInfo = uintptr(unsafe.Pointer(&_likeInfoNorm))
flags = int32(SQLITE_FUNC_LIKE)
}
nArg = int32(2)
for {
if !(nArg <= int32(3)) {
break
}
_sqlite3CreateFunc(tls, db, __ccgo_ts+16607, nArg, int32(SQLITE_UTF8), pInfo, __ccgo_fp(_likeFunc), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0))
pDef = _sqlite3FindFunction(tls, db, __ccgo_ts+16607, nArg, uint8(SQLITE_UTF8), uint8(0))
/* The sqlite3CreateFunc() call above cannot fail
** because the "like" SQL-function already exists */
**(**Tu32)(__ccgo_up(pDef + 4)) |= libc.Uint32FromInt32(flags)
**(**Tu32)(__ccgo_up(pDef + 4)) &= libc.Uint32FromInt32(^libc.Int32FromInt32(SQLITE_FUNC_UNSAFE))
goto _1
_1:
;
nArg = nArg + 1
}
}
// C documentation
//
// /*
// ** This routine does per-connection function registration. Most
// ** of the built-in functions above are part of the global function set.
// ** This routine only deals with those that are not global.
// */
func _sqlite3RegisterPerConnectionBuiltinFunctions(tls *libc.TLS, db uintptr) {
var rc int32
_ = rc
rc = Xsqlite3_overload_function(tls, db, __ccgo_ts+16601, int32(2))
if rc == int32(SQLITE_NOMEM) {
_sqlite3OomFault(tls, db)
}
}
// C documentation
//
// /*
// ** The following routines are substitutes for constants SQLITE_CORRUPT,
// ** SQLITE_MISUSE, SQLITE_CANTOPEN, SQLITE_NOMEM and possibly other error
// ** constants. They serve two purposes:
// **
// ** 1. Serve as a convenient place to set a breakpoint in a debugger
// ** to detect when version error conditions occurs.
// **
// ** 2. Invoke sqlite3_log() to provide the source code location where
// ** a low-level error is first detected.
// */
func _sqlite3ReportError(tls *libc.TLS, iErr int32, lineno int32, zType uintptr) (r int32) {
bp := tls.Alloc(32)
defer tls.Free(32)
Xsqlite3_log(tls, iErr, __ccgo_ts+26269, libc.VaList(bp+8, zType, lineno, uintptr(20)+Xsqlite3_sourceid(tls)))
return iErr
}
// C documentation
//
// /*
// ** Register the r-tree module with database handle db. This creates the
// ** virtual table module "rtree" and the debugging/analysis scalar
// ** function "rtreenode".
// */
func _sqlite3RtreeInit(tls *libc.TLS, db uintptr) (r int32) {
var c, c1 uintptr
var rc, utf8 int32
_, _, _, _ = c, c1, rc, utf8
utf8 = int32(SQLITE_UTF8)
rc = Xsqlite3_create_function(tls, db, __ccgo_ts+30227, int32(2), utf8, uintptr(0), __ccgo_fp(_rtreenode), uintptr(0), uintptr(0))
if rc == SQLITE_OK {
rc = Xsqlite3_create_function(tls, db, __ccgo_ts+30237, int32(1), utf8, uintptr(0), __ccgo_fp(_rtreedepth), uintptr(0), uintptr(0))
}
if rc == SQLITE_OK {
rc = Xsqlite3_create_function(tls, db, __ccgo_ts+30248, -int32(1), utf8, uintptr(0), __ccgo_fp(_rtreecheck), uintptr(0), uintptr(0))
}
if rc == SQLITE_OK {
c = libc.UintptrFromInt32(RTREE_COORD_REAL32)
rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+29971, uintptr(unsafe.Pointer(&_rtreeModule)), c, uintptr(0))
}
if rc == SQLITE_OK {
c1 = libc.UintptrFromInt32(RTREE_COORD_INT32)
rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+30259, uintptr(unsafe.Pointer(&_rtreeModule)), c1, uintptr(0))
}
if rc == SQLITE_OK {
rc = _sqlite3_geopoly_init(tls, db)
}
return rc
}
// C documentation
//
// /*
// ** Name of the connection operator, used for error messages.
// */
func _sqlite3SelectOpName(tls *libc.TLS, id int32) (r uintptr) {
var z uintptr
_ = z
switch id {
case int32(TK_ALL):
z = __ccgo_ts + 20487
case int32(TK_INTERSECT):
z = __ccgo_ts + 20497
case int32(TK_EXCEPT):
z = __ccgo_ts + 20507
default:
z = __ccgo_ts + 20514
break
}
return z
}
// C documentation
//
// /*
// ** Error message for when two or more terms of a compound select have different
// ** size result sets.
// */
func _sqlite3SelectWrongNumTermsError(tls *libc.TLS, pParse uintptr, p uintptr) {
bp := tls.Alloc(16)
defer tls.Free(16)
if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Values) != 0 {
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20866, 0)
} else {
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20912, libc.VaList(bp+8, _sqlite3SelectOpName(tls, libc.Int32FromUint8((*TSelect)(unsafe.Pointer(p)).Fop))))
}
}
// C documentation
//
// /*
// ** Load the Parse object passed as the first argument with an error
// ** message of the form:
// **
// ** "sub-select returns N columns - expected M"
// */
func _sqlite3SubselectError(tls *libc.TLS, pParse uintptr, nActual int32, nExpect int32) {
bp := tls.Alloc(32)
defer tls.Free(32)
var zFmt uintptr
_ = zFmt
if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 {
zFmt = __ccgo_ts + 8287
_sqlite3ErrorMsg(tls, pParse, zFmt, libc.VaList(bp+8, nActual, nExpect))
}
}
// C documentation
//
// /* The table or view or trigger name is passed to this routine via tokens
// ** pName1 and pName2. If the table name was fully qualified, for example:
// **
// ** CREATE TABLE xxx.yyy (...);
// **
// ** Then pName1 is set to "xxx" and pName2 "yyy". On the other hand if
// ** the table name is not fully qualified, i.e.:
// **
// ** CREATE TABLE yyy(...);
// **
// ** Then pName1 is set to "yyy" and pName2 is "".
// **
// ** This routine sets the *ppUnqual pointer to point at the token (pName1 or
// ** pName2) that stores the unqualified table name. The index of the
// ** database "xxx" is returned.
// */
func _sqlite3TwoPartName(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintptr, pUnqual uintptr) (r int32) {
bp := tls.Alloc(16)
defer tls.Free(16)
var db uintptr
var iDb int32
_, _ = db, iDb /* Database holding the object */
db = (*TParse)(unsafe.Pointer(pParse)).Fdb
if (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) {
if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 {
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13728, 0)
return -int32(1)
}
**(**uintptr)(__ccgo_up(pUnqual)) = pName2
iDb = _sqlite3FindDb(tls, db, pName1)
if iDb < 0 {
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13745, libc.VaList(bp+8, pName1))
return -int32(1)
}
} else {
iDb = libc.Int32FromUint8((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb)
**(**uintptr)(__ccgo_up(pUnqual)) = pName1
}
return iDb
}
// C documentation
//
// /*
// ** Window *pWin has just been created from a WINDOW clause. Token pBase
// ** is the base window. Earlier windows from the same WINDOW clause are
// ** stored in the linked list starting at pWin->pNextWin. This function
// ** either updates *pWin according to the base specification, or else
// ** leaves an error in pParse.
// */
func _sqlite3WindowChain(tls *libc.TLS, pParse uintptr, pWin uintptr, pList uintptr) {
bp := tls.Alloc(32)
defer tls.Free(32)
var db, pExist, zErr uintptr
_, _, _ = db, pExist, zErr
if (*TWindow)(unsafe.Pointer(pWin)).FzBase != 0 {
db = (*TParse)(unsafe.Pointer(pParse)).Fdb
pExist = _windowFind(tls, pParse, pList, (*TWindow)(unsafe.Pointer(pWin)).FzBase)
if pExist != 0 {
zErr = uintptr(0)
/* Check for errors */
if (*TWindow)(unsafe.Pointer(pWin)).FpPartition != 0 {
zErr = __ccgo_ts + 24489
} else {
if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 && (*TWindow)(unsafe.Pointer(pWin)).FpOrderBy != 0 {
zErr = __ccgo_ts + 24506
} else {
if libc.Int32FromUint8((*TWindow)(unsafe.Pointer(pExist)).FbImplicitFrame) == 0 {
zErr = __ccgo_ts + 24522
}
}
}
if zErr != 0 {
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+24542, libc.VaList(bp+8, zErr, (*TWindow)(unsafe.Pointer(pWin)).FzBase))
} else {
(*TWindow)(unsafe.Pointer(pWin)).FpPartition = _sqlite3ExprListDup(tls, db, (*TWindow)(unsafe.Pointer(pExist)).FpPartition, 0)
if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 {
(*TWindow)(unsafe.Pointer(pWin)).FpOrderBy = _sqlite3ExprListDup(tls, db, (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy, 0)
}
_sqlite3DbFree(tls, db, (*TWindow)(unsafe.Pointer(pWin)).FzBase)
(*TWindow)(unsafe.Pointer(pWin)).FzBase = uintptr(0)
}
}
}
}
// C documentation
//
// /*
// ** Write an error message into pParse->zErrMsg that explains that the
// ** user-supplied authorization function returned an illegal value.
// */
func _sqliteAuthBadReturnCode(tls *libc.TLS, pParse uintptr) {
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13611, 0)
(*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_ERROR)
}
var _statGetFuncdef = TFuncDef{
FnArg: int16(libc.Int32FromInt32(1) + libc.Int32FromInt32(IsStat4)),
FfuncFlags: uint32(SQLITE_UTF8),
FzName: __ccgo_ts + 13023,
}
var _statInitFuncdef = TFuncDef{
FnArg: int16(4),
FfuncFlags: uint32(SQLITE_UTF8),
FzName: __ccgo_ts + 12986,
}
var _statPushFuncdef = TFuncDef{
FnArg: int16(libc.Int32FromInt32(2) + libc.Int32FromInt32(IsStat4)),
FfuncFlags: uint32(SQLITE_UTF8),
FzName: __ccgo_ts + 12996,
}
func _sumFinalize(tls *libc.TLS, context uintptr) {
var p uintptr
_ = p
p = Xsqlite3_aggregate_context(tls, context, 0)
if p != 0 && (*TSumCtx)(unsafe.Pointer(p)).Fcnt > 0 {
if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 {
if (*TSumCtx)(unsafe.Pointer(p)).Fovrfl != 0 {
Xsqlite3_result_error(tls, context, __ccgo_ts+16460, -int32(1))
} else {
if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) {
Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum+(*TSumCtx)(unsafe.Pointer(p)).FrErr)
} else {
Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum)
}
}
} else {
Xsqlite3_result_int64(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FiSum)
}
}
}
// C documentation
//
// /*
// ** Return true if it is not allowed to drop the given table
// */
func _tableMayNotBeDropped(tls *libc.TLS, db uintptr, pTab uintptr) (r int32) {
if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6758, int32(7)) == 0 {
if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+3565, int32(4)) == 0 {
return 0
}
if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+7560, int32(10)) == 0 {
return 0
}
return int32(1)
}
if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, db) != 0 {
return int32(1)
}
if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != 0 {
return int32(1)
}
return 0
}
var _tkCoalesce = TToken{
Fz: __ccgo_ts + 6963,
Fn: uint32(8),
}
// C documentation
//
// /*
// ** Return a list of all triggers on table pTab if there exists at least
// ** one trigger that must be fired when an operation of type 'op' is
// ** performed on the table, and, if that operation is an UPDATE, if at
// ** least one of the columns in pChanges is being modified.
// */
func _triggersReallyExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, pChanges uintptr, pMask uintptr) (r uintptr) {
bp := tls.Alloc(16)
defer tls.Free(16)
var mask int32
var p, pList, v1 uintptr
_, _, _, _ = mask, p, pList, v1
mask = 0
pList = uintptr(0)
pList = _sqlite3TriggerList(tls, pParse, pTab)
if pList != uintptr(0) {
p = pList
if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&uint64(SQLITE_EnableTrigger) == uint64(0) && (*TTable)(unsafe.Pointer(pTab)).FpTrigger != uintptr(0) && _sqlite3SchemaToIndex(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TTrigger)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FpTrigger)).FpSchema) != int32(1) {
/* The SQLITE_DBCONFIG_ENABLE_TRIGGER setting is off. That means that
** only TEMP triggers are allowed. Truncate the pList so that it
** includes only TEMP triggers */
if pList == (*TTable)(unsafe.Pointer(pTab)).FpTrigger {
pList = uintptr(0)
goto exit_triggers_exist
}
for (*TTrigger)(unsafe.Pointer(p)).FpNext != 0 && (*TTrigger)(unsafe.Pointer(p)).FpNext != (*TTable)(unsafe.Pointer(pTab)).FpTrigger {
p = (*TTrigger)(unsafe.Pointer(p)).FpNext
}
(*TTrigger)(unsafe.Pointer(p)).FpNext = uintptr(0)
p = pList
}
for cond := true; cond; cond = p != 0 {
if libc.Int32FromUint8((*TTrigger)(unsafe.Pointer(p)).Fop) == op && _checkColumnOverlap(tls, (*TTrigger)(unsafe.Pointer(p)).FpColumns, pChanges) != 0 {
mask = mask | libc.Int32FromUint8((*TTrigger)(unsafe.Pointer(p)).Ftr_tm)
} else {
if libc.Int32FromUint8((*TTrigger)(unsafe.Pointer(p)).Fop) == int32(TK_RETURNING) {
/* The first time a RETURNING trigger is seen, the "op" value tells
** us what time of trigger it should be. */
(*TTrigger)(unsafe.Pointer(p)).Fop = libc.Uint8FromInt32(op)
if libc.Int32FromUint8((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) {
if op != int32(TK_INSERT) {
if op == int32(TK_DELETE) {
v1 = __ccgo_ts + 22462
} else {
v1 = __ccgo_ts + 22469
}
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22476, libc.VaList(bp+8, v1))
}
(*TTrigger)(unsafe.Pointer(p)).Ftr_tm = uint8(TRIGGER_BEFORE)
} else {
(*TTrigger)(unsafe.Pointer(p)).Ftr_tm = uint8(TRIGGER_AFTER)
}
mask = mask | libc.Int32FromUint8((*TTrigger)(unsafe.Pointer(p)).Ftr_tm)
} else {
if (*TTrigger)(unsafe.Pointer(p)).FbReturning != 0 && libc.Int32FromUint8((*TTrigger)(unsafe.Pointer(p)).Fop) == int32(TK_INSERT) && op == int32(TK_UPDATE) && (*TParse)(unsafe.Pointer(pParse)).FpToplevel == uintptr(0) {
/* Also fire a RETURNING trigger for an UPSERT */
mask = mask | libc.Int32FromUint8((*TTrigger)(unsafe.Pointer(p)).Ftr_tm)
}
}
}
p = (*TTrigger)(unsafe.Pointer(p)).FpNext
}
}
goto exit_triggers_exist
exit_triggers_exist:
;
if pMask != 0 {
**(**int32)(__ccgo_up(pMask)) = mask
}
if mask != 0 {
v1 = pList
} else {
v1 = uintptr(0)
}
return v1
}
// C documentation
//
// /*
// ** This routine checks if there is a RESERVED lock held on the specified
// ** file by this or any other process. If such a lock is held, set *pResOut
// ** to a non-zero value otherwise *pResOut is set to zero. The return value
// ** is set to SQLITE_OK unless an I/O error occurs during lock checking.
// */
func _unixCheckReservedLock(tls *libc.TLS, id uintptr, pResOut uintptr) (r int32) {
bp := tls.Alloc(48)
defer tls.Free(48)
var pFile uintptr
var rc, reserved int32
var _ /* lock at bp+0 */ Tflock
_, _, _ = pFile, rc, reserved
rc = SQLITE_OK
reserved = 0
pFile = id
Xsqlite3_mutex_enter(tls, (*TunixInodeInfo)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(pFile)).FpInode)).FpLockMutex)
/* Check if a thread in this process holds such a lock */
if libc.Int32FromUint8((*TunixInodeInfo)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(pFile)).FpInode)).FeFileLock) > int32(SHARED_LOCK) {
reserved = int32(1)
}
/* Otherwise see if some other process holds it.
*/
if !(reserved != 0) && !((*TunixInodeInfo)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(pFile)).FpInode)).FbProcessLock != 0) {
(**(**Tflock)(__ccgo_up(bp))).Fl_whence = SEEK_SET
(**(**Tflock)(__ccgo_up(bp))).Fl_start = int64(_sqlite3PendingByte + libc.Int32FromInt32(1))
(**(**Tflock)(__ccgo_up(bp))).Fl_len = int64(1)
(**(**Tflock)(__ccgo_up(bp))).Fl_type = int16(F_WRLCK)
if (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(7)].FpCurrent})))(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(F_GETLK), libc.VaList(bp+40, bp)) != 0 {
rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(14)<<libc.Int32FromInt32(8)
_storeLastErrno(tls, pFile, **(**int32)(__ccgo_up(libc.X__error(tls))))
} else {
if int32((**(**Tflock)(__ccgo_up(bp))).Fl_type) != int32(F_UNLCK) {
reserved = int32(1)
}
}
}
Xsqlite3_mutex_leave(tls, (*TunixInodeInfo)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(pFile)).FpInode)).FpLockMutex)
**(**int32)(__ccgo_up(pResOut)) = reserved
return rc
}
/*
** Set a posix-advisory-lock.
**
** There are two versions of this routine. If compiled with
** SQLITE_ENABLE_SETLK_TIMEOUT then the routine has an extra parameter
** which is a pointer to a unixFile. If the unixFile->iBusyTimeout
** value is set, then it is the number of milliseconds to wait before
** failing the lock. The iBusyTimeout value is always reset back to
** zero on each call.
**
** If SQLITE_ENABLE_SETLK_TIMEOUT is not defined, then do a non-blocking
** attempt to set the lock.
*/
// C documentation
//
// /*
// ** Delete the file at zPath. If the dirSync argument is true, fsync()
// ** the directory after deleting the file.
// */
func _unixDelete(tls *libc.TLS, NotUsed uintptr, zPath uintptr, dirSync int32) (r int32) {
bp := tls.Alloc(16)
defer tls.Free(16)
var rc int32
var _ /* fd at bp+0 */ int32
_ = rc
rc = SQLITE_OK
_ = NotUsed
if (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(16)].FpCurrent})))(tls, zPath) == -int32(1) {
if **(**int32)(__ccgo_up(libc.X__error(tls))) == int32(ENOENT) {
rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(23)<<libc.Int32FromInt32(8)
} else {
rc = _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(10)<<libc.Int32FromInt32(8), __ccgo_ts+3650, zPath, int32(47046))
}
return rc
}
if dirSync&int32(1) != 0 {
rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(17)].FpCurrent})))(tls, zPath, bp)
if rc == SQLITE_OK {
if _full_fsync(tls, **(**int32)(__ccgo_up(bp)), 0, 0) != 0 {
rc = _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(5)<<libc.Int32FromInt32(8), __ccgo_ts+4067, zPath, int32(47056))
}
_robust_close(tls, uintptr(0), **(**int32)(__ccgo_up(bp)), int32(47058))
} else {
rc = SQLITE_OK
}
}
return rc
}
// C documentation
//
// /*
// ** SQLite calls this function immediately after a call to unixDlSym() or
// ** unixDlOpen() fails (returns a null pointer). If a more detailed error
// ** message is available, it is written to zBufOut. If no error message
// ** is available, zBufOut is left unmodified and SQLite uses a default
// ** error message.
// */
func _unixDlError(tls *libc.TLS, NotUsed uintptr, nBuf int32, zBufOut uintptr) {
bp := tls.Alloc(16)
defer tls.Free(16)
var zErr uintptr
_ = zErr
_ = NotUsed
_unixEnterMutex(tls)
zErr = libc.Xdlerror(tls)
if zErr != 0 {
Xsqlite3_snprintf(tls, nBuf, zBufOut, __ccgo_ts+3942, libc.VaList(bp+8, zErr))
}
_unixLeaveMutex(tls)
}
// C documentation
//
// /*
// ** Attempt to set a system-lock on the file pFile. The lock is
// ** described by pLock.
// **
// ** If the pFile was opened read/write from unix-excl, then the only lock
// ** ever obtained is an exclusive lock, and it is obtained exactly once
// ** the first time any lock is attempted. All subsequent system locking
// ** operations become no-ops. Locking operations still happen internally,
// ** in order to coordinate access between separate database connections
// ** within this process, but all of that is handled in memory and the
// ** operating system does not participate.
// **
// ** This function is a pass-through to fcntl(F_SETLK) if pFile is using
// ** any VFS other than "unix-excl" or if pFile is opened on "unix-excl"
// ** and is read-only.
// **
// ** Zero is returned if the call completes successfully, or -1 if a call
// ** to fcntl() fails. In this case, errno is set appropriately (by fcntl()).
// */
func _unixFileLock(tls *libc.TLS, pFile uintptr, pLock uintptr) (r int32) {
bp := tls.Alloc(48)
defer tls.Free(48)
var pInode uintptr
var rc int32
var _ /* lock at bp+0 */ Tflock
_, _ = pInode, rc
pInode = (*TunixFile)(unsafe.Pointer(pFile)).FpInode
if libc.Int32FromUint16((*TunixFile)(unsafe.Pointer(pFile)).FctrlFlags)&(libc.Int32FromInt32(UNIXFILE_EXCL)|libc.Int32FromInt32(UNIXFILE_RDONLY)) == int32(UNIXFILE_EXCL) {
if libc.Int32FromUint8((*TunixInodeInfo)(unsafe.Pointer(pInode)).FbProcessLock) == 0 {
/* assert( pInode->nLock==0 ); <-- Not true if unix-excl READONLY used */
(**(**Tflock)(__ccgo_up(bp))).Fl_whence = SEEK_SET
(**(**Tflock)(__ccgo_up(bp))).Fl_start = int64(_sqlite3PendingByte + libc.Int32FromInt32(2))
(**(**Tflock)(__ccgo_up(bp))).Fl_len = int64(SHARED_SIZE)
(**(**Tflock)(__ccgo_up(bp))).Fl_type = int16(F_WRLCK)
rc = (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(7)].FpCurrent})))(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(F_SETLK), libc.VaList(bp+40, bp))
if rc < 0 {
return rc
}
(*TunixInodeInfo)(unsafe.Pointer(pInode)).FbProcessLock = uint8(1)
(*TunixInodeInfo)(unsafe.Pointer(pInode)).FnLock = (*TunixInodeInfo)(unsafe.Pointer(pInode)).FnLock + 1
} else {
rc = 0
}
} else {
rc = (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(7)].FpCurrent})))(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, int32(F_SETLK), libc.VaList(bp+40, pLock))
}
return rc
}
// C documentation
//
// /*
// ** The xGetLastError() method is designed to return a better
// ** low-level error message when operating-system problems come up
// ** during SQLite operation. Only the integer return code is currently
// ** used.
// */
func _unixGetLastError(tls *libc.TLS, NotUsed uintptr, NotUsed2 int32, NotUsed3 uintptr) (r int32) {
_ = NotUsed
_ = NotUsed2
_ = NotUsed3
return **(**int32)(__ccgo_up(libc.X__error(tls)))
}
/*
************************ End of sqlite3_vfs methods ***************************
******************************************************************************/
/******************************************************************************
************************** Begin Proxy Locking ********************************
**
** Proxy locking is a "uber-locking-method" in this sense: It uses the
** other locking methods on secondary lock files. Proxy locking is a
** meta-layer over top of the primitive locking implemented above. For
** this reason, the division that implements of proxy locking is deferred
** until late in the file (here) after all of the other I/O methods have
** been defined - so that the primitive locking methods are available
** as services to help with the implementation of proxy locking.
**
****
**
** The default locking schemes in SQLite use byte-range locks on the
** database file to coordinate safe, concurrent access by multiple readers
** and writers [http://sqlite.org/lockingv3.html]. The five file locking
** states (UNLOCKED, PENDING, SHARED, RESERVED, EXCLUSIVE) are implemented
** as POSIX read & write locks over fixed set of locations (via fsctl),
** on AFP and SMB only exclusive byte-range locks are available via fsctl
** with _IOWR('z', 23, struct ByteRangeLockPB2) to track the same 5 states.
** To simulate a F_RDLCK on the shared range, on AFP a randomly selected
** address in the shared range is taken for a SHARED lock, the entire
** shared range is taken for an EXCLUSIVE lock):
**
** PENDING_BYTE 0x40000000
** RESERVED_BYTE 0x40000001
** SHARED_RANGE 0x40000002 -> 0x40000200
**
** This works well on the local file system, but shows a nearly 100x
** slowdown in read performance on AFP because the AFP client disables
** the read cache when byte-range locks are present. Enabling the read
** cache exposes a cache coherency problem that is present on all OS X
** supported network file systems. NFS and AFP both observe the
** close-to-open semantics for ensuring cache coherency
** [http://nfs.sourceforge.net/#faq_a8], which does not effectively
** address the requirements for concurrent database access by multiple
** readers and writers
** [http://www.nabble.com/SQLite-on-NFS-cache-coherency-td15655701.html].
**
** To address the performance and cache coherency issues, proxy file locking
** changes the way database access is controlled by limiting access to a
** single host at a time and moving file locks off of the database file
** and onto a proxy file on the local file system.
**
**
** Using proxy locks
** -----------------
**
** C APIs
**
** sqlite3_file_control(db, dbname, SQLITE_FCNTL_SET_LOCKPROXYFILE,
** <proxy_path> | ":auto:");
** sqlite3_file_control(db, dbname, SQLITE_FCNTL_GET_LOCKPROXYFILE,
** &<proxy_path>);
**
**
** SQL pragmas
**
** PRAGMA [database.]lock_proxy_file=<proxy_path> | :auto:
** PRAGMA [database.]lock_proxy_file
**
** Specifying ":auto:" means that if there is a conch file with a matching
** host ID in it, the proxy path in the conch file will be used, otherwise
** a proxy path based on the user's temp dir
** (via confstr(_CS_DARWIN_USER_TEMP_DIR,...)) will be used and the
** actual proxy file name is generated from the name and path of the
** database file. For example:
**
** For database path "/Users/me/foo.db"
** The lock path will be "<tmpdir>/sqliteplocks/_Users_me_foo.db:auto:")
**
** Once a lock proxy is configured for a database connection, it can not
** be removed, however it may be switched to a different proxy path via
** the above APIs (assuming the conch file is not being held by another
** connection or process).
**
**
** How proxy locking works
** -----------------------
**
** Proxy file locking relies primarily on two new supporting files:
**
** * conch file to limit access to the database file to a single host
** at a time
**
** * proxy file to act as a proxy for the advisory locks normally
** taken on the database
**
** The conch file - to use a proxy file, sqlite must first "hold the conch"
** by taking an sqlite-style shared lock on the conch file, reading the
** contents and comparing the host's unique host ID (see below) and lock
** proxy path against the values stored in the conch. The conch file is
** stored in the same directory as the database file and the file name
** is patterned after the database file name as ".<databasename>-conch".
** If the conch file does not exist, or its contents do not match the
** host ID and/or proxy path, then the lock is escalated to an exclusive
** lock and the conch file contents is updated with the host ID and proxy
** path and the lock is downgraded to a shared lock again. If the conch
** is held by another process (with a shared lock), the exclusive lock
** will fail and SQLITE_BUSY is returned.
**
** The proxy file - a single-byte file used for all advisory file locks
** normally taken on the database file. This allows for safe sharing
** of the database file for multiple readers and writers on the same
** host (the conch ensures that they all use the same local lock file).
**
** Requesting the lock proxy does not immediately take the conch, it is
** only taken when the first request to lock database file is made.
** This matches the semantics of the traditional locking behavior, where
** opening a connection to a database file does not take a lock on it.
** The shared lock and an open file descriptor are maintained until
** the connection to the database is closed.
**
** The proxy file and the lock file are never deleted so they only need
** to be created the first time they are used.
**
** Configuration options
** ---------------------
**
** SQLITE_PREFER_PROXY_LOCKING
**
** Database files accessed on non-local file systems are
** automatically configured for proxy locking, lock files are
** named automatically using the same logic as
** PRAGMA lock_proxy_file=":auto:"
**
** SQLITE_PROXY_DEBUG
**
** Enables the logging of error messages during host id file
** retrieval and creation
**
** LOCKPROXYDIR
**
** Overrides the default directory used for lock proxy files that
** are named automatically via the ":auto:" setting
**
** SQLITE_DEFAULT_PROXYDIR_PERMISSIONS
**
** Permissions to use when creating a directory for storing the
** lock proxy files, only used when LOCKPROXYDIR is not set.
**
**
** As mentioned above, when compiled with SQLITE_PREFER_PROXY_LOCKING,
** setting the environment variable SQLITE_FORCE_PROXY_LOCKING to 1 will
** force proxy locking to be used for every database file opened, and 0
** will force automatic proxy locking to be disabled for all database
** files (explicitly calling the SQLITE_FCNTL_SET_LOCKPROXYFILE pragma or
** sqlite_file_control API is not affected by SQLITE_FORCE_PROXY_LOCKING).
*/
/*
** Proxy locking is only available on MacOSX
*/
/*
** The proxy locking style is intended for use with AFP filesystems.
** And since AFP is only supported on MacOSX, the proxy locking is also
** restricted to MacOSX.
**
**
******************* End of the proxy lock implementation **********************
******************************************************************************/
// C documentation
//
// /*
// ** The DMS lock has not yet been taken on shm file pShmNode. Attempt to
// ** take it now. Return SQLITE_OK if successful, or an SQLite error
// ** code otherwise.
// **
// ** If the DMS cannot be locked because this is a readonly_shm=1
// ** connection and no other process already holds a lock, return
// ** SQLITE_READONLY_CANTINIT and set pShmNode->isUnlocked=1.
// */
func _unixLockSharedMemory(tls *libc.TLS, pDbFd uintptr, pShmNode uintptr) (r int32) {
bp := tls.Alloc(48)
defer tls.Free(48)
var rc int32
var _ /* lock at bp+0 */ Tflock
_ = rc
rc = SQLITE_OK
/* Use F_GETLK to determine the locks other processes are holding
** on the DMS byte. If it indicates that another process is holding
** a SHARED lock, then this process may also take a SHARED lock
** and proceed with opening the *-shm file.
**
** Or, if no other process is holding any lock, then this process
** is the first to open it. In this case take an EXCLUSIVE lock on the
** DMS byte and truncate the *-shm file to zero bytes in size. Then
** downgrade to a SHARED lock on the DMS byte.
**
** If another process is holding an EXCLUSIVE lock on the DMS byte,
** return SQLITE_BUSY to the caller (it will try again). An earlier
** version of this code attempted the SHARED lock at this point. But
** this introduced a subtle race condition: if the process holding
** EXCLUSIVE failed just before truncating the *-shm file, then this
** process might open and use the *-shm file without truncating it.
** And if the *-shm file has been corrupted by a power failure or
** system crash, the database itself may also become corrupt. */
(**(**Tflock)(__ccgo_up(bp))).Fl_whence = SEEK_SET
(**(**Tflock)(__ccgo_up(bp))).Fl_start = int64((libc.Int32FromInt32(22)+libc.Int32FromInt32(SQLITE_SHM_NLOCK))*libc.Int32FromInt32(4) + libc.Int32FromInt32(SQLITE_SHM_NLOCK))
(**(**Tflock)(__ccgo_up(bp))).Fl_len = int64(1)
(**(**Tflock)(__ccgo_up(bp))).Fl_type = int16(F_WRLCK)
if (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(7)].FpCurrent})))(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int32(F_GETLK), libc.VaList(bp+40, bp)) != 0 {
rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(15)<<libc.Int32FromInt32(8)
} else {
if int32((**(**Tflock)(__ccgo_up(bp))).Fl_type) == int32(F_UNLCK) {
if (*TunixShmNode)(unsafe.Pointer(pShmNode)).FisReadonly != 0 {
(*TunixShmNode)(unsafe.Pointer(pShmNode)).FisUnlocked = uint8(1)
rc = libc.Int32FromInt32(SQLITE_READONLY) | libc.Int32FromInt32(5)<<libc.Int32FromInt32(8)
} else {
rc = _unixShmSystemLock(tls, pDbFd, int32(F_WRLCK), (libc.Int32FromInt32(22)+libc.Int32FromInt32(SQLITE_SHM_NLOCK))*libc.Int32FromInt32(4)+libc.Int32FromInt32(SQLITE_SHM_NLOCK), int32(1))
/* The first connection to attach must truncate the -shm file. We
** truncate to 3 bytes (an arbitrary small number, less than the
** -shm header size) rather than 0 as a system debugging aid, to
** help detect if a -shm file truncation is legitimate or is the work
** or a rogue process. */
if rc == SQLITE_OK && _robust_ftruncate(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int64(3)) != 0 {
rc = _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(18)<<libc.Int32FromInt32(8), __ccgo_ts+3576, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, int32(45100))
}
}
} else {
if int32((**(**Tflock)(__ccgo_up(bp))).Fl_type) == int32(F_WRLCK) {
rc = int32(SQLITE_BUSY)
}
}
}
if rc == SQLITE_OK {
rc = _unixShmSystemLock(tls, pDbFd, int32(F_RDLCK), (libc.Int32FromInt32(22)+libc.Int32FromInt32(SQLITE_SHM_NLOCK))*libc.Int32FromInt32(4)+libc.Int32FromInt32(SQLITE_SHM_NLOCK), int32(1))
}
return rc
}
// C documentation
//
// /*
// ** Apply posix advisory locks for all bytes from ofst through ofst+n-1.
// **
// ** Locks block if the mask is exactly UNIX_SHM_C and are non-blocking
// ** otherwise.
// */
func _unixShmSystemLock(tls *libc.TLS, pFile uintptr, lockType int32, ofst int32, n int32) (r int32) {
bp := tls.Alloc(48)
defer tls.Free(48)
var pShmNode uintptr
var rc, res int32
var _ /* f at bp+0 */ Tflock
_, _, _ = pShmNode, rc, res /* The posix advisory locking structure */
rc = SQLITE_OK /* Result code form fcntl() */
pShmNode = (*TunixInodeInfo)(unsafe.Pointer((*TunixFile)(unsafe.Pointer(pFile)).FpInode)).FpShmNode
/* Assert that the parameters are within expected range and that the
** correct mutex or mutexes are held. */
if ofst == (libc.Int32FromInt32(22)+libc.Int32FromInt32(SQLITE_SHM_NLOCK))*libc.Int32FromInt32(4)+libc.Int32FromInt32(SQLITE_SHM_NLOCK) {
} else {
}
/* Shared locks never span more than one byte */
/* Locks are within range */
if (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm >= 0 {
/* Initialize the locking parameters */
(**(**Tflock)(__ccgo_up(bp))).Fl_type = int16(lockType)
(**(**Tflock)(__ccgo_up(bp))).Fl_whence = SEEK_SET
(**(**Tflock)(__ccgo_up(bp))).Fl_start = int64(ofst)
(**(**Tflock)(__ccgo_up(bp))).Fl_len = int64(n)
res = (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(7)].FpCurrent})))(tls, (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int32(F_SETLK), libc.VaList(bp+40, bp))
if res == -int32(1) {
rc = int32(SQLITE_BUSY)
}
}
/* Do debug tracing */
return rc
}
// C documentation
//
// /*
// ** Initialize first two members of azTempDirs[] array.
// */
func _unixTempFileInit(tls *libc.TLS) {
_azTempDirs[0] = libc.Xgetenv(tls, __ccgo_ts+4022)
_azTempDirs[int32(1)] = libc.Xgetenv(tls, __ccgo_ts+4036)
}
// C documentation
//
// /*
// ** These functions are called when a transaction opened by the database
// ** handle associated with the VM passed as an argument is about to be
// ** committed. If there are outstanding foreign key constraint violations
// ** return an error code. Otherwise, SQLITE_OK.
// **
// ** If there are outstanding FK violations and this function returns
// ** non-zero, set the result of the VM to SQLITE_CONSTRAINT_FOREIGNKEY
// ** and write an error message to it.
// */
func _vdbeFkError(tls *libc.TLS, p uintptr) (r int32) {
(*TVdbe)(unsafe.Pointer(p)).Frc = libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(3)<<libc.Int32FromInt32(8)
(*TVdbe)(unsafe.Pointer(p)).FerrorAction = uint8(OE_Abort)
_sqlite3VdbeError(tls, p, __ccgo_ts+5394, 0)
if libc.Int32FromUint8((*TVdbe)(unsafe.Pointer(p)).FprepFlags)&int32(SQLITE_PREPARE_SAVESQL) == 0 {
return int32(SQLITE_ERROR)
}
return libc.Int32FromInt32(SQLITE_CONSTRAINT) | libc.Int32FromInt32(3)<<libc.Int32FromInt32(8)
}
// C documentation
//
// /*
// ** Check on a Vdbe to make sure it has not been finalized. Log
// ** an error and return true if it has been finalized (or is otherwise
// ** invalid). Return false if it is ok.
// */
func _vdbeSafety(tls *libc.TLS, p uintptr) (r int32) {
if (*TVdbe)(unsafe.Pointer(p)).Fdb == uintptr(0) {
Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5507, 0)
return int32(1)
} else {
return 0
}
return r
}
func _vdbeSafetyNotNull(tls *libc.TLS, p uintptr) (r int32) {
if p == uintptr(0) {
Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+5552, 0)
return int32(1)
} else {
return _vdbeSafety(tls, p)
}
return r
}
// C documentation
//
// /*
// ** If the WAL file is currently larger than nMax bytes in size, truncate
// ** it to exactly nMax bytes. If an error occurs while doing so, ignore it.
// */
func _walLimitSize(tls *libc.TLS, pWal uintptr, nMax Ti64) {
bp := tls.Alloc(32)
defer tls.Free(32)
var rx int32
var _ /* sz at bp+0 */ Ti64
_ = rx
_sqlite3BeginBenignMalloc(tls)
rx = _sqlite3OsFileSize(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, bp)
if rx == SQLITE_OK && **(**Ti64)(__ccgo_up(bp)) > nMax {
rx = _sqlite3OsTruncate(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, nMax)
}
_sqlite3EndBenignMalloc(tls)
if rx != 0 {
Xsqlite3_log(tls, rx, __ccgo_ts+4315, libc.VaList(bp+16, (*TWal)(unsafe.Pointer(pWal)).FzWalName))
}
}
func _windowFind(tls *libc.TLS, pParse uintptr, pList uintptr, zName uintptr) (r uintptr) {
bp := tls.Alloc(16)
defer tls.Free(16)
var p uintptr
_ = p
p = pList
for {
if !(p != 0) {
break
}
if _sqlite3StrICmp(tls, (*TWindow)(unsafe.Pointer(p)).FzName, zName) == 0 {
break
}
goto _1
_1:
;
p = (*TWindow)(unsafe.Pointer(p)).FpNextWin
}
if p == uintptr(0) {
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+24278, libc.VaList(bp+8, zName))
}
return p
}
// C documentation
//
// /*
// ** The following routine is called if the stack overflows.
// */
func _yyStackOverflow(tls *libc.TLS, yypParser uintptr) {
var pParse uintptr
_ = pParse
pParse = (*TyyParser)(unsafe.Pointer(yypParser)).FpParse
for (*TyyParser)(unsafe.Pointer(yypParser)).Fyytos > (*TyyParser)(unsafe.Pointer(yypParser)).Fyystack {
_yy_pop_parser_stack(tls, yypParser)
}
/* Here code is inserted which will execute if the parser
** stack every overflows */
/******** Begin %stack_overflow code ******************************************/
if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 {
_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+24981, 0)
}
/******** End %stack_overflow code ********************************************/
/* Suppress warning about unused %extra_argument var */
(*TyyParser)(unsafe.Pointer(yypParser)).FpParse = pParse
}
/*
** Print tracing information for a SHIFT action
*/
type accmode_t = Taccmode_t
type c_caddr_t = Tc_caddr_t
type cap_ioctl_t = Tcap_ioctl_t
type constraint_handler_t = Tconstraint_handler_t
type cpulevel_t = Tcpulevel_t
type cpusetid_t = Tcpusetid_t
type cpuwhich_t = Tcpuwhich_t
type critical_t = Tcritical_t
type crypt_data = Tcrypt_data
type dl_serinfo = Tdl_serinfo
type dl_serpath = Tdl_serpath
type dlfunc_t = Tdlfunc_t
const fds_bits = 0
type fflags_t = Tfflags_t
type fiobmap2_arg = Tfiobmap2_arg
type fiodgname_arg = Tfiodgname_arg
type kpaddr_t = Tkpaddr_t
type ksize_t = Tksize_t
type kssize_t = Tkssize_t
type kvaddr_t = Tkvaddr_t
type pthread_addr_t = Tpthread_addr_t
type pthread_once = Tpthread_once
type pthread_startroutine_t = Tpthread_startroutine_t
type rman_res_t = Trman_res_t
type sbintime_t = Tsbintime_t
type shm_largepage_conf = Tshm_largepage_conf
/*
** Try to determine if gethostuuid() is available based on standard
** macros. This might sometimes compute the wrong value for some
** obscure platforms. For those cases, simply compile with one of
** the following:
**
** -DHAVE_GETHOSTUUID=0
** -DHAVE_GETHOSTUUID=1
**
** None if this matters except when building on Apple products with
** -DSQLITE_ENABLE_LOCKING_STYLE.
*/
/*
** Allowed values of unixFile.fsFlags
*/
/*
** If we are to be thread-safe, include the pthreads header.
*/
/* # include <pthread.h> */
/*
** Default permissions when creating a new file
*/
/*
** Default permissions when creating auto proxy dir
*/
/*
** Maximum supported path-length.
*/
/*
** Maximum supported symbolic links
*/
/*
** Remove and stub certain info for WASI (WebAssembly System
** Interface) builds.
*/
/* Always cast the getpid() return type for compatibility with
** kernel modules in VxWorks. */
/*
** Only set the lastErrno if the error code is a real error and not
** a normal expected return code of SQLITE_BUSY or SQLITE_OK
*/
type spacectl_range = Tspacectl_range
type syscallarg_t = Tsyscallarg_t
type t__accmode_t = int32
type t__char16_t = uint16
type t__char32_t = uint32
type t__cpulevel_t = int32
type t__cpusetid_t = int32
type t__cpuwhich_t = int32
type t__ct_rune_t = int32
type t__daddr_t = int64
type t__dev_t = uint64
type t__dlfunc_arg = struct {
F__dlfunc_dummy int32
}
type t__fflags_t = uint32
type t__id_t = int64
type t__lwpid_t = int32
type t__mode_t = uint16
type t__mqd_t = uintptr
type t__nl_item = int32
type t__nlink_t = uint64
type t__off64_t = int64
type t__rlim_t = int64
type t__rman_res_t = uint64
type t__sbintime_t = int64
type t__sigset = t__sigset_t
type t__sigset_t = struct {
F__bits [4]t__uint32_t
}
type t__timer_t = uintptr
type u_register_t = Tu_register_t
type uint_fast64_t = Tuint_fast64_t
/* GNU and Darwin define this and people seem to think it's portable */
/* Limits of wchar_t. */
/* ISO/IEC 9899:2011 K.3.4.4 */
/*
** The following macros are used to cast pointers to integers and
** integers to pointers. The way you do this varies from one compiler
** to the next, so we have developed the following set of #if statements
** to generate appropriate macros for a wide range of compilers.
**
** The correct "ANSI" way to do this is to use the intptr_t type.
** Unfortunately, that typedef is not available on all compilers, or
** if it is available, it requires an #include of specific headers
** that vary from one machine to the next.
**
** Ticket #3860: The llvm-gcc-4.2 compiler from Apple chokes on
** the ((void*)&((char*)0)[X]) construct. But MSVC chokes on ((void*)(X)).
** So we have to define the macros in different ways depending on the
** compiler.
*/
/*
** Macros to hint to the compiler that a function should or should not be
** inlined.
*/
/*
** Make sure that the compiler intrinsics we desire are enabled when
** compiling with an appropriate version of MSVC unless prevented by
** the SQLITE_DISABLE_INTRINSIC define.
*/
/*
** Enable SQLITE_USE_SEH by default on MSVC builds. Only omit
** SEH support if the -DSQLITE_OMIT_SEH option is given.
*/
/*
** Enable SQLITE_DIRECT_OVERFLOW_READ, unless the build explicitly
** disables it using -DSQLITE_DIRECT_OVERFLOW_READ=0
*/
/* In all other cases, enable */
/*
** The SQLITE_THREADSAFE macro must be defined as 0, 1, or 2.
** 0 means mutexes are permanently disable and the library is never
** threadsafe. 1 means the library is serialized which is the highest
** level of threadsafety. 2 means the library is multithreaded - multiple
** threads can use SQLite as long as no two threads try to use the same
** database connection at the same time.
**
** Older versions of SQLite used an optional THREADSAFE macro.
** We support that for legacy.
**
** To ensure that the correct value of "THREADSAFE" is reported when querying
** for compile-time options at runtime (e.g. "PRAGMA compile_options"), this
** logic is partially replicated in ctime.c. If it is updated here, it should
** also be updated there.
*/
/*
** Powersafe overwrite is on by default. But can be turned off using
** the -DSQLITE_POWERSAFE_OVERWRITE=0 command-line option.
*/
/*
** EVIDENCE-OF: R-25715-37072 Memory allocation statistics are enabled by
** default unless SQLite is compiled with SQLITE_DEFAULT_MEMSTATUS=0 in
** which case memory allocation statistics are disabled by default.
*/
/*
** Exactly one of the following macros must be defined in order to
** specify which memory allocation subsystem to use.
**
** SQLITE_SYSTEM_MALLOC // Use normal system malloc()
** SQLITE_WIN32_MALLOC // Use Win32 native heap API
** SQLITE_ZERO_MALLOC // Use a stub allocator that always fails
** SQLITE_MEMDEBUG // Debugging version of system malloc()
**
** On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the
** assert() macro is enabled, each call into the Win32 native heap subsystem
** will cause HeapValidate to be called. If heap validation should fail, an
** assertion will be triggered.
**
** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as
** the default.
*/
/*
** If SQLITE_MALLOC_SOFT_LIMIT is not zero, then try to keep the
** sizes of memory allocations below this value where possible.
*/
/*
** We need to define _XOPEN_SOURCE as follows in order to enable
** recursive mutexes on most Unix systems and fchmod() on OpenBSD.
** But _XOPEN_SOURCE define causes problems for Mac OS X, so omit
** it.
*/
/*
** NDEBUG and SQLITE_DEBUG are opposites. It should always be true that
** defined(NDEBUG)==!defined(SQLITE_DEBUG). If this is not currently true,
** make it true by defining or undefining NDEBUG.
**
** Setting NDEBUG makes the code smaller and faster by disabling the
** assert() statements in the code. So we want the default action
** to be for NDEBUG to be set and NDEBUG to be undefined only if SQLITE_DEBUG
** is set. Thus NDEBUG becomes an opt-in rather than an opt-out
** feature.
*/
/*
** Enable SQLITE_ENABLE_EXPLAIN_COMMENTS if SQLITE_DEBUG is turned on.
*/
/*
** The testcase() macro is used to aid in coverage testing. When
** doing coverage testing, the condition inside the argument to
** testcase() must be evaluated both true and false in order to
** get full branch coverage. The testcase() macro is inserted
** to help ensure adequate test coverage in places where simple
** condition/decision coverage is inadequate. For example, testcase()
** can be used to make sure boundary values are tested. For
** bitmask tests, testcase() can be used to make sure each bit
** is significant and used at least once. On switch statements
** where multiple cases go to the same block of code, testcase()
** can insure that all cases are evaluated.
*/
/*
** The TESTONLY macro is used to enclose variable declarations or
** other bits of code that are needed to support the arguments
** within testcase() and assert() macros.
*/
/*
** Sometimes we need a small amount of code such as a variable initialization
** to setup for a later assert() statement. We do not want this code to
** appear when assert() is disabled. The following macro is therefore
** used to contain that setup code. The "VVA" acronym stands for
** "Verification, Validation, and Accreditation". In other words, the
** code within VVA_ONLY() will only run during verification processes.
*/
/*
** Disable ALWAYS() and NEVER() (make them pass-throughs) for coverage
** and mutation testing
*/
/*
** The ALWAYS and NEVER macros surround boolean expressions which
** are intended to always be true or false, respectively. Such
** expressions could be omitted from the code completely. But they
** are included in a few cases in order to enhance the resilience
** of SQLite to unexpected behavior - to make the code "self-healing"
** or "ductile" rather than being "brittle" and crashing at the first
** hint of unplanned behavior.
**
** In other words, ALWAYS and NEVER are added for defensive code.
**
** When doing coverage testing ALWAYS and NEVER are hard-coded to
** be true and false so that the unreachable code they specify will
** not be counted as untested code.
*/
/*
** Some conditionals are optimizations only. In other words, if the
** conditionals are replaced with a constant 1 (true) or 0 (false) then
** the correct answer is still obtained, though perhaps not as quickly.
**
** The following macros mark these optimizations conditionals.
*/
/*
** Some malloc failures are only possible if SQLITE_TEST_REALLOC_STRESS is
** defined. We need to defend against those failures when testing with
** SQLITE_TEST_REALLOC_STRESS, but we don't want the unreachable branches
** during a normal build. The following macro can be used to disable tests
** that are always false except when SQLITE_TEST_REALLOC_STRESS is set.
*/
/*
** Declarations used for tracing the operating system interfaces.
*/
/*
** Is the sqlite3ErrName() function needed in the build? Currently,
** it is needed by "mutex_w32.c" (when debugging), "os_win.c" (when
** OSTRACE is enabled), and by several "test*.c" files (which are
** compiled using SQLITE_TEST).
*/
/*
** SQLITE_ENABLE_EXPLAIN_COMMENTS is incompatible with SQLITE_OMIT_EXPLAIN
*/
/*
** SQLITE_OMIT_VIRTUALTABLE implies SQLITE_OMIT_ALTERTABLE
*/
/*
** Return true (non-zero) if the input is an integer that is too large
** to fit in 32-bits. This macro is used inside of various testcase()
** macros to verify that we have tested SQLite for large-file support.
*/
/*
** The macro unlikely() is a hint that surrounds a boolean
** expression that is usually false. Macro likely() surrounds
** a boolean expression that is usually true. These hints could,
** in theory, be used by the compiler to generate better code, but
** currently they are just comments for human readers.
*/
/************** Include hash.h in the middle of sqliteInt.h ******************/
/************** Begin file hash.h ********************************************/
/*
** 2001 September 22
**
** 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 is the header file for the generic hash-table implementation
** used in SQLite.
*/
type vm_ooffset_t = Tvm_ooffset_t
type vm_paddr_t = Tvm_paddr_t
type vm_pindex_t = Tvm_pindex_t