package sqlite3

Import Path
	modernc.org/sqlite/lib (on go.dev)

Dependency Relation
	imports 9 packages, and imported by one package


Package-Level Type Names (total 1029, in which 846 are exported)
/* sort exporteds by: | */
The afpLockingContext structure contains all afp lock specific state FdbPath uintptr Freserved int32
An instance of this structure contains information needed to generate code for a SELECT that contains aggregate functions. If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a pointer to this structure. The Expr.iAgg field is the index in AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate code for that node. AggInfo.pGroupBy and AggInfo.aFunc.pExpr point to fields within the original Select structure that describes the SELECT statement. These fields do not need to be freed when deallocating the AggInfo structure. FiColumn I16 FiMem int32 FiSorterColumn I16 FiTable int32 FpCExpr uintptr FpTab uintptr
An instance of this structure contains information needed to generate code for a SELECT that contains aggregate functions. If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a pointer to this structure. The Expr.iAgg field is the index in AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate code for that node. AggInfo.pGroupBy and AggInfo.aFunc.pExpr point to fields within the original Select structure that describes the SELECT statement. These fields do not need to be freed when deallocating the AggInfo structure. FiDistAddr int32 FiDistinct int32 FiMem int32 FpFExpr uintptr FpFunc uintptr
Used to pass information from the analyzer reader through to the callback routine. Fdb uintptr FzDatabase uintptr
FaTokenChar [128]uint8
FaTokenChar [128]uint8
type Attrgroup_t = U_int32_t (basic type)
Fattr_dataoffset Int32_t Fattr_length U_int32_t
type Au_asflgs_t = U_int64_t (basic type)
type Au_asid_t = Pid_t (basic type)
type Au_class_t = U_int32_t (basic type)
type Au_ctlmode_t = uint8 (basic type)
type Au_emod_t = U_int16_t (basic type)
Fec_class Au_class_t Fec_number Au_event_t
type Au_event_t = U_int16_t (basic type)
Fage Time_t Fop_type uint8 Fsize Size_t
Faf_currsz U_int64_t Faf_filesz U_int64_t
type Au_id_t = Uid_t (basic type)
Fam_failure uint32 Fam_success uint32
Faq_bufsz int32 Faq_delay int32 Faq_hiwater int32 Faq_lowater int32 Faq_minfree int32
Fas_aia_p uintptr Fas_mask Au_mask_t
Fat_addr [4]U_int32_t Fat_port Dev_t Fat_type U_int32_t
Fmachine U_int32_t Fport Dev_t
Fai_asid Au_asid_t Fai_auid Au_id_t Fai_mask Au_mask_t Fai_termid Au_tid_t
FpParse uintptr FzAuthContext uintptr
FpParse uintptr FzAuthContext uintptr
FiDb int32 FpNext uintptr FpTab uintptr FregCtr int32
FiDb int32 FpNext uintptr FpTab uintptr FregCtr int32
Elements of the linked list at Vdbe.pAuxData FiAuxArg int32 FiAuxOp int32 FpAux uintptr FpNextAux uintptr FxDeleteAux uintptr
Elements of the linked list at Vdbe.pAuxData FiAuxArg int32 FiAuxOp int32 FpAux uintptr FpNextAux uintptr FxDeleteAux uintptr
Global variables. FxBenignBegin uintptr FxBenignEnd uintptr
Global variables. FxBenignBegin uintptr FxBenignEnd uintptr
A bitfield type for use inside of structures. Always follow with :N where N is the number of bits.
The bitmask datatype defined below is used for various optimizations. Changing this from a 64-bit to a 32-bit type limits the number of tables in a join to 32 instead of 64. But it also reduces the size of the library by 738 bytes on ix86.
FiDivisor U32 FiSize U32 FnSet U32 Fu struct{_ [0]uint64; FaBitmap [496]U8}
FiDivisor U32 FiSize U32 FnSet U32 Fu struct{_ [0]uint64; FaBitmap [496]U8}
type Blkcnt_t = X__darwin_blkcnt_t (basic type)
type Blksize_t = X__darwin_blksize_t (basic type)
Boolean values
type Boolean_t = uint32 (basic type)
FeLock U8 FiTable Pgno FpBtree uintptr FpNext uintptr
FeLock U8 FiTable Pgno FpBtree uintptr FpNext uintptr
Forward declarations of structure Fdb uintptr FhasIncrblobCur U8 FiBDataVersion U32 FinTrans U8 Flock BtLock Flocked U8 FnBackup int32 FpBt uintptr FpNext uintptr FpPrev uintptr Fsharable U8 FwantToLock int32
Forward declarations of structure Fdb uintptr FhasIncrblobCur U8 FiBDataVersion U32 FinTrans U8 Flock BtLock Flocked U8 FnBackup int32 FpBt uintptr FpNext uintptr FpPrev uintptr Fsharable U8 FwantToLock int32
FaMem uintptr FnData int32 FnKey Sqlite3_int64 FnMem U16 FnZero int32 FpData uintptr FpKey uintptr
FpUserData uintptr FxDestroy uintptr FxFunc Fts5_extension_function FzFunc uintptr
Fx Fts5_tokenizer FzName uintptr
An instance of the following structure is used to store the busy-handler callback for a given sqlite handle. The sqlite.busyHandler member of the sqlite struct contains the busy callback for the database handle. Each pager opened via the sqlite handle is passed a pointer to sqlite.busyHandler. The busy-handler callback is currently invoked only from within pager.c. FnBusy int32 FpBusyArg uintptr FxBusyHandler uintptr
An instance of the following structure is used to store the busy-handler callback for a given sqlite handle. The sqlite.busyHandler member of the sqlite struct contains the busy callback for the database handle. Each pager opened via the sqlite handle is passed a pointer to sqlite.busyHandler. The busy-handler callback is currently invoked only from within pager.c. FnBusy int32 FpBusyArg uintptr FxBusyHandler uintptr
Copyright (c) 2017 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@
Context object type used by rank(), dense_rank(), percent_rank() and cume_dist(). FnStep I64 FnTotal I64 FnValue I64
A CellArray object contains a cache of pointers and sizes for a consecutive sequence of cells that might be held on multiple pages. The cells in this array are the divider cell or cells from the pParent page plus up to three child pages. There are a total of nCell cells. pRef is a pointer to one of the pages that contributes cells. This is used to access information such as MemPage.intKey and MemPage.pBt->pageSize which should be common to all pages that contribute cells to this array. apCell[] and szCell[] hold, respectively, pointers to the start of each cell and the size of each cell. Some of the apCell[] pointers might refer to overflow cells. In other words, some apCel[] pointers might not point to content area of the pages. A szCell[] of zero means the size of that cell has not yet been computed. The cells come from as many as four different pages: ----------- | Parent | ----------- / | ** / | ** --------- --------- --------- |Child-1| |Child-2| |Child-3| --------- --------- --------- The order of cells is in the array is for an index btree is: 1. All cells from Child-1 in order 2. The first divider cell from Parent 3. All cells from Child-2 in order 4. The second divider cell from Parent 5. All cells from Child-3 in order For a table-btree (with rowids) the items 2 and 4 are empty because content exists only in leaves and there are no divider cells. For an index btree, the apEnd[] array holds pointer to the end of page for Child-1, the Parent, Child-2, the Parent (again), and Child-3, respectively. The ixNx[] array holds the number of cells contained in each of these 5 stages, and all stages to the left. Hence: ixNx[0] = Number of cells in Child-1. ixNx[1] = Number of cells in Child-1 plus 1 for first divider. ixNx[2] = Number of cells in Child-1 and Child-2 + 1 for 1st divider. ixNx[3] = Number of cells in Child-1 and Child-2 + both divider cells ixNx[4] = Total number of cells. For a table-btree, the concept is similar, except only apEnd[0]..apEnd[2] are used and they point to the leaf pages only, and the ixNx value are: ixNx[0] = Number of cells in Child-1. ixNx[1] = Number of cells in Child-1 and Child-2. ixNx[2] = Total number of cells. Sometimes when deleting, a child page can have zero cells. In those cases, ixNx[] entries with higher indexes, and the corresponding apEnd[] entries, shift down. The end result is that each ixNx[] entry should be larger than the previous FapCell uintptr FapEnd [6]uintptr FixNx [6]int32 FnCell int32 FpRef uintptr FszCell uintptr
A CellArray object contains a cache of pointers and sizes for a consecutive sequence of cells that might be held on multiple pages. The cells in this array are the divider cell or cells from the pParent page plus up to three child pages. There are a total of nCell cells. pRef is a pointer to one of the pages that contributes cells. This is used to access information such as MemPage.intKey and MemPage.pBt->pageSize which should be common to all pages that contribute cells to this array. apCell[] and szCell[] hold, respectively, pointers to the start of each cell and the size of each cell. Some of the apCell[] pointers might refer to overflow cells. In other words, some apCel[] pointers might not point to content area of the pages. A szCell[] of zero means the size of that cell has not yet been computed. The cells come from as many as four different pages: ----------- | Parent | ----------- / | ** / | ** --------- --------- --------- |Child-1| |Child-2| |Child-3| --------- --------- --------- The order of cells is in the array is for an index btree is: 1. All cells from Child-1 in order 2. The first divider cell from Parent 3. All cells from Child-2 in order 4. The second divider cell from Parent 5. All cells from Child-3 in order For a table-btree (with rowids) the items 2 and 4 are empty because content exists only in leaves and there are no divider cells. For an index btree, the apEnd[] array holds pointer to the end of page for Child-1, the Parent, Child-2, the Parent (again), and Child-3, respectively. The ixNx[] array holds the number of cells contained in each of these 5 stages, and all stages to the left. Hence: ixNx[0] = Number of cells in Child-1. ixNx[1] = Number of cells in Child-1 plus 1 for first divider. ixNx[2] = Number of cells in Child-1 and Child-2 + 1 for 1st divider. ixNx[3] = Number of cells in Child-1 and Child-2 + both divider cells ixNx[4] = Total number of cells. For a table-btree, the concept is similar, except only apEnd[0]..apEnd[2] are used and they point to the leaf pages only, and the ixNx value are: ixNx[0] = Number of cells in Child-1. ixNx[1] = Number of cells in Child-1 and Child-2. ixNx[2] = Total number of cells. Sometimes when deleting, a child page can have zero cells. In those cases, ixNx[] entries with higher indexes, and the corresponding apEnd[] entries, shift down. The end result is that each ixNx[] entry should be larger than the previous FapCell uintptr FapEnd [6]uintptr FixNx [6]int32 FnCell int32 FpRef uintptr FszCell uintptr
FnKey I64 FnLocal U16 FnPayload U32 FnSize U16 FpPayload uintptr
FnKey I64 FnLocal U16 FnPayload U32 FnSize U16 FpPayload uintptr
Object used to iterate through all "coalesced phrase instances" in a single column of the current row. If the phrase instances in the column being considered do not overlap, this object simply iterates through them. Or, if they do overlap (share one or more tokens in common), each set of overlapping instances is treated as a single match. See documentation for the highlight() auxiliary function for details. Usage is: for(rc = fts5CInstIterNext(pApi, pFts, iCol, &iter); (rc==SQLITE_OK && 0==fts5CInstIterEof(&iter); rc = fts5CInstIterNext(&iter) ){ printf("instance starts at %d, ends at %d\n", iter.iStart, iter.iEnd); } FiCol int32 FiEnd int32 FiInst int32 FiStart int32 FnInst int32 FpApi uintptr FpFts uintptr
Object used to iterate through all "coalesced phrase instances" in a single column of the current row. If the phrase instances in the column being considered do not overlap, this object simply iterates through them. Or, if they do overlap (share one or more tokens in common), each set of overlapping instances is treated as a single match. See documentation for the highlight() auxiliary function for details. Usage is: for(rc = fts5CInstIterNext(pApi, pFts, iCol, &iter); (rc==SQLITE_OK && 0==fts5CInstIterEof(&iter); rc = fts5CInstIterNext(&iter) ){ printf("instance starts at %d, ends at %d\n", iter.iStart, iter.iEnd); } FiCol int32 FiEnd int32 FiInst int32 FiStart int32 FnInst int32 FpApi uintptr FpFts uintptr
Copyright (c) 2003-2012 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@ Copyright (c) 2000-2007 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@ Copyright 1995 NeXT Computer, Inc. All rights reserved.
type Clockid_t = uint32 (basic type)
Fenc U8 FpUser uintptr FxCmp uintptr FxDel uintptr FzName uintptr
Fenc U8 FpUser uintptr FxCmp uintptr FxDel uintptr FzName uintptr
Faffinity int8 FcolFlags U16 FhName U8 FnotNull U8 FpDflt uintptr FszEst U8 FzColl uintptr FzName uintptr
Faffinity int8 FcolFlags U16 FhName U8 FnotNull U8 FpDflt uintptr FszEst U8 FzColl uintptr FzName uintptr
The following structure keeps track of state information for the count() aggregate function. Fn I64
The following structure keeps track of state information for the count() aggregate function. Fn I64
Copyright (c) 2003-2007 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@
FeM10d U8 FpCols uintptr FpSelect uintptr FpUse uintptr FzCteErr uintptr FzName uintptr
FeM10d U8 FpCols uintptr FpSelect uintptr FpUse uintptr FzCteErr uintptr FzName uintptr
FaddrM9e int32 FeM10d U8 FiCur int32 FnRowEst LogEst FnUse int32 FregRtn int32
FaddrM9e int32 FeM10d U8 FiCur int32 FnRowEst LogEst FnUse int32 FregRtn int32
type Daddr_t = Int32_t (basic type)
A structure for holding a single date and time. FD int32 FM int32 FY int32 Fh int32 FiJD Sqlite3_int64 FisError int8 Fm int32 FrawS int8 Fs float64 Ftz int32 FtzSet int8 FvalidHMS int8 FvalidJD int8 FvalidTZ int8 FvalidYMD int8
A structure for holding a single date and time. FD int32 FM int32 FY int32 Fh int32 FiJD Sqlite3_int64 FisError int8 Fm int32 FrawS int8 Fs float64 Ftz int32 FtzSet int8 FvalidHMS int8 FvalidJD int8 FvalidTZ int8 FvalidYMD int8
FbSyncSet U8 FpBt uintptr FpSchema uintptr Fsafety_level U8 FzDbSName uintptr
FbSyncSet U8 FpBt uintptr FpSchema uintptr Fsafety_level U8 FzDbSName uintptr
FbTemp U8 FpName uintptr FpParse uintptr FpSchema uintptr Fw Walker FzDb uintptr FzType uintptr
FbTemp U8 FpName uintptr FpParse uintptr FpSchema uintptr Fw Walker FzDb uintptr FzType uintptr
The DblquoteStr object holds the text of a double-quoted string for a prepared statement. A linked list of these objects is constructed during statement parsing and is held on Vdbe.pDblStr. When computing a normalized SQL statement for an SQL statement, that list is consulted for each double-quoted identifier to see if the identifier should really be a string literal. FpNextStr uintptr Fz [8]int8
The DblquoteStr object holds the text of a double-quoted string for a prepared statement. A linked list of these objects is constructed during statement parsing and is held on Vdbe.pDblStr. When computing a normalized SQL statement for an SQL statement, that list is consulted for each double-quoted identifier to see if the identifier should really be a string literal. FpNextStr uintptr Fz [8]int8
type Dev_t = X__darwin_dev_t (basic type)
An instance of the following object is used to record information about how to process the DISTINCT keyword, to simplify passing that information into the selectInnerLoop() routine. FaddrTnct int32 FeTnctType U8 FisTnct U8 FtabTnct int32
An instance of the following object is used to record information about how to process the DISTINCT keyword, to simplify passing that information into the selectInnerLoop() routine. FaddrTnct int32 FeTnctType U8 FisTnct U8 FtabTnct int32
Fquot int32 Frem int32
Structure filled in by dladdr(). Fdli_fbase uintptr Fdli_fname uintptr Fdli_saddr uintptr Fdli_sname uintptr
type Double_t = float64 (basic type)
Fenc U8 FzName uintptr
Copyright (c) 2003-2012 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@
Each builtin conversion character (ex: the 'd' in "%d") is described by an instance of the following structure Fbase EtByte Fcharset EtByte Fflags EtByte Ffmttype int8 Fprefix EtByte Ftype EtByte
An "etByte" is an 8-bit unsigned value.
FaffExpr int8 Fflags U32 FiAgg I16 FiColumn YnVar FiRightJoinTable int32 FiTable int32 FnHeight int32 Fop U8 Fop2 U8 FpAggInfo uintptr FpLeft uintptr FpRight uintptr Fu struct{FzToken uintptr} Fx struct{FpList uintptr} Fy struct{FpTab uintptr}
FaffExpr int8 Fflags U32 FiAgg I16 FiColumn YnVar FiRightJoinTable int32 FiTable int32 FnHeight int32 Fop U8 Fop2 U8 FpAggInfo uintptr FpLeft uintptr FpRight uintptr Fu struct{FzToken uintptr} Fx struct{FpList uintptr} Fy struct{FpTab uintptr}
Fa [1]struct{FpExpr uintptr; FzEName uintptr; FsortFlags U8; _ [3]byte; FeEName uint8; _ [3]byte; Fu struct{_ [0]uint32; Fx struct{FiOrderByCol U16; FiAlias U16}}; _ [4]byte} FnAlloc int32 FnExpr int32
Fa [1]struct{FpExpr uintptr; FzEName uintptr; FsortFlags U8; _ [3]byte; FeEName uint8; _ [3]byte; Fu struct{_ [0]uint32; Fx struct{FiOrderByCol U16; FiAlias U16}}; _ [4]byte} FnAlloc int32 FnExpr int32
A list of expressions. Each expression may optionally have a name. An expr/name combination can be used in several ways, such as the list of "expr AS ID" fields following a "SELECT" or in the list of "ID = expr" items in an UPDATE. A list of expressions can also be used as the argument to a function, in which case the a.zName field is not used. In order to try to keep memory usage down, the Expr.a.zEName field is used for multiple purposes: eEName Usage ---------- ------------------------- ENAME_NAME (1) the AS of result set column (2) COLUMN= of an UPDATE ENAME_TAB DB.TABLE.NAME used to resolve names of subqueries ENAME_SPAN Text of the original result set expression. // unsigned eEName: 2, unsigned done: 1, unsigned reusable: 1, unsigned bSorterRef: 1, unsigned bNulls: 1 FpExpr uintptr FsortFlags U8 Fu struct{_ [0]uint32; Fx struct{FiOrderByCol U16; FiAlias U16}} FzEName uintptr
type Extentrecord = ([...]T)
DYLD needs to check if the object is allowed to be combined into the main binary. This is done between the code signature is loaded and dyld is doing all the work to process the LOAD commands. While this could be done in F_ADDFILESIGS.* family the hook into the MAC module doesn't say no when LV isn't enabled and then that is cached on the vnode, and the MAC module never gets change once a process that library validation enabled. Flv_error_message uintptr Flv_error_message_size fcntl.Size_t Flv_file_start fcntl.Off_t
* Information the user passes in to get the codeblobs out of the kernel F__padding int32 Ff_arch int32 Ff_cd_buffer uintptr Ff_cd_hash uintptr Ff_cd_size fcntl.Size_t Ff_hash_size fcntl.Size_t Ff_out_size uintptr
type Fd_mask = X__int32_t (basic type)
Ffds_bits [32]in.X__int32_t
Ffh_data [128]uint8 Ffh_len uint32
stdio state variables. The following always hold: if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), _lbfsize is -_bf._size, else _lbfsize is 0 if _flags&__SRD, _w is 0 if _flags&__SWR, _r is 0 This ensures that the getc and putc macros (or inline functions) never try to write or read from a file that is in `read' or `write' mode. (Moreover, they can, and do, automatically switch from read mode to write mode, and back, on "r+" and "w+" files.) _lbfsize is used only to make the inline line-buffered output stream code as compact as possible. _ub, _up, and _ur are used when ungetc() pushes back more characters than fit in the current _bf, or when ungetc() pushes back a character that does not match the previous one in _bf. When this happens, _ub._base becomes non-nil (i.e., a stream has ungetc() data iff _ub._base!=NULL) and _up and _ur save the current values of _p and _r. NB: see WARNING above before changing the layout of this structure! F_bf struct{F_base uintptr; F_size int32; _ [4]byte} F_blksize int32 F_close uintptr F_cookie uintptr F_extra uintptr F_file int16 F_flags int16 F_lb struct{F_base uintptr; F_size int32; _ [4]byte} F_lbfsize int32 F_nbuf [1]uint8 F_offset Fpos_t F_p uintptr F_r int32 F_read uintptr F_seek uintptr F_ub struct{F_base uintptr; F_size int32; _ [4]byte} F_ubuf [3]uint8 F_ur int32 F_w int32 F_write uintptr
FpNext uintptr FzChunk [8]U8
FpNext uintptr FzChunk [8]U8
FiOffset Sqlite3_int64 FpChunk uintptr
FiOffset Sqlite3_int64 FpChunk uintptr
type Filesec_property_t = uint32 (basic type)
type Filesec_t = uintptr (basic type)
An abstract type for a pointer to an IO method finder function:
type Fixpt_t = U_int32_t (basic type)
FaAction [2]U8 FaCol [1]struct{FiFrom int32; _ [4]byte; FzCol uintptr} FapTrigger [2]uintptr FisDeferred U8 FnCol int32 FpFrom uintptr FpNextFrom uintptr FpNextTo uintptr FpPrevTo uintptr FzTo uintptr
FaAction [2]U8 FaCol [1]struct{FiFrom int32; _ [4]byte; FzCol uintptr} FapTrigger [2]uintptr FisDeferred U8 FnCol int32 FpFrom uintptr FpNextFrom uintptr FpNextTo uintptr FpPrevTo uintptr FzTo uintptr
Define float_t and double_t per C standard, ISO/IEC 9899:2011 7.12 2, taking advantage of GCC's __FLT_EVAL_METHOD__ (which a compiler may define anytime and GCC does) that shadows FLT_EVAL_METHOD (which a compiler must define only in float.h).
type Fpos_t = X__darwin_off_t (basic type)
fpunchhole_t used by F_PUNCHHOLE Ffp_flags uint32 Ffp_length fcntl.Off_t Ffp_offset fcntl.Off_t Freserved uint32
FeType int32 FpExpr uintptr
type Fsblkcnt_t = X__darwin_fsblkcnt_t (basic type)
type Fsfilcnt_t = X__darwin_fsfilcnt_t (basic type)
type Fsfile_type_t = U_int32_t (basic type)
Copyright (c) 2014 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@ Copyright (c) 2012 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@ Fval [2]Int32_t
detached code signatures data type - information passed by user to system used by F_ADDSIGS and F_ADDFILESIGS. F_ADDFILESIGS is a shortcut for files that contain their own signature and doesn't require mapping of the file in order to load the signature. Ffs_blob_size fcntl.Size_t Ffs_blob_start uintptr Ffs_file_start fcntl.Off_t
Ffid_generation U_int32_t Ffid_objno U_int32_t
type Fsobj_tag_t = U_int32_t (basic type)
type Fsobj_type_t = U_int32_t (basic type)
fspecread_t used by F_SPECULATIVE_READ Ffsr_flags uint32 Ffsr_length fcntl.Off_t Ffsr_offset fcntl.Off_t Freserved uint32
type Fsvolid_t = U_int32_t (basic type)
factive_file_trim_t used by F_TRIM_ACTIVE_FILE Ffta_length fcntl.Off_t Ffta_offset fcntl.Off_t
************************************************************************ FTS5 EXTENSION REGISTRATION API FiVersion int32 FxCreateFunction uintptr FxCreateTokenizer uintptr FxFindTokenizer uintptr
type Fts5_extension_function = uintptr (basic type)
FxCreate uintptr FxDelete uintptr FxTokenize uintptr
FpAux uintptr FpNext uintptr FpPtr uintptr FxDelete uintptr
FpAux uintptr FpNext uintptr FpPtr uintptr FxDelete uintptr
The first time the bm25() function is called for a query, an instance of the following structure is allocated and populated. FaFreq uintptr FaIDF uintptr Favgdl float64 FnPhrase int32
The first time the bm25() function is called for a query, an instance of the following structure is allocated and populated. FaFreq uintptr FaIDF uintptr Favgdl float64 FnPhrase int32
Buffer object for the incremental building of string data. Fn int32 FnSpace int32 Fp uintptr
Buffer object for the incremental building of string data. Fn int32 FnSpace int32 Fp uintptr
FaiCol [1]int32 FnCol int32
FaiCol [1]int32 FnCol int32
FbTermEq U8 FiFirst U16
FbTermEq U8 FiFirst U16
Fnn int32 Fp uintptr FszLeaf int32
Fnn int32 Fp uintptr FszLeaf int32
FaLvl [1]Fts5DlidxLvl FiSegid int32 FnLvl int32
FaLvl [1]Fts5DlidxLvl FiSegid int32 FnLvl int32
FbEof int32 FiFirstOff int32 FiLeafPgno int32 FiOff int32 FiRowid I64 FpData uintptr
FbEof int32 FiFirstOff int32 FiLeafPgno int32 FiOff int32 FiRowid I64 FpData uintptr
FbPrevValid int32 Fbuf Fts5Buffer FiPrev I64 Fpgno int32
FbPrevValid int32 Fbuf Fts5Buffer FiPrev I64 Fpgno int32
FaEof uintptr FaPoslist uintptr FiRowid I64 FnPoslist int32 FnSize int32
FaEof uintptr FaPoslist uintptr FiRowid I64 FnPoslist int32 FnSize int32
FeVal int32 FzName uintptr
FeVal int32 FzName uintptr
************************************************************************* Interface to code in fts5_expr.c. FapExprPhrase uintptr FbDesc int32 FnPhrase int32 FpConfig uintptr FpIndex uintptr FpRoot uintptr
************************************************************************* Interface to code in fts5_expr.c. FapExprPhrase uintptr FbDesc int32 FnPhrase int32 FpConfig uintptr FpIndex uintptr FpRoot uintptr
FaPopulator uintptr FiOff I64 FpExpr uintptr
FaPopulator uintptr FiOff I64 FpExpr uintptr
FapPhrase [1]uintptr FnNear int32 FnPhrase int32 FpColset uintptr
FapPhrase [1]uintptr FnNear int32 FnPhrase int32 FpColset uintptr
FaTerm [1]Fts5ExprTerm FnTerm int32 FpNode uintptr Fposlist Fts5Buffer
FaTerm [1]Fts5ExprTerm FnTerm int32 FpNode uintptr Fposlist Fts5Buffer
FbFirst U8 FbPrefix U8 FpIter uintptr FpSynonym uintptr FzTerm uintptr
FbFirst U8 FbPrefix U8 FpIter uintptr FpSynonym uintptr FzTerm uintptr
FpIdx uintptr Fwriter Fts5SegWriter
FpIdx uintptr Fwriter Fts5SegWriter
Fp Fts5Table FpGlobal uintptr FpSortCsr uintptr FpStorage uintptr
Fp Fts5Table FpGlobal uintptr FpSortCsr uintptr FpStorage uintptr
Fapi Fts5_api Fdb uintptr FiNextId I64 FpAux uintptr FpCsr uintptr FpDfltTok uintptr FpTok uintptr
************************************************************************* Interface to code in fts5_hash.c. FaSlot uintptr FeDetail int32 FnEntry int32 FnSlot int32 FpScan uintptr FpnByte uintptr
************************************************************************* Interface to code in fts5_hash.c. FaSlot uintptr FeDetail int32 FnEntry int32 FnSlot int32 FpScan uintptr FpnByte uintptr
FbEof U8 FiRowid I64 FnData int32 FpData uintptr
FbEof U8 FiRowid I64 FnData int32 FpData uintptr
FiCol int32 FpStorage uintptr FszCol int32
FiCol int32 FpStorage uintptr FszCol int32
Context object used by sqlite3Fts5StorageIntegrity(). Fcksum U64 FiCol int32 FiRowid I64 FpConfig uintptr FpTermset uintptr FszCol int32
Context object used by sqlite3Fts5StorageIntegrity(). Fcksum U64 FiCol int32 FiRowid I64 FpConfig uintptr FpTermset uintptr FszCol int32
Fa uintptr Fi int32 FiLookahead I64 FiPos I64 Fn int32
Fa uintptr Fi int32 FiLookahead I64 FiPos I64 Fn int32
FnTerm int32 FpPoslist uintptr
FpOut uintptr Freader Fts5LookaheadReader Fwriter Fts5PoslistWriter
Fbuf Fts5Buffer FiPrevPgidx int32 Fpgidx Fts5Buffer Fpgno int32 Fterm Fts5Buffer
Fa uintptr Fb uintptr
Fa uintptr Fb uintptr
FbMiss int32 FbOk int32 Fwriter Fts5PoslistWriter
FbMiss int32 FbOk int32 Fwriter Fts5PoslistWriter
Fa uintptr FbEof U8 FbFlag U8 Fi int32 FiPos I64 Fn int32
Fa uintptr FbEof U8 FbFlag U8 Fi int32 FiPos I64 Fn int32
FiPrev I64
FiPrev I64
Context object passed to the fts5SentenceFinderCb() function. FaFirst uintptr FiPos int32 FnFirst int32 FnFirstAlloc int32 FzDoc uintptr
Context object passed to the fts5SentenceFinderCb() function. FaFirst uintptr FiPos int32 FnFirst int32 FnFirstAlloc int32 FzDoc uintptr
FaIdx [1]int32 FaPoslist uintptr FiRowid I64 FnIdx int32 FpStmt uintptr
FaIdx [1]int32 FaPoslist uintptr FiRowid I64 FnIdx int32 FpStmt uintptr
FaStmt [11]uintptr FaTotalSize uintptr FbTotalsValid int32 FnTotalRow I64 FpConfig uintptr FpIndex uintptr
FaLevel [1]Fts5StructureLevel FnLevel int32 FnRef int32 FnSegment int32 FnWriteCounter U64
FaSeg uintptr FnMerge int32 FnSeg int32
FaSeg uintptr FnMerge int32 FnSeg int32
FiSegid int32 FpgnoFirst int32 FpgnoLast int32
FiSegid int32 FpgnoFirst int32 FpgnoLast int32
Virtual-table object. Fbase Sqlite3_vtab FpConfig uintptr FpIndex uintptr
Virtual-table object. Fbase Sqlite3_vtab FpConfig uintptr FpIndex uintptr
Bucket of terms object used by the integrity-check in offsets=0 mode. FapHash [512]uintptr
Bucket of terms object used by the integrity-check in offsets=0 mode. FapHash [512]uintptr
************************************************************************ FiIdx int32 FnTerm int32 FpNext uintptr FpTerm uintptr
************************************************************************ FiIdx int32 FnTerm int32 FpNext uintptr FpTerm uintptr
Fn int32 Fp uintptr
Fn int32 Fp uintptr
NOTES ON TRANSACTIONS: SQLite invokes the following virtual table methods as transactions are opened and closed by the user: xBegin(): Start of a new transaction. xSync(): Initial part of two-phase commit. xCommit(): Final part of two-phase commit. xRollback(): Rollback the transaction. Anything that is required as part of a commit that may fail is performed in the xSync() callback. Current versions of SQLite ignore any errors returned by xCommit(). And as sub-transactions are opened/closed: xSavepoint(int S): Open savepoint S. xRelease(int S): Commit and close savepoint S. xRollbackTo(int S): Rollback to start of savepoint S. During a write-transaction the fts5_index.c module may cache some data in-memory. It is flushed to disk whenever xSync(), xRelease() or xSavepoint() is called. And discarded whenever xRollback() or xRollbackTo() is called. Additionally, if SQLITE_DEBUG is defined, an instance of the following structure is used to record the current transaction state. This information is not required, but it is used in the assert() statements executed by function fts5CheckTransactionState() (see below). FeState int32 FiSavepoint int32
The next sections is a series of control #defines. various aspects of the generated parser. fts5YYCODETYPE is the data type used to store the integer codes that represent terminal and non-terminal symbols. "unsigned char" is used if there are fewer than 256 symbols. Larger types otherwise. fts5YYNOCODE is a number of type fts5YYCODETYPE that is not used for any terminal or nonterminal symbol. fts5YYFALLBACK If defined, this indicates that one or more tokens (also known as: "terminal symbols") have fall-back values which should be used if the original symbol would not parse. This permits keywords to sometimes be used as identifiers, for example. fts5YYACTIONTYPE is the data type used for "action codes" - numbers that indicate what to do in response to the next token. sqlite3Fts5ParserFTS5TOKENTYPE is the data type used for minor type for terminal symbols. Background: A "minor type" is a semantic value associated with a terminal or non-terminal symbols. For example, for an "ID" terminal symbol, the minor type might be the name of the identifier. Each non-terminal can have a different minor type. Terminal symbols all have the same minor type, though. This macros defines the minor type for terminal symbols. fts5YYMINORTYPE is the data type used for all minor types. This is typically a union of many types, one of which is sqlite3Fts5ParserFTS5TOKENTYPE. The entry in the union for terminal symbols is called "fts5yy0". fts5YYSTACKDEPTH is the maximum depth of the parser's stack. If zero the stack is dynamically sized using realloc() sqlite3Fts5ParserARG_SDECL A static variable declaration for the %extra_argument sqlite3Fts5ParserARG_PDECL A parameter declaration for the %extra_argument sqlite3Fts5ParserARG_PARAM Code to pass %extra_argument as a subroutine parameter sqlite3Fts5ParserARG_STORE Code to store %extra_argument into fts5yypParser sqlite3Fts5ParserARG_FETCH Code to extract %extra_argument from fts5yypParser sqlite3Fts5ParserCTX_* As sqlite3Fts5ParserARG_ except for %extra_context fts5YYERRORSYMBOL is the code number of the error symbol. If not defined, then do no error processing. fts5YYNSTATE the combined number of states. fts5YYNRULE the number of rules in the grammar fts5YYNFTS5TOKEN Number of terminal symbols fts5YY_MAX_SHIFT Maximum value for shift actions fts5YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions fts5YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions fts5YY_ERROR_ACTION The fts5yy_action[] code for syntax error fts5YY_ACCEPT_ACTION The fts5yy_action[] code for accept fts5YY_NO_ACTION The fts5yy_action[] code for no-op fts5YY_MIN_REDUCE Minimum value for reduce actions fts5YY_MAX_REDUCE Maximum value for reduce actions ************ Begin control #defines **************************************** Ffts5yyinit int32
Fmajor uint8 Fminor Fts5YYMINORTYPE Fstateno uint8
Fa [23]uintptr
Fa [23]uintptr
FnRef int32 FpUserData uintptr FxDestroy uintptr
FnRef int32 FpUserData uintptr FxDestroy uintptr
State vector for the geopoly_group_bbox() aggregate function. Fa [4]RtreeCoord FisInit int32
State vector for the geopoly_group_bbox() aggregate function. Fa [4]RtreeCoord FisInit int32
Datatype for coordinates
Objects used by the overlap algorihm. FeType int32 FpNext uintptr FpSeg uintptr Fx float64
Objects used by the overlap algorihm. FeType int32 FpNext uintptr FpSeg uintptr Fx float64
FaEvent uintptr FaSegment uintptr FnEvent int32 FnSegment int32
FaEvent uintptr FaSegment uintptr FnEvent int32 FnSegment int32
State of a parse of a GeoJSON input. Fa uintptr FnAlloc int32 FnErr int32 FnVertex int32 Fz uintptr
State of a parse of a GeoJSON input. Fa uintptr FnAlloc int32 FnErr int32 FnVertex int32 Fz uintptr
Internal representation of a polygon. The polygon consists of a sequence of vertexes. There is a line segment between each pair of vertexes, and one final segment from the last vertex back to the first. (This differs from the GeoJSON standard in which the final vertex is a repeat of the first.) The polygon follows the right-hand rule. The area to the right of each segment is "outside" and the area to the left is "inside". The on-disk representation consists of a 4-byte header followed by the values. The 4-byte header is: encoding (1 byte) 0=big-endian, 1=little-endian nvertex (3 bytes) Number of vertexes as a big-endian integer Enough space is allocated for 4 coordinates, to work around over-zealous warnings coming from some compiler (notably, clang). In reality, the size of each GeoPoly memory allocate is adjusted as necessary so that the GeoPoly.a[] array at the end is the appropriate size. Fa [8]GeoCoord Fhdr [4]uint8 FnVertex int32
Internal representation of a polygon. The polygon consists of a sequence of vertexes. There is a line segment between each pair of vertexes, and one final segment from the last vertex back to the first. (This differs from the GeoJSON standard in which the final vertex is a repeat of the first.) The polygon follows the right-hand rule. The area to the right of each segment is "outside" and the area to the left is "inside". The on-disk representation consists of a 4-byte header followed by the values. The 4-byte header is: encoding (1 byte) 0=big-endian, 1=little-endian nvertex (3 bytes) Number of vertexes as a big-endian integer Enough space is allocated for 4 coordinates, to work around over-zealous warnings coming from some compiler (notably, clang). In reality, the size of each GeoPoly memory allocate is adjusted as necessary so that the GeoPoly.a[] array at the end is the appropriate size. Fa [8]GeoCoord Fhdr [4]uint8 FnVertex int32
FB float64 FC float64 Fidx uint32 FpNext uintptr Fside uint8 Fy float64 Fy0 float32
FB float64 FC float64 Fidx uint32 FpNext uintptr Fside uint8 Fy float64 Fy0 float32
type Gid_t = X__darwin_gid_t (basic type)
Forward declarations of structures. Fcount uint32 Ffirst uintptr Fht uintptr Fhtsize uint32
Forward declarations of structures. Fcount uint32 Ffirst uintptr Fht uintptr Fhtsize uint32
Fdata uintptr Fnext uintptr FpKey uintptr Fprev uintptr
Fdata uintptr Fnext uintptr FpKey uintptr Fprev uintptr
Extra information appended to the end of sqlite3_index_info but not visible to the xBestIndex function, at least not directly. The sqlite3_vtab_collation() interface knows how to reach it, however. This object is not an API and can be changed from one release to the next. As long as allocateIndexInfo() and sqlite3_vtab_collation() agree on the structure, all will be well. FpParse uintptr FpWC uintptr
Extra information appended to the end of sqlite3_index_info but not visible to the xBestIndex function, at least not directly. The sqlite3_vtab_collation() interface knows how to reach it, however. This object is not an API and can be changed from one release to the next. As long as allocateIndexInfo() and sqlite3_vtab_collation() agree on the structure, all will be well. FpParse uintptr FpWC uintptr
************************************************************************ Start of highlight() implementation. FiOff int32 FiPos int32 FiRangeEnd int32 FiRangeStart int32 Fiter CInstIter FnIn int32 FzClose uintptr FzIn uintptr FzOpen uintptr FzOut uintptr
************************************************************************ Start of highlight() implementation. FiOff int32 FiPos int32 FiRangeEnd int32 FiRangeStart int32 Fiter CInstIter FnIn int32 FzClose uintptr FzIn uintptr FzOpen uintptr FzOut uintptr
Each page of the wal-index mapping contains a hash-table made up of an array of HASHTABLE_NSLOT elements of the following type.
type I16 = int16 (basic type)
Integers of known sizes. These typedefs might change for architectures where the sizes very. Preprocessor macros are available so that the types can be conveniently redefined at compile-type. Like this: cc '-DUINTPTR_TYPE=long long int' ...
type I8 = int8 (basic type)
type Id_t = X__darwin_id_t (basic type)
Fa uintptr FnId int32
Fa uintptr FnId int32
An instance of this structure can hold a simple list of identifiers, such as the list "a,b,c" in the following statements: INSERT INTO t(a,b,c) VALUES ...; CREATE INDEX idx ON t(a,b,c); CREATE TRIGGER trig BEFORE UPDATE ON t(a,b,c) ...; The IdList.a.idx field is used when the IdList represents the list of column names after a table name in an INSERT statement. In the statement INSERT INTO t(a,b,c) ... If "a" is the k-th column of table "t", then IdList.a[0].idx==k. Fidx int32 FzName uintptr
[XSI] The type idtype_t shall be defined as an enumeration type whose possible values shall include at least P_ALL, P_PID, and P_PGID.
Context pointer passed down through the tree-walk. FiCur int32 FpIdx uintptr
An instance of the IdxExprTrans object carries information about a mapping from an expression on table columns into a column in an index down through the Walker. Fdb uintptr FiIdxCol int32 FiIdxCur int32 FiTabCol int32 FiTabCur int32 FpIdxExpr uintptr FpWInfo uintptr
Context pointer passed down through the tree-walk. Fdb uintptr FiIdxCol int32 FiIdxCur int32 FiTabCol int32 FiTabCur int32 FpIdxExpr uintptr FpWInfo uintptr
Copyright (c) 2003-2012 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@ Copyright (c) 2000-2007 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@ Copyright 1995 NeXT Computer, Inc. All rights reserved.
Copyright (c) 2003-2012 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@ Copyright (c) 2000-2007 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@ Copyright 1995 NeXT Computer, Inc. All rights reserved.
Valid sqlite3_blob* handles point to Incrblob structures. Fdb uintptr FiCol U16 FiOffset int32 FnByte int32 FpCsr uintptr FpStmt uintptr FpTab uintptr FzDb uintptr
Valid sqlite3_blob* handles point to Incrblob structures. Fdb uintptr FiCol U16 FiOffset int32 FnByte int32 FpCsr uintptr FpStmt uintptr FpTab uintptr FzDb uintptr
In-memory list of records FaFile [2]SorterFile FbEof int32 FbUseThread int32 FiStartOff I64 FmxSz int32 FpMerger uintptr FpTask uintptr
FaFile [2]SorterFile FbEof int32 FbUseThread int32 FiStartOff I64 FmxSz int32 FpMerger uintptr FpTask uintptr
FaAvgEq uintptr FaColExpr uintptr FaSample uintptr FaSortOrder uintptr FaiColumn uintptr FaiRowEst uintptr FaiRowLogEst uintptr FazColl uintptr FcolNotIdxed Bitmask // unsigned idxType: 2, unsigned bUnordered: 1, unsigned uniqNotNull: 1, unsigned isResized: 1, unsigned isCovering: 1, unsigned noSkipScan: 1, unsigned hasStat1: 1, unsigned bNoQuery: 1, unsigned bAscKeyBug: 1, unsigned bHasVCol: 1 FnColumn U16 FnKeyCol U16 FnRowEst0 TRowcnt FnSample int32 FnSampleCol int32 FonError U8 FpNext uintptr FpPartIdxWhere uintptr FpSchema uintptr FpTable uintptr FszIdxRow LogEst Ftnum Pgno FzColAff uintptr FzName uintptr
FaAvgEq uintptr FaColExpr uintptr FaSample uintptr FaSortOrder uintptr FaiColumn uintptr FaiRowEst uintptr FaiRowLogEst uintptr FazColl uintptr FcolNotIdxed Bitmask // unsigned idxType: 2, unsigned bUnordered: 1, unsigned uniqNotNull: 1, unsigned isResized: 1, unsigned isCovering: 1, unsigned noSkipScan: 1, unsigned hasStat1: 1, unsigned bNoQuery: 1, unsigned bAscKeyBug: 1, unsigned bHasVCol: 1 FnColumn U16 FnKeyCol U16 FnRowEst0 TRowcnt FnSample int32 FnSampleCol int32 FonError U8 FpNext uintptr FpPartIdxWhere uintptr FpSchema uintptr FpTable uintptr FszIdxRow LogEst Ftnum Pgno FzColAff uintptr FzName uintptr
FeType int32 Fi int32 Fu struct{Flx struct{FpIdx uintptr}; _ [8]byte}
FeType int32 Fi int32 Fu struct{Flx struct{FpIdx uintptr}; _ [8]byte}
The sqlite3GenerateConstraintChecks() routine usually wants to visit the indexes of a table in the order provided in the Table->pIndex list. However, sometimes (rarely - when there is an upsert) it wants to visit the indexes in a different order. The following data structures accomplish this. The IndexIterator object is used to walk through all of the indexes of a table in either Index.pNext order, or in some other order established by an array of IndexListTerm objects. Fix int32 Fp uintptr
The sqlite3GenerateConstraintChecks() routine usually wants to visit the indexes of a table in the order provided in the Table->pIndex list. However, sometimes (rarely - when there is an upsert) it wants to visit the indexes in a different order. The following data structures accomplish this. The IndexIterator object is used to walk through all of the indexes of a table in either Index.pNext order, or in some other order established by an array of IndexListTerm objects. Fix int32 Fp uintptr
FanDLt uintptr FanEq uintptr FanLt uintptr Fn int32 Fp uintptr
FanDLt uintptr FanEq uintptr FanLt uintptr Fn int32 Fp uintptr
A pointer to this structure is used to communicate information from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback. Fdb uintptr FiDb int32 FmInitFlags U32 FmxPage Pgno FnInitRow U32 FpzErrMsg uintptr Frc int32
This object contains information needed to implement a single nested loop in WHERE clause. Contrast this object with WhereLoop. This object describes the implementation of the loop. WhereLoop describes the algorithm. This object contains a pointer to the WhereLoop algorithm as one of its elements. The WhereInfo object contains a single instance of this object for each term in the FROM clause (which is to say, for each of the nested loops as implemented). The order of WhereLevel objects determines the loop nested order, with WhereInfo.a[0] being the outer loop and WhereInfo.a[WhereInfo.nLevel-1] being the inner loop. FaddrInTop int32 FeEndLoopOp U8 FiBase int32 FiCur int32 FnPrefix int32
type Ino64_t = X__darwin_ino64_t (basic type)
type Ino_t = X__darwin_ino_t (basic type)
Copyright (c) 2012 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@
Copyright (c) 2012 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@
Copyright (c) 2012 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@
Basic integral types. Omit the typedef if not possible for a machine/compiler combination. Copyright (c) 2012 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@
type Int_fast16_t = Int16_t (basic type)
type Int_fast32_t = Int32_t (basic type)
type Int_fast64_t = Int64_t (basic type)
7.18.1.3 Fastest-width integer types
type Int_least16_t = Int16_t (basic type)
type Int_least32_t = Int32_t (basic type)
type Int_least64_t = Int64_t (basic type)
7.18.1.2 Minimum-width integer types
type Integer_t = int32 (basic type)
This structure is passed around through all the sanity checking routines in order to keep track of some global state information. The aRef[] array is allocated so that there is 1 bit for each page in the database. As the integrity-check proceeds, for each page used in the database the corresponding bit is set. This allows integrity-check to detect pages that are used twice and orphaned pages (both of which indicate corruption). FaPgRef uintptr FbOomFault int32 Fdb uintptr FerrMsg StrAccum Fheap uintptr FmxErr int32 FnErr int32 FnPage Pgno FpBt uintptr FpPager uintptr Fv1 Pgno Fv2 int32 FzPfx uintptr
This structure is passed around through all the sanity checking routines in order to keep track of some global state information. The aRef[] array is allocated so that there is 1 bit for each page in the database. As the integrity-check proceeds, for each page used in the database the corresponding bit is set. This allows integrity-check to detect pages that are used twice and orphaned pages (both of which indicate corruption). FaPgRef uintptr FbOomFault int32 Fdb uintptr FerrMsg StrAccum Fheap uintptr FmxErr int32 FnErr int32 FnPage Pgno FpBt uintptr FpPager uintptr Fv1 Pgno Fv2 int32 FzPfx uintptr
type Intmax_t = int64 (basic type)
type Intptr_t = X__darwin_intptr_t (basic type)
*************************************************************************** The json_each virtual table FbRecursive U8 Fbase Sqlite3_vtab_cursor FeType U8 Fi U32 FiBegin U32 FiEnd U32 FiRowid U32 FsParse JsonParse FzJson uintptr FzRoot uintptr
*************************************************************************** The json_each virtual table FbRecursive U8 Fbase Sqlite3_vtab_cursor FeType U8 Fi U32 FiBegin U32 FiEnd U32 FiRowid U32 FsParse JsonParse FzJson uintptr FzRoot uintptr
FeType U8 FjnFlags U8 Fn U32 Fu struct{FzJContent uintptr}
FeType U8 FjnFlags U8 Fn U32 Fu struct{FzJContent uintptr}
FaNode uintptr FaUp uintptr FiDepth U16 FiHold U32 FnAlloc U32 FnErr U8 FnJson int32 FnNode U32 Foom U8 FzJson uintptr
Objects FbErr U8 FbStatic U8 FnAlloc U64 FnUsed U64 FpCtx uintptr FzBuf uintptr FzSpace [100]int8
Objects FbErr U8 FbStatic U8 FnAlloc U64 FnUsed U64 FpCtx uintptr FzBuf uintptr FzSpace [100]int8
type Kauth_cred_t = uintptr (basic type)
Copyright (c) 2003-2012 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@ Copyright (c) 2000-2007 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@ Copyright 1995 NeXT Computer, Inc. All rights reserved.
FaColl [1]uintptr FaSortFlags uintptr Fdb uintptr Fenc U8 FnAllField U16 FnKeyField U16 FnRef U32
FaColl [1]uintptr FaSortFlags uintptr Fdb uintptr Fenc U8 FnAllField U16 FnKeyField U16 FnRef U32
Context object for last_value() window function. FnVal int32 FpVal uintptr
Fquot int64 Frem int64
Fquot int64 Frem int64
Estimated quantities used for query planning are stored as 16-bit logarithms. For quantity X, the value stored is 10*log2(X). This gives a possible range of values of approximately 1.0e986 to 1e-986. But the allowed values are "grainy". Not every value is representable. For example, quantities 16 and 17 are both represented by a LogEst of 40. However, since LogEst quantities are suppose to be estimates, not exact values, this imprecision is not a problem. "LogEst" is short for "Logarithmic Estimate". Examples: 1 -> 0 20 -> 43 10000 -> 132 2 -> 10 25 -> 46 25000 -> 146 3 -> 16 100 -> 66 1000000 -> 199 4 -> 20 1000 -> 99 1048576 -> 200 10 -> 33 1024 -> 100 4294967296 -> 320 The LogEst can be negative to indicate fractional values. Examples: 0.5 -> -10 0.1 -> -33 0.0625 -> -40
FpNext uintptr
FpNext uintptr
type Mach_port_array_t = uintptr (basic type)
type Mach_port_delta_t = Integer_t (basic type)
Flavors for mach_port_get/set_attributes()
type Mach_port_info_t = uintptr (basic type)
Fmpl_qlimit Mach_port_msgcount_t
type Mach_port_mscount_t = Natural_t (basic type)
type Mach_port_msgcount_t = Natural_t (basic type)
type Mach_port_name_array_t = uintptr (basic type)
type Mach_port_name_t = Natural_t (basic type)
type Mach_port_options_ptr_t = uintptr (basic type)
Flags for mach_port_options (used for invocation of mach_port_construct). Indicates attributes to be set for the newly allocated port. Structure to define optional attributes for a newly constructed port. Fflags Uint32_t Fmpl Mach_port_limits_t Freserved [2]Uint64_t
Structure used to pass information about port allocation requests. Must be padded to 64-bits total length. Flen Natural_t // unsigned name: 1, unsigned prealloc: 1, boolean_t pad1: 30
type Mach_port_right_t = Natural_t (basic type)
type Mach_port_rights_t = Natural_t (basic type)
type Mach_port_seqno_t = Natural_t (basic type)
Are there outstanding send rights for a given port?
type Mach_port_t = X__darwin_mach_port_t (basic type)
type Mach_port_type_array_t = uintptr (basic type)
type Mach_port_type_t = Natural_t (basic type)
type Mach_port_urefs_t = Natural_t (basic type)
This new type is independent of a particular vm map's implementation size - and represents appropriate types for all possible maps. This is used for interfaces where the size of the map is not known - or we don't want to have to distinguish.
type Mach_vm_offset_t = Uint64_t (basic type)
type Mach_vm_size_t = Uint64_t (basic type)
FpMethods uintptr FzFilesystem uintptr
Type whose alignment is supported in every context and is at least as great as that of any standard type not using alignment specifiers. F__max_align_ld float64 F__max_align_ll int64
type Mcontext_t = uintptr (basic type)
The names of the following types declared in vdbeInt.h are required for the VdbeOp definition. Fdb uintptr FeSubtype U8 Fenc U8 Fflags U16 Fn int32 FszMalloc int32 Fu struct{Fr float64} FuTemp U32 FxDel uintptr Fz uintptr FzMalloc uintptr
State information local to the memory allocation subsystem. FalarmThreshold Sqlite3_int64 FhardLimit Sqlite3_int64 Fmutex uintptr FnearlyFull int32
Fbase Sqlite3_file FeLock int32 FpStore uintptr
Fbase Sqlite3_file FeLock int32 FpStore uintptr
File-scope variables for holding the memdb files that are accessible to multiple database connections in separate threads. Must hold SQLITE_MUTEX_STATIC_VFS1 to access any part of this object. FapMemStore uintptr FnMemStore int32
Forward references to internal structures Fendpoint FilePoint Fflags int32 FnChunkSize int32 FnSpill int32 FpFirst uintptr FpMethod uintptr FpVfs uintptr Freadpoint FilePoint FzJournal uintptr
Forward references to internal structures Fendpoint FilePoint Fflags int32 FnChunkSize int32 FnSpill int32 FpFirst uintptr FpMethod uintptr FpVfs uintptr Freadpoint FilePoint FzJournal uintptr
Internally, the vdbe manipulates nearly all SQL values as Mem structures. Each Mem struct may cache multiple representations (string, integer etc.) of the same value. Fr float64
Private objects used by the sorter FaReadr uintptr FaTree uintptr FnTree int32 FpTask uintptr
Private objects used by the sorter FaReadr uintptr FaTree uintptr FnTree int32 FpTask uintptr
type Mode_t = X__darwin_mode_t (basic type)
FnRefModule int32 FpAux uintptr FpEpoTab uintptr FpModule uintptr FxDestroy uintptr FzName uintptr
type Mount_t = uintptr (basic type)
FnNcErr int32 FnRef int32 FncFlags int32 FpNext uintptr FpParse uintptr FpSrcList uintptr FpWinSelect uintptr FuNC struct{FpEList uintptr}
natural_t and integer_t are Mach's legacy types for machine- independent integer types (unsigned, and signed, respectively). Their original purpose was to define other types in a machine/ compiler independent way. They also had an implicit "same size as pointer" characteristic to them (i.e. Mach's traditional types are very ILP32 or ILP64 centric). We support x86 ABIs that do not follow either of these models (specifically LP64). Therefore, we had to make a choice between making these types scale with pointers or stay tied to integers. Because their use is predominantly tied to to the size of an integer, we are keeping that association and breaking free from pointer size guarantees. New use of these types is discouraged.
Implementation of built-in window function nth_value(). This implementation is used in "slow mode" only - when the EXCLUDE clause is not set to the default value "NO OTHERS". FnStep I64 FpValue uintptr
Context object for ntile() window function. FiRow I64 FnParam I64 FnTotal I64
type Off_t = X__darwin_off_t (basic type)
SQL is translated into a sequence of instructions to be executed by a virtual machine. Each instruction is an instance of the following structure. Fopcode U8 Fp1 int32 Fp2 int32 Fp3 int32 Fp4 struct{_ [0]uint64; Fi int32; _ [4]byte} Fp4type int8 Fp5 U16
FeOp2 uint8 FzOp uintptr
Fmode int32 Fz uintptr
type Os_function_t = uintptr (basic type)
An instance of the following structure is allocated for each active savepoint and statement transaction in the system. All such structures are stored in the Pager.aSavepoint[] array, which is allocated and resized using sqlite3Realloc(). When a savepoint is created, the PagerSavepoint.iHdrOffset field is set to 0. If a journal-header is written into the main journal while the savepoint is active, then iHdrOffset is set to the byte offset immediately following the last journal record written into the main journal before the journal-header. This is required during savepoint rollback (see pagerPlaybackSavepoint()). FaWalData [4]U32 FbTruncateOnRelease int32 FiHdrOffset I64 FiOffset I64 FiSubRec Pgno FnOrig Pgno FpInSavepoint uintptr
An instance of the following structure is allocated for each active savepoint and statement transaction in the system. All such structures are stored in the Pager.aSavepoint[] array, which is allocated and resized using sqlite3Realloc(). When a savepoint is created, the PagerSavepoint.iHdrOffset field is set to 0. If a journal-header is written into the main journal while the savepoint is active, then iHdrOffset is set to the byte offset immediately following the last journal record written into the main journal before the journal-header. This is required during savepoint rollback (see pagerPlaybackSavepoint()). FaWalData [4]U32 FbTruncateOnRelease int32 FiHdrOffset I64 FiOffset I64 FiSubRec Pgno FnOrig Pgno FpInSavepoint uintptr
FpNext uintptr FpPtr uintptr FxCleanup uintptr
FpNext uintptr FpPtr uintptr FxCleanup uintptr
FpNext uintptr
FpNext uintptr
The type used to represent a page number. The first page in a file is called page 1. 0 is used to represent "not a page".
Flru PgHdr1 Fmutex uintptr FmxPinned uint32 FnMaxPage uint32 FnMinPage uint32 FnPurgeable uint32
Flru PgHdr1 Fmutex uintptr FmxPinned uint32 FnMaxPage uint32 FnMinPage uint32 FnPurgeable uint32
type Pid_t = X__darwin_pid_t (basic type)
Incrementally read one PMA FaBuffer uintptr FeFWErr int32 FiBufEnd int32 FiBufStart int32 FiWriteOff I64 FnBuffer int32 FpFd uintptr
FaBuf uintptr FpCtx uintptr FxToken uintptr
FaBuf uintptr FpCtx uintptr FxToken uintptr
FnOutput int32 FnSuffix int32 FxCond uintptr FzOutput uintptr FzSuffix uintptr
FnOutput int32 FnSuffix int32 FxCond uintptr FzOutput uintptr FzSuffix uintptr
FaBuf [128]int8 FpTokenizer uintptr Ftokenizer Fts5_tokenizer
FaBuf [128]int8 FpTokenizer uintptr Ftokenizer Fts5_tokenizer
type Posix_cred_t = uintptr (basic type)
FeState int32 FpBuf uintptr FpColset uintptr
FeState int32 FpBuf uintptr FpColset uintptr
FiRead int32 FiWrite int32 FpBuf uintptr FpColset uintptr
FiRead int32 FiWrite int32 FpBuf uintptr FpColset uintptr
Definitions of all built-in pragmas FePragTyp U8 FiArg U64 FiPragCName U8 FmPragFlg U8 FnPragCName U8 FzName uintptr
Definitions of all built-in pragmas FePragTyp U8 FiArg U64 FiPragCName U8 FmPragFlg U8 FnPragCName U8 FzName uintptr
**************************************************************************** Implementation of an eponymous virtual table that runs a pragma. Fbase Sqlite3_vtab Fdb uintptr FiHidden U8 FnHidden U8 FpName uintptr
**************************************************************************** Implementation of an eponymous virtual table that runs a pragma. Fbase Sqlite3_vtab Fdb uintptr FiHidden U8 FnHidden U8 FpName uintptr
FazArg [2]uintptr Fbase Sqlite3_vtab_cursor FiRowid Sqlite_int64 FpPragma uintptr
FaPos uintptr FiOff int32 FiPos I64 Fiter Fts5DoclistIter FpNext uintptr
FaPos uintptr FiOff int32 FiPos I64 Fiter Fts5DoclistIter FpNext uintptr
FapArg uintptr FnArg int32 FnUsed int32
FapArg uintptr FnArg int32 FnUsed int32
The proxyLockingContext has the path and file structures for the remote and local proxy files in it FconchFile uintptr FconchFilePath uintptr FconchHeld int32 FdbPath uintptr FlockProxy uintptr FlockProxyPath uintptr FnFails int32 FoldLockingContext uintptr FpOldMethod uintptr
F__opaque [56]int8 F__sig int64
F__opaque [40]int8 F__sig int64
F__opaque [8]int8 F__sig int64
F__opaque [56]int8 F__sig int64
F__opaque [8]int8 F__sig int64
F__opaque [8]int8 F__sig int64
F__opaque [192]int8 F__sig int64
F__opaque [16]int8 F__sig int64
type Pthread_t = X__darwin_pthread_t (basic type)
type Ptrdiff_t = int64 (basic type)
type Qaddr_t = uintptr (basic type)
type Quad_t = Int64_t (basic type)
FiDbPage U32 FiWalFrame U32
FiDbPage U32 FiWalFrame U32
FnSpan int32 FzSpan uintptr
FnSpan int32 FzSpan uintptr
FpNext uintptr FpUpdate uintptr FzMask uintptr
FpNext uintptr FpUpdate uintptr FzMask uintptr
type RecordCompare = uintptr (basic type)
type Register_t = Int64_t (basic type)
The context of an ALTER TABLE RENAME COLUMN operation that gets passed down into the Walker. FiCol int32 FnList int32 FpList uintptr FpTab uintptr FzOld uintptr
Context pointer passed down through the tree-walk. FiCol int32 FnList int32 FpList uintptr FpTab uintptr FzOld uintptr
Fp uintptr FpNext uintptr Ft Token
Fp uintptr FpNext uintptr Ft Token
An instance of this object describes bulk memory available for use by subcomponents of a prepared statement. Space is allocated out of a ReusableSpace object by the allocSpace() routine below. FnFree Sqlite3_int64 FnNeeded Sqlite3_int64 FpSpace uintptr
Resource limit type (low 63 bits, excluding the sign bit)
An instance of this object holds information (beyond pParse and pSelect) needed to load the next result row that is to be added to the sorter. FecelFlags U8 FregResult int32
FecelFlags U8 FregResult int32
RowSetEntry objects are allocated in large chunks (instances of the following structure) to reduce memory allocation overhead. The chunks are kept on a linked list so that they can be deallocated when the RowSet is destroyed. FaEntry [42]struct{Fv I64; FpRight uintptr; FpLeft uintptr} FpNextChunk uintptr
Each entry in a RowSet is an instance of the following object. This same object is reused to store a linked list of trees of RowSetEntry objects. In that alternative use, pRight points to the next entry in the list, pLeft points to the tree, and v is unused. The RowSet.pForest value points to the head of this forest list. FpLeft uintptr FpRight uintptr Fv I64
Copyright (c) 2003-2012 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@ Copyright (c) 2000-2007 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@ Copyright 1995 NeXT Computer, Inc. All rights reserved.
FaCoord [10]RtreeCoord FiRowid I64
FaCoord [10]RtreeCoord FiRowid I64
Context object passed between the various routines that make up the implementation of integrity-check function rtreecheck(). FaCheckMapping [2]uintptr FbInt int32 Fdb uintptr FnDim int32 FnErr int32 FnLeaf int32 FnNonLeaf int32 FpGetNode uintptr Frc int32 FzDb uintptr FzReport uintptr FzTab uintptr
Context object passed between the various routines that make up the implementation of integrity-check function rtreecheck(). FaCheckMapping [2]uintptr FbInt int32 Fdb uintptr FnDim int32 FnErr int32 FnLeaf int32 FnNonLeaf int32 FpGetNode uintptr Frc int32 FzDb uintptr FzReport uintptr FzTab uintptr
FiCoord int32 Fop int32 FpInfo uintptr Fu struct{FrValue RtreeDValue}
FiCoord int32 Fop int32 FpInfo uintptr Fu struct{FrValue RtreeDValue}
Ff RtreeValue
Ff RtreeValue
If SQLITE_RTREE_INT_ONLY is defined, then this virtual table will only deal with integer coordinates. No floating point operations will be done.
FpContext uintptr FxDestructor uintptr FxGeom uintptr FxQueryFunc uintptr
FaParam [1]RtreeDValue FapSqlParam uintptr Fcb RtreeGeomCallback FiSize U32 FnParam int32
FiNode I64 FisDirty int32 FnRef int32 FpNext uintptr FpParent uintptr FzData uintptr
FiNode I64 FisDirty int32 FnRef int32 FpNext uintptr FpParent uintptr FzData uintptr
FeWithin U8 FiCell U8 FiLevel U8 Fid Sqlite3_int64 FrScore RtreeDValue
FeWithin U8 FiCell U8 FiLevel U8 Fid Sqlite3_int64 FrScore RtreeDValue
type RtreeValue = float32 (basic type)
Copyright (c) 2012 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@ Copyright (c) 2003-2007 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@
type Rusage_info_t = uintptr (basic type)
FnDeferredCons I64 FnDeferredImmCons I64 FpNext uintptr FzName uintptr
FnDeferredCons I64 FnDeferredImmCons I64 FpNext uintptr FzName uintptr
The ScanStatus object holds a single value for the sqlite3_stmt_scanstatus() interface. FaddrExplain int32 FaddrLoop int32 FaddrVisit int32 FiSelectID int32 FnEst LogEst FzName uintptr
The ScanStatus object holds a single value for the sqlite3_stmt_scanstatus() interface. FaddrExplain int32 FaddrLoop int32 FaddrVisit int32 FiSelectID int32 FnEst LogEst FzName uintptr
type Segsz_t = Int32_t (basic type)
FeDest U8 FiSDParm int32 FiSDParm2 int32 FiSdst int32 FnSdst int32 FpOrderBy uintptr FzAffSdst uintptr
type Sig_atomic_t = int32 (basic type)
type Sig_t = uintptr (basic type)
F__pad [7]uint64 Fsi_addr uintptr Fsi_band int64 Fsi_code int32 Fsi_errno int32 Fsi_pid Pid_t Fsi_signo int32 Fsi_status int32 Fsi_uid Uid_t Fsi_value struct{_ [0]uint64; Fsival_int int32; _ [4]byte}
type Sigset_t = X__darwin_sigset_t (basic type)
type Size_t = uint64 (basic type)
An instance of the following object is used to record information about the ORDER BY (or GROUP BY) clause of query is being coded. The aDefer[] array is used by the sorter-references optimization. For example, assuming there is no index that can be used for the ORDER BY, for the query: SELECT a, bigblob FROM t1 ORDER BY a LIMIT 10; it may be more efficient to add just the "a" values to the sorter, and retrieve the associated "bigblob" values directly from table t1 as the 10 smallest "a" values are extracted from the sorter. When the sorter-reference optimization is used, there is one entry in the aDefer[] array for each database table that may be read as values are extracted from the sorter. FaddrSortIndex int32 FiECursor int32 FlabelBkOut int32 FlabelDone int32 FlabelOBLopt int32 FnOBSat int32 FpDeferredRowLoad uintptr FpOrderBy uintptr FregReturn int32 FsortFlags U8
An instance of the following object is used to record information about the ORDER BY (or GROUP BY) clause of query is being coded. The aDefer[] array is used by the sorter-references optimization. For example, assuming there is no index that can be used for the ORDER BY, for the query: SELECT a, bigblob FROM t1 ORDER BY a LIMIT 10; it may be more efficient to add just the "a" values to the sorter, and retrieve the associated "bigblob" values directly from table t1 as the 10 smallest "a" values are extracted from the sorter. When the sorter-reference optimization is used, there is one entry in the aDefer[] array for each database table that may be read as values are extracted from the sorter. FaddrSortIndex int32 FiECursor int32 FlabelBkOut int32 FlabelDone int32 FlabelOBLopt int32 FnOBSat int32 FpDeferredRowLoad uintptr FpOrderBy uintptr FregReturn int32 FsortFlags U8
This object represents a single thread of control in a sort operation. Exactly VdbeSorter.nTask instances of this object are allocated as part of each VdbeSorter object. Instances are never allocated any other way. VdbeSorter.nTask is set to the number of worker threads allowed (see SQLITE_CONFIG_WORKER_THREADS) plus one (the main thread). Thus for single-threaded operation, there is exactly one instance of this object and for multi-threaded operation there are two or more instances. Essentially, this structure contains all those fields of the VdbeSorter structure for which each thread requires a separate instance. For example, each thread requries its own UnpackedRecord object to unpack records in as part of comparison operations. Before a background thread is launched, variable bDone is set to 0. Then, right before it exits, the thread itself sets bDone to 1. This is used for two purposes: 1. When flushing the contents of memory to a level-0 PMA on disk, to attempt to select a SortSubtask for which there is not already an active background thread (since doing so causes the main thread to block until it finishes). 2. If SQLITE_DEBUG_SORTER_THREADS is defined, to determine if a call to sqlite3ThreadJoin() is likely to block. Cases that are likely to block provoke debugging output. In both cases, the effects of the main thread seeing (bDone==0) even after the thread has finished are not dire. So we don't worry about memory barriers and such here.
A sub-task in the sort process FiEof I64 FpFd uintptr
FiEof I64 FpFd uintptr
Temporary file object wrapper FaMemory uintptr FpList uintptr FszPMA int32
FaMemory uintptr FpList uintptr FszPMA int32
Incrementally write one PMA FnVal int32 Fu struct{FpNext uintptr}
FnVal int32 Fu struct{FpNext uintptr}
CAPI3REF: Database Connection Handle KEYWORDS: {database connection} {database connections} Each open SQLite database is represented by a pointer to an instance of the opaque structure named "sqlite3". It is useful to think of an sqlite3 pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()] and [sqlite3_close_v2()] are its destructors. There are many other interfaces (such as [sqlite3_prepare_v2()], [sqlite3_create_function()], and [sqlite3_busy_timeout()] to name but three) that are methods on an sqlite3 object. FaCollSeq Hash FaDb uintptr FaDbStatic [2]Db FaExtension uintptr FaFunc Hash FaLimit [12]int32 FaModule Hash FaVTrans uintptr FautoCommit U8 FbBenignMalloc U8 FbusyHandler BusyHandler FbusyTimeout int32 FdbOptFlags U32 FdfltLockMode U8 Fenc U8 FerrCode int32 FerrMask int32 Fflags U64 FiSysErrno int32 Finit struct{FnewTnum Pgno; FiDb U8; Fbusy U8; _ [2]byte; ForphanTrigger uint8; _ [7]byte; FazInit uintptr} FisTransactionSavepoint U8 FlastRowid I64 Flookaside Lookaside FmDbFlags U32 FmTrace U8 Fmagic U32 FmallocFailed U8 Fmutex uintptr FnAnalysisLimit int32 FnChange int32 FnDb int32 FnDeferredCons I64 FnDeferredImmCons I64 FnExtension int32 FnMaxSorterMmap int32 FnProgressOps uint32 FnSavepoint int32 FnSchemaLock U32 FnSqlExec U8 FnStatement int32 FnTotalChange int32 FnVDestroy int32 FnVTrans int32 FnVdbeActive int32 FnVdbeExec int32 FnVdbeRead int32 FnVdbeWrite int32 FnextAutovac int8 FnextPagesize int32 FnoSharedCache U8 FopenFlags uint32 FpAuthArg uintptr FpBlockingConnection uintptr FpCollNeededArg uintptr FpCommitArg uintptr FpDfltColl uintptr FpDisconnect uintptr FpErr uintptr FpNextBlocked uintptr FpParse uintptr FpPreUpdate uintptr FpPreUpdateArg uintptr FpProfileArg uintptr FpProgressArg uintptr FpRollbackArg uintptr FpSavepoint uintptr FpTraceArg uintptr FpUnlockArg uintptr FpUnlockConnection uintptr FpUpdateArg uintptr FpVdbe uintptr FpVfs uintptr FpVtabCtx uintptr FpWalArg uintptr FpnBytesFreed uintptr FsuppressErr U8 FszMmap I64 Ftemp_store U8 Ftrace struct{FxLegacy uintptr} Fu1 struct{_ [0]uint64; FisInterrupted int32; _ [4]byte} FvtabOnConflict U8 FxAuth Sqlite3_xauth FxCollNeeded uintptr FxCollNeeded16 uintptr FxCommitCallback uintptr FxPreUpdateCallback uintptr FxProfile uintptr FxProgress uintptr FxRollbackCallback uintptr FxUnlockNotify uintptr FxUpdateCallback uintptr FxWalCallback uintptr
CAPI3REF: Loadable Extension Thunk A pointer to the opaque sqlite3_api_routines structure is passed as the third parameter to entry points of [loadable extensions]. This structure must be typedefed in order to work around compiler warnings on some platforms. Faggregate_context uintptr Faggregate_count uintptr Fauto_extension uintptr Fbackup_finish uintptr Fbackup_init uintptr Fbackup_pagecount uintptr Fbackup_remaining uintptr Fbackup_step uintptr Fbind_blob uintptr Fbind_blob64 uintptr Fbind_double uintptr Fbind_int uintptr Fbind_int64 uintptr Fbind_null uintptr Fbind_parameter_count uintptr Fbind_parameter_index uintptr Fbind_parameter_name uintptr Fbind_pointer uintptr Fbind_text uintptr Fbind_text16 uintptr Fbind_text64 uintptr Fbind_value uintptr Fbind_zeroblob uintptr Fbind_zeroblob64 uintptr Fblob_bytes uintptr Fblob_close uintptr Fblob_open uintptr Fblob_read uintptr Fblob_reopen uintptr Fblob_write uintptr Fbusy_handler uintptr Fbusy_timeout uintptr Fcancel_auto_extension uintptr Fchanges uintptr Fclear_bindings uintptr Fclose uintptr Fclose_v2 uintptr Fcollation_needed uintptr Fcollation_needed16 uintptr Fcolumn_blob uintptr Fcolumn_bytes uintptr Fcolumn_bytes16 uintptr Fcolumn_count uintptr Fcolumn_database_name uintptr Fcolumn_database_name16 uintptr Fcolumn_decltype uintptr Fcolumn_decltype16 uintptr Fcolumn_double uintptr Fcolumn_int uintptr Fcolumn_int64 uintptr Fcolumn_name uintptr Fcolumn_name16 uintptr Fcolumn_origin_name uintptr Fcolumn_origin_name16 uintptr Fcolumn_table_name uintptr Fcolumn_table_name16 uintptr Fcolumn_text uintptr Fcolumn_text16 uintptr Fcolumn_type uintptr Fcolumn_value uintptr Fcommit_hook uintptr Fcompileoption_get uintptr Fcompileoption_used uintptr Fcomplete uintptr Fcomplete16 uintptr Fcontext_db_handle uintptr Fcreate_collation uintptr Fcreate_collation16 uintptr Fcreate_collation_v2 uintptr Fcreate_filename uintptr Fcreate_function uintptr Fcreate_function16 uintptr Fcreate_function_v2 uintptr Fcreate_module uintptr Fcreate_module_v2 uintptr Fcreate_window_function uintptr Fdata_count uintptr Fdatabase_file_object uintptr Fdb_cacheflush uintptr Fdb_config uintptr Fdb_filename uintptr Fdb_handle uintptr Fdb_mutex uintptr Fdb_readonly uintptr Fdb_release_memory uintptr Fdb_status uintptr Fdeclare_vtab uintptr Fdrop_modules uintptr Fenable_shared_cache uintptr Ferrcode uintptr Ferrmsg uintptr Ferrmsg16 uintptr Ferrstr uintptr Fexec uintptr Fexpanded_sql uintptr Fexpired uintptr Fextended_errcode uintptr Fextended_result_codes uintptr Ffile_control uintptr Ffilename_database uintptr Ffilename_journal uintptr Ffilename_wal uintptr Ffinalize uintptr Ffree uintptr Ffree_filename uintptr Ffree_table uintptr Fget_autocommit uintptr Fget_auxdata uintptr Fget_table uintptr Fglobal_recover uintptr Fhard_heap_limit64 uintptr Finterruptx uintptr Fkeyword_check uintptr Fkeyword_count uintptr Fkeyword_name uintptr Flast_insert_rowid uintptr Flibversion uintptr Flibversion_number uintptr Flimit uintptr Fload_extension uintptr Flog uintptr Fmalloc uintptr Fmalloc64 uintptr Fmemory_highwater uintptr Fmemory_used uintptr Fmprintf uintptr Fmsize uintptr Fmutex_alloc uintptr Fmutex_enter uintptr Fmutex_free uintptr Fmutex_leave uintptr Fmutex_try uintptr Fnext_stmt uintptr Fnormalized_sql uintptr Fopen uintptr Fopen16 uintptr Fopen_v2 uintptr Foverload_function uintptr Fprepare uintptr Fprepare16 uintptr Fprepare16_v2 uintptr Fprepare16_v3 uintptr Fprepare_v2 uintptr Fprepare_v3 uintptr Fprofile uintptr Fprogress_handler uintptr Frandomness uintptr Frealloc uintptr Frealloc64 uintptr Frelease_memory uintptr Freset uintptr Freset_auto_extension uintptr Fresult_blob uintptr Fresult_blob64 uintptr Fresult_double uintptr Fresult_error uintptr Fresult_error16 uintptr Fresult_error_code uintptr Fresult_error_nomem uintptr Fresult_error_toobig uintptr Fresult_int uintptr Fresult_int64 uintptr Fresult_null uintptr Fresult_pointer uintptr Fresult_subtype uintptr Fresult_text uintptr Fresult_text16 uintptr Fresult_text16be uintptr Fresult_text16le uintptr Fresult_text64 uintptr Fresult_value uintptr Fresult_zeroblob uintptr Fresult_zeroblob64 uintptr Frollback_hook uintptr Fset_authorizer uintptr Fset_auxdata uintptr Fset_last_insert_rowid uintptr Fsleep uintptr Fsoft_heap_limit uintptr Fsoft_heap_limit64 uintptr Fsourceid uintptr Fsql uintptr Fstatus uintptr Fstatus64 uintptr Fstep uintptr Fstmt_busy uintptr Fstmt_isexplain uintptr Fstmt_readonly uintptr Fstmt_status uintptr Fstr_append uintptr Fstr_appendall uintptr Fstr_appendchar uintptr Fstr_appendf uintptr Fstr_errcode uintptr Fstr_finish uintptr Fstr_length uintptr Fstr_new uintptr Fstr_reset uintptr Fstr_value uintptr Fstr_vappendf uintptr Fstrglob uintptr Fstricmp uintptr Fstrlike uintptr Fstrnicmp uintptr Fsystem_errno uintptr Ftable_column_metadata uintptr Ftest_control uintptr Fthread_cleanup uintptr Ftotal_changes uintptr Ftrace uintptr Ftrace_v2 uintptr Ftransfer_bindings uintptr Ftxn_state uintptr Funlock_notify uintptr Fupdate_hook uintptr Furi_boolean uintptr Furi_int64 uintptr Furi_key uintptr Furi_parameter uintptr Fuser_data uintptr Fvalue_blob uintptr Fvalue_bytes uintptr Fvalue_bytes16 uintptr Fvalue_double uintptr Fvalue_dup uintptr Fvalue_free uintptr Fvalue_frombind uintptr Fvalue_int uintptr Fvalue_int64 uintptr Fvalue_nochange uintptr Fvalue_numeric_type uintptr Fvalue_pointer uintptr Fvalue_subtype uintptr Fvalue_text uintptr Fvalue_text16 uintptr Fvalue_text16be uintptr Fvalue_text16le uintptr Fvalue_type uintptr Fvfs_find uintptr Fvfs_register uintptr Fvfs_unregister uintptr Fvmprintf uintptr Fvtab_collation uintptr Fvtab_config uintptr Fvtab_nochange uintptr Fvtab_on_conflict uintptr Fwal_autocheckpoint uintptr Fwal_checkpoint uintptr Fwal_checkpoint_v2 uintptr Fwal_hook uintptr Fxsnprintf uintptr Fxthreadsafe uintptr Fxvsnprintf uintptr
CAPI3REF: Online Backup Object The sqlite3_backup object records state information about an ongoing online backup operation. ^The sqlite3_backup object is created by a call to [sqlite3_backup_init()] and is destroyed by a call to [sqlite3_backup_finish()]. See Also: [Using the SQLite Online Backup API] FbDestLocked int32 FiDestSchema U32 FiNext Pgno FisAttached int32 FnPagecount Pgno FnRemaining Pgno FpDest uintptr FpDestDb uintptr FpNext uintptr FpSrc uintptr FpSrcDb uintptr Frc int32
The type for a callback function. This is legacy and deprecated. It is included for historical compatibility and is not documented.
CAPI3REF: SQL Function Context Object The context in which an SQL function executes is stored in an sqlite3_context object. ^A pointer to an sqlite3_context object is always first parameter to [application-defined SQL functions]. The application-defined SQL function implementation will pass this pointer through into calls to [sqlite3_result_int | sqlite3_result()], [sqlite3_aggregate_context()], [sqlite3_user_data()], [sqlite3_context_db_handle()], [sqlite3_get_auxdata()], and/or [sqlite3_set_auxdata()]. Fargc U8 Fargv [1]uintptr FiOp int32 FisError int32 FpFunc uintptr FpMem uintptr FpOut uintptr FpVdbe uintptr FskipFlag U8
CAPI3REF: Constants Defining Special Destructor Behavior These are special values for the destructor that is passed in as the final argument to routines like [sqlite3_result_blob()]. ^If the destructor argument is SQLITE_STATIC, it means that the content pointer is constant and will never change. It does not need to be destroyed. ^The SQLITE_TRANSIENT value means that the content will likely change in the near future and that SQLite should make its own private copy of the content before returning. The typedef is necessary to work around problems in certain C++ compilers.
CAPI3REF: OS Interface Open File Handle An [sqlite3_file] object represents an open file in the [sqlite3_vfs | OS interface layer]. Individual OS interface implementations will want to subclass this object by appending additional fields for their own use. The pMethods entry is a pointer to an [sqlite3_io_methods] object that defines methods for performing I/O operations on the open file. FpMethods uintptr
type Sqlite3_int64 = Sqlite_int64 (basic type)
CAPI3REF: OS Interface File Virtual Methods Object Every file opened by the [sqlite3_vfs.xOpen] method populates an [sqlite3_file] object (or, more commonly, a subclass of the [sqlite3_file] object) with a pointer to an instance of this object. This object defines the methods used to perform various operations against the open file represented by the [sqlite3_file] object. If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element to a non-NULL pointer, then the sqlite3_io_methods.xClose method may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed. The only way to prevent a call to xClose following a failed [sqlite3_vfs.xOpen] is for the [sqlite3_vfs.xOpen] to set the sqlite3_file.pMethods element to NULL. The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or [SQLITE_SYNC_FULL]. The first choice is the normal fsync(). The second choice is a Mac OS X style fullsync. The [SQLITE_SYNC_DATAONLY] flag may be ORed in to indicate that only the data of the file and not its inode needs to be synced. The integer values to xLock() and xUnlock() are one of <ul> <li> [SQLITE_LOCK_NONE], <li> [SQLITE_LOCK_SHARED], <li> [SQLITE_LOCK_RESERVED], <li> [SQLITE_LOCK_PENDING], or <li> [SQLITE_LOCK_EXCLUSIVE]. </ul> xLock() increases the lock. xUnlock() decreases the lock. The xCheckReservedLock() method checks whether any database connection, either in this process or in some other process, is holding a RESERVED, PENDING, or EXCLUSIVE lock on the file. It returns true if such a lock exists and false otherwise. The xFileControl() method is a generic interface that allows custom VFS implementations to directly control an open file using the [sqlite3_file_control()] interface. The second "op" argument is an integer opcode. The third argument is a generic pointer intended to point to a structure that may contain arguments or space in which to write return values. Potential uses for xFileControl() might be functions to enable blocking locks with timeouts, to change the locking strategy (for example to use dot-file locks), to inquire about the status of a lock, or to break stale locks. The SQLite core reserves all opcodes less than 100 for its own use. A [file control opcodes | list of opcodes] less than 100 is available. Applications that define a custom xFileControl method should use opcodes greater than 100 to avoid conflicts. VFS implementations should return [SQLITE_NOTFOUND] for file control opcodes that they do not recognize. The xSectorSize() method returns the sector size of the device that underlies the file. The sector size is the minimum write that can be performed without disturbing other bytes in the file. The xDeviceCharacteristics() method returns a bit vector describing behaviors of the underlying device: <ul> <li> [SQLITE_IOCAP_ATOMIC] <li> [SQLITE_IOCAP_ATOMIC512] <li> [SQLITE_IOCAP_ATOMIC1K] <li> [SQLITE_IOCAP_ATOMIC2K] <li> [SQLITE_IOCAP_ATOMIC4K] <li> [SQLITE_IOCAP_ATOMIC8K] <li> [SQLITE_IOCAP_ATOMIC16K] <li> [SQLITE_IOCAP_ATOMIC32K] <li> [SQLITE_IOCAP_ATOMIC64K] <li> [SQLITE_IOCAP_SAFE_APPEND] <li> [SQLITE_IOCAP_SEQUENTIAL] <li> [SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN] <li> [SQLITE_IOCAP_POWERSAFE_OVERWRITE] <li> [SQLITE_IOCAP_IMMUTABLE] <li> [SQLITE_IOCAP_BATCH_ATOMIC] </ul> The SQLITE_IOCAP_ATOMIC property means that all writes of any size are atomic. The SQLITE_IOCAP_ATOMICnnn values mean that writes of blocks that are nnn bytes in size and are aligned to an address which is an integer multiple of nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means that when data is appended to a file, the data is appended first then the size of the file is extended, never the other way around. The SQLITE_IOCAP_SEQUENTIAL property means that information is written to disk in the same order as calls to xWrite(). If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill in the unread portions of the buffer with zeros. A VFS that fails to zero-fill short reads might seem to work. However, failure to zero-fill short reads will eventually lead to database corruption. FiVersion int32 FxCheckReservedLock uintptr FxClose uintptr FxDeviceCharacteristics uintptr FxFetch uintptr FxFileControl uintptr FxFileSize uintptr FxLock uintptr FxRead uintptr FxSectorSize uintptr FxShmBarrier uintptr FxShmLock uintptr FxShmMap uintptr FxShmUnmap uintptr FxSync uintptr FxTruncate uintptr FxUnfetch uintptr FxUnlock uintptr FxWrite uintptr
This is the function signature used for all extension entry points. It is also defined in the file "loadext.c".
CAPI3REF: Memory Allocation Routines An instance of this object defines the interface between SQLite and low-level memory allocation routines. This object is used in only one place in the SQLite interface. A pointer to an instance of this object is the argument to [sqlite3_config()] when the configuration option is [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC]. By creating an instance of this object and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC]) during configuration, an application can specify an alternative memory allocation subsystem for SQLite to use for all of its dynamic memory needs. Note that SQLite comes with several [built-in memory allocators] that are perfectly adequate for the overwhelming majority of applications and that this object is only useful to a tiny minority of applications with specialized memory allocation requirements. This object is also used during testing of SQLite in order to specify an alternative memory allocator that simulates memory out-of-memory conditions in order to verify that SQLite recovers gracefully from such conditions. The xMalloc, xRealloc, and xFree methods must work like the malloc(), realloc() and free() functions from the standard C library. ^SQLite guarantees that the second argument to xRealloc is always a value returned by a prior call to xRoundup. xSize should return the allocated size of a memory allocation previously obtained from xMalloc or xRealloc. The allocated size is always at least as big as the requested size but may be larger. The xRoundup method returns what would be the allocated size of a memory allocation given a particular requested size. Most memory allocators round up memory allocations at least to the next multiple of 8. Some allocators round up to a larger multiple or to a power of 2. Every memory allocation request coming in through [sqlite3_malloc()] or [sqlite3_realloc()] first calls xRoundup. If xRoundup returns 0, that causes the corresponding memory allocation to fail. The xInit method initializes the memory allocator. For example, it might allocate any required mutexes or initialize internal data structures. The xShutdown method is invoked (indirectly) by [sqlite3_shutdown()] and should deallocate any resources acquired by xInit. The pAppData pointer is used as the only parameter to xInit and xShutdown. SQLite holds the [SQLITE_MUTEX_STATIC_MAIN] mutex when it invokes the xInit method, so the xInit method need not be threadsafe. The xShutdown method is only called from [sqlite3_shutdown()] so it does not need to be threadsafe either. For all other methods, SQLite holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which it is by default) and so the methods are automatically serialized. However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other methods must be threadsafe or else make their own arrangements for serialization. SQLite will never invoke xInit() more than once without an intervening call to xShutdown(). FpAppData uintptr FxFree uintptr FxInit uintptr FxMalloc uintptr FxRealloc uintptr FxRoundup uintptr FxShutdown uintptr FxSize uintptr
CAPI3REF: Mutex Methods Object An instance of this structure defines the low-level routines used to allocate and use mutexes. Usually, the default mutex implementations provided by SQLite are sufficient, however the application has the option of substituting a custom implementation for specialized deployments or systems for which SQLite does not provide a suitable implementation. In this case, the application creates and populates an instance of this structure to pass to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option. Additionally, an instance of this structure can be used as an output variable when querying the system for the current mutex implementation, using the [SQLITE_CONFIG_GETMUTEX] option. ^The xMutexInit method defined by this structure is invoked as part of system initialization by the sqlite3_initialize() function. ^The xMutexInit routine is called by SQLite exactly once for each effective call to [sqlite3_initialize()]. ^The xMutexEnd method defined by this structure is invoked as part of system shutdown by the sqlite3_shutdown() function. The implementation of this method is expected to release all outstanding resources obtained by the mutex methods implementation, especially those obtained by the xMutexInit method. ^The xMutexEnd() interface is invoked exactly once for each call to [sqlite3_shutdown()]. ^(The remaining seven methods defined by this structure (xMutexAlloc, xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and xMutexNotheld) implement the following interfaces (respectively): <ul> <li> [sqlite3_mutex_alloc()] </li> <li> [sqlite3_mutex_free()] </li> <li> [sqlite3_mutex_enter()] </li> <li> [sqlite3_mutex_try()] </li> <li> [sqlite3_mutex_leave()] </li> <li> [sqlite3_mutex_held()] </li> <li> [sqlite3_mutex_notheld()] </li> </ul>)^ The only difference is that the public sqlite3_XXX functions enumerated above silently ignore any invocations that pass a NULL pointer instead of a valid mutex handle. The implementations of the methods defined by this structure are not required to handle this case. The results of passing a NULL pointer instead of a valid mutex handle are undefined (i.e. it is acceptable to provide an implementation that segfaults if it is passed a NULL pointer). The xMutexInit() method must be threadsafe. It must be harmless to invoke xMutexInit() multiple times within the same process and without intervening calls to xMutexEnd(). Second and subsequent calls to xMutexInit() must be no-ops. xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()] and its associates). Similarly, xMutexAlloc() must not use SQLite memory allocation for a static mutex. ^However xMutexAlloc() may use SQLite memory allocation for a fast or recursive mutex. ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is called, but only if the prior call to xMutexInit returned SQLITE_OK. If xMutexInit fails in any way, it is expected to clean up after itself prior to returning. FxMutexAlloc uintptr FxMutexEnd uintptr FxMutexEnter uintptr FxMutexFree uintptr FxMutexHeld uintptr FxMutexInit uintptr FxMutexLeave uintptr FxMutexNotheld uintptr FxMutexTry uintptr
This is the obsolete pcache_methods object that has now been replaced by sqlite3_pcache_methods2. This object is not used by SQLite. It is retained in the header file for backwards compatibility only. FpArg uintptr FxCachesize uintptr FxCreate uintptr FxDestroy uintptr FxFetch uintptr FxInit uintptr FxPagecount uintptr FxRekey uintptr FxShutdown uintptr FxTruncate uintptr FxUnpin uintptr
CAPI3REF: Application Defined Page Cache. KEYWORDS: {page cache} ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can register an alternative page cache implementation by passing in an instance of the sqlite3_pcache_methods2 structure.)^ In many applications, most of the heap memory allocated by SQLite is used for the page cache. By implementing a custom page cache using this API, an application can better control the amount of memory consumed by SQLite, the way in which that memory is allocated and released, and the policies used to determine exactly which parts of a database file are cached and for how long. The alternative page cache mechanism is an extreme measure that is only needed by the most demanding applications. The built-in page cache is recommended for most uses. ^(The contents of the sqlite3_pcache_methods2 structure are copied to an internal buffer by SQLite within the call to [sqlite3_config]. Hence the application may discard the parameter after the call to [sqlite3_config()] returns.)^ [[the xInit() page cache method]] ^(The xInit() method is called once for each effective call to [sqlite3_initialize()])^ (usually only once during the lifetime of the process). ^(The xInit() method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^ The intent of the xInit() method is to set up global data structures required by the custom page cache implementation. ^(If the xInit() method is NULL, then the built-in default page cache is used instead of the application defined page cache.)^ [[the xShutdown() page cache method]] ^The xShutdown() method is called by [sqlite3_shutdown()]. It can be used to clean up any outstanding resources before process shutdown, if required. ^The xShutdown() method may be NULL. ^SQLite automatically serializes calls to the xInit method, so the xInit method need not be threadsafe. ^The xShutdown method is only called from [sqlite3_shutdown()] so it does not need to be threadsafe either. All other methods must be threadsafe in multithreaded applications. ^SQLite will never invoke xInit() more than once without an intervening call to xShutdown(). [[the xCreate() page cache methods]] ^SQLite invokes the xCreate() method to construct a new cache instance. SQLite will typically create one cache instance for each open database file, though this is not guaranteed. ^The first parameter, szPage, is the size in bytes of the pages that must be allocated by the cache. ^szPage will always a power of two. ^The second parameter szExtra is a number of bytes of extra storage associated with each page cache entry. ^The szExtra parameter will a number less than 250. SQLite will use the extra szExtra bytes on each page to store metadata about the underlying database page on disk. The value passed into szExtra depends on the SQLite version, the target platform, and how SQLite was compiled. ^The third argument to xCreate(), bPurgeable, is true if the cache being created will be used to cache database pages of a file stored on disk, or false if it is used for an in-memory database. The cache implementation does not have to do anything special based with the value of bPurgeable; it is purely advisory. ^On a cache where bPurgeable is false, SQLite will never invoke xUnpin() except to deliberately delete a page. ^In other words, calls to xUnpin() on a cache with bPurgeable set to false will always have the "discard" flag set to true. ^Hence, a cache created with bPurgeable false will never contain any unpinned pages. [[the xCachesize() page cache method]] ^(The xCachesize() method may be called at any time by SQLite to set the suggested maximum cache-size (number of pages stored by) the cache instance passed as the first argument. This is the value configured using the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable parameter, the implementation is not required to do anything with this value; it is advisory only. [[the xPagecount() page cache methods]] The xPagecount() method must return the number of pages currently stored in the cache, both pinned and unpinned. [[the xFetch() page cache methods]] The xFetch() method locates a page in the cache and returns a pointer to an sqlite3_pcache_page object associated with that page, or a NULL pointer. The pBuf element of the returned sqlite3_pcache_page object will be a pointer to a buffer of szPage bytes used to store the content of a single database page. The pExtra element of sqlite3_pcache_page will be a pointer to the szExtra bytes of extra storage that SQLite has requested for each entry in the page cache. The page to be fetched is determined by the key. ^The minimum key value is 1. After it has been retrieved using xFetch, the page is considered to be "pinned". If the requested page is already in the page cache, then the page cache implementation must return a pointer to the page buffer with its content intact. If the requested page is not already in the cache, then the cache implementation should use the value of the createFlag parameter to help it determined what action to take: <table border=1 width=85% align=center> <tr><th> createFlag <th> Behavior when page is not already in cache <tr><td> 0 <td> Do not allocate a new page. Return NULL. <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so. Otherwise return NULL. <tr><td> 2 <td> Make every effort to allocate a new page. Only return NULL if allocating a new page is effectively impossible. </table> ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1. SQLite will only use a createFlag of 2 after a prior call with a createFlag of 1 failed.)^ In between the xFetch() calls, SQLite may attempt to unpin one or more cache pages by spilling the content of pinned pages to disk and synching the operating system disk cache. [[the xUnpin() page cache method]] ^xUnpin() is called by SQLite with a pointer to a currently pinned page as its second argument. If the third parameter, discard, is non-zero, then the page must be evicted from the cache. ^If the discard parameter is zero, then the page may be discarded or retained at the discretion of page cache implementation. ^The page cache implementation may choose to evict unpinned pages at any time. The cache must not perform any reference counting. A single call to xUnpin() unpins the page regardless of the number of prior calls to xFetch(). [[the xRekey() page cache methods]] The xRekey() method is used to change the key value associated with the page passed as the second argument. If the cache previously contains an entry associated with newKey, it must be discarded. ^Any prior cache entry associated with newKey is guaranteed not to be pinned. When SQLite calls the xTruncate() method, the cache must discard all existing cache entries with page numbers (keys) greater than or equal to the value of the iLimit parameter passed to xTruncate(). If any of these pages are pinned, they are implicitly unpinned, meaning that they can be safely discarded. [[the xDestroy() page cache method]] ^The xDestroy() method is used to delete a cache allocated by xCreate(). All resources associated with the specified cache should be freed. ^After calling the xDestroy() method, SQLite considers the [sqlite3_pcache*] handle invalid, and will not use it with any other sqlite3_pcache_methods2 functions. [[the xShrink() page cache method]] ^SQLite invokes the xShrink() method when it wants the page cache to free up as much of heap memory as possible. The page cache implementation is not obligated to free any memory, but well-behaved implementations should do their best. FiVersion int32 FpArg uintptr FxCachesize uintptr FxCreate uintptr FxDestroy uintptr FxFetch uintptr FxInit uintptr FxPagecount uintptr FxRekey uintptr FxShrink uintptr FxShutdown uintptr FxTruncate uintptr FxUnpin uintptr
CAPI3REF: Custom Page Cache Object The sqlite3_pcache_page object represents a single page in the page cache. The page cache will allocate instances of this object. Various methods of the page cache use pointers to instances of this object as parameters or as their return value. See [sqlite3_pcache_methods2] for additional information. FpBuf uintptr FpExtra uintptr
The double-precision datatype used by RTree depends on the SQLITE_RTREE_INT_ONLY compile-time option.
CAPI3REF: Database Snapshot KEYWORDS: {snapshot} {sqlite3_snapshot} An instance of the snapshot object records the state of a [WAL mode] database for some specific point in history. In [WAL mode], multiple [database connections] that are open on the same database file can each be reading a different historical version of the database file. When a [database connection] begins a read transaction, that connection sees an unchanging copy of the database as it existed for the point in time when the transaction first started. Subsequent changes to the database from other connections are not seen by the reader until a new read transaction is started. The sqlite3_snapshot object records state information about an historical version of the database file so that it is possible to later open a new read transaction that sees that historical version of the database rather than the most recent version. Fhidden [48]uint8
CAPI3REF: Dynamic String Object KEYWORDS: {dynamic string} An instance of the sqlite3_str object contains a dynamically-sized string under construction. The lifecycle of an sqlite3_str object is as follows: <ol> <li> ^The sqlite3_str object is created using [sqlite3_str_new()]. <li> ^Text is appended to the sqlite3_str object using various methods, such as [sqlite3_str_appendf()]. <li> ^The sqlite3_str object is destroyed and the string it created is returned using the [sqlite3_str_finish()] interface. </ol> FaccError U8 Fdb uintptr FmxAlloc U32 FnAlloc U32 FnChar U32 FprintfFlags U8 FzText uintptr
type Sqlite3_syscall_ptr = uintptr (basic type)
type Sqlite3_uint64 = Sqlite_uint64 (basic type)
CAPI3REF: Dynamically Typed Value Object KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value} SQLite uses the sqlite3_value object to represent all values that can be stored in a database table. SQLite uses dynamic typing for the values it stores. ^Values stored in sqlite3_value objects can be integers, floating point values, strings, BLOBs, or NULL. An sqlite3_value object may be either "protected" or "unprotected". Some interfaces require a protected sqlite3_value. Other interfaces will accept either a protected or an unprotected sqlite3_value. Every interface that accepts sqlite3_value arguments specifies whether or not it requires a protected sqlite3_value. The [sqlite3_value_dup()] interface can be used to construct a new protected sqlite3_value from an unprotected sqlite3_value. The terms "protected" and "unprotected" refer to whether or not a mutex is held. An internal mutex is held for a protected sqlite3_value object but no mutex is held for an unprotected sqlite3_value object. If SQLite is compiled to be single-threaded (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0) or if SQLite is run in one of reduced mutex modes [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD] then there is no distinction between protected and unprotected sqlite3_value objects and they can be used interchangeably. However, for maximum code portability it is recommended that applications still make the distinction between protected and unprotected sqlite3_value objects even when not strictly required. ^The sqlite3_value objects that are passed as parameters into the implementation of [application-defined SQL functions] are protected. ^The sqlite3_value object returned by [sqlite3_column_value()] is unprotected. Unprotected sqlite3_value objects may only be used as arguments to [sqlite3_result_value()], [sqlite3_bind_value()], and [sqlite3_value_dup()]. The [sqlite3_value_blob | sqlite3_value_type()] family of interfaces require protected sqlite3_value objects. Fdb uintptr FeSubtype U8 Fenc U8 Fflags U16 Fn int32 FszMalloc int32 Fu struct{Fr float64} FuTemp U32 FxDel uintptr Fz uintptr FzMalloc uintptr
CAPI3REF: OS Interface Object An instance of the sqlite3_vfs object defines the interface between the SQLite core and the underlying operating system. The "vfs" in the name of the object stands for "virtual file system". See the [VFS | VFS documentation] for further information. The VFS interface is sometimes extended by adding new methods onto the end. Each time such an extension occurs, the iVersion field is incremented. The iVersion value started out as 1 in SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2 with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased to 3 with SQLite [version 3.7.6] on [dateof:3.7.6]. Additional fields may be appended to the sqlite3_vfs object and the iVersion value may increase again in future versions of SQLite. Note that due to an oversight, the structure of the sqlite3_vfs object changed in the transition from SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0] and yet the iVersion field was not increased. The szOsFile field is the size of the subclassed [sqlite3_file] structure used by this VFS. mxPathname is the maximum length of a pathname in this VFS. Registered sqlite3_vfs objects are kept on a linked list formed by the pNext pointer. The [sqlite3_vfs_register()] and [sqlite3_vfs_unregister()] interfaces manage this list in a thread-safe way. The [sqlite3_vfs_find()] interface searches the list. Neither the application code nor the VFS implementation should use the pNext pointer. The pNext field is the only field in the sqlite3_vfs structure that SQLite will ever modify. SQLite will only access or modify this field while holding a particular static mutex. The application should never modify anything within the sqlite3_vfs object once the object has been registered. The zName field holds the name of the VFS module. The name must be unique across all VFS modules. [[sqlite3_vfs.xOpen]] ^SQLite guarantees that the zFilename parameter to xOpen is either a NULL pointer or string obtained from xFullPathname() with an optional suffix added. ^If a suffix is added to the zFilename parameter, it will consist of a single "-" character followed by no more than 11 alphanumeric and/or "-" characters. ^SQLite further guarantees that the string will be valid and unchanged until xClose() is called. Because of the previous sentence, the [sqlite3_file] can safely store a pointer to the filename if it needs to remember the filename for some reason. If the zFilename parameter to xOpen is a NULL pointer then xOpen must invent its own temporary name for the file. ^Whenever the xFilename parameter is NULL it will also be the case that the flags parameter will include [SQLITE_OPEN_DELETEONCLOSE]. The flags argument to xOpen() includes all bits set in the flags argument to [sqlite3_open_v2()]. Or if [sqlite3_open()] or [sqlite3_open16()] is used, then flags includes at least [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. If xOpen() opens a file read-only then it sets *pOutFlags to include [SQLITE_OPEN_READONLY]. Other bits in *pOutFlags may be set. ^(SQLite will also add one of the following flags to the xOpen() call, depending on the object being opened: <ul> <li> [SQLITE_OPEN_MAIN_DB] <li> [SQLITE_OPEN_MAIN_JOURNAL] <li> [SQLITE_OPEN_TEMP_DB] <li> [SQLITE_OPEN_TEMP_JOURNAL] <li> [SQLITE_OPEN_TRANSIENT_DB] <li> [SQLITE_OPEN_SUBJOURNAL] <li> [SQLITE_OPEN_SUPER_JOURNAL] <li> [SQLITE_OPEN_WAL] </ul>)^ The file I/O implementation can use the object type flags to change the way it deals with files. For example, an application that does not care about crash recovery or rollback might make the open of a journal file a no-op. Writes to this journal would also be no-ops, and any attempt to read the journal would return SQLITE_IOERR. Or the implementation might recognize that a database file will be doing page-aligned sector reads and writes in a random order and set up its I/O subsystem accordingly. SQLite might also add one of the following flags to the xOpen method: <ul> <li> [SQLITE_OPEN_DELETEONCLOSE] <li> [SQLITE_OPEN_EXCLUSIVE] </ul> The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be deleted when it is closed. ^The [SQLITE_OPEN_DELETEONCLOSE] will be set for TEMP databases and their journals, transient databases, and subjournals. ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction with the [SQLITE_OPEN_CREATE] flag, which are both directly analogous to the O_EXCL and O_CREAT flags of the POSIX open() API. The SQLITE_OPEN_EXCLUSIVE flag, when paired with the SQLITE_OPEN_CREATE, is used to indicate that file should always be created, and that it is an error if it already exists. It is <i>not</i> used to indicate the file should be opened for exclusive access. ^At least szOsFile bytes of memory are allocated by SQLite to hold the [sqlite3_file] structure passed as the third argument to xOpen. The xOpen method does not have to allocate the structure; it should just fill it in. Note that the xOpen method must set the sqlite3_file.pMethods to either a valid [sqlite3_io_methods] object or to NULL. xOpen must do this even if the open fails. SQLite expects that the sqlite3_file.pMethods element will be valid after xOpen returns regardless of the success or failure of the xOpen call. [[sqlite3_vfs.xAccess]] ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS] to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to test whether a file is readable and writable, or [SQLITE_ACCESS_READ] to test whether a file is at least readable. The SQLITE_ACCESS_READ flag is never actually used and is not implemented in the built-in VFSes of SQLite. The file is named by the second argument and can be a directory. The xAccess method returns [SQLITE_OK] on success or some non-zero error code if there is an I/O error or if the name of the file given in the second argument is illegal. If SQLITE_OK is returned, then non-zero or zero is written into *pResOut to indicate whether or not the file is accessible. ^SQLite will always allocate at least mxPathname+1 bytes for the output buffer xFullPathname. The exact size of the output buffer is also passed as a parameter to both methods. If the output buffer is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is handled as a fatal error by SQLite, vfs implementations should endeavor to prevent this by setting mxPathname to a sufficiently large value. The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64() interfaces are not strictly a part of the filesystem, but they are included in the VFS structure for completeness. The xRandomness() function attempts to return nBytes bytes of good-quality randomness into zOut. The return value is the actual number of bytes of randomness obtained. The xSleep() method causes the calling thread to sleep for at least the number of microseconds given. ^The xCurrentTime() method returns a Julian Day Number for the current date and time as a floating point value. ^The xCurrentTimeInt64() method returns, as an integer, the Julian Day Number multiplied by 86400000 (the number of milliseconds in a 24-hour day). ^SQLite will use the xCurrentTimeInt64() method to get the current date and time if that method is available (if iVersion is 2 or greater and the function pointer is not NULL) and will fall back to xCurrentTime() if xCurrentTimeInt64() is unavailable. ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces are not used by the SQLite core. These optional interfaces are provided by some VFSes to facilitate testing of the VFS code. By overriding system calls with functions under its control, a test program can simulate faults and error conditions that would otherwise be difficult or impossible to induce. The set of system calls that can be overridden varies from one VFS to another, and from one version of the same VFS to the next. Applications that use these interfaces must be prepared for any or all of these interfaces to be NULL or for their behavior to change from one release to the next. Applications must not attempt to access any of these methods if the iVersion of the VFS is less than 3. FiVersion int32 FmxPathname int32 FpAppData uintptr FpNext uintptr FszOsFile int32 FxAccess uintptr FxCurrentTime uintptr FxCurrentTimeInt64 uintptr FxDelete uintptr FxDlClose uintptr FxDlError uintptr FxDlOpen uintptr FxDlSym uintptr FxFullPathname uintptr FxGetLastError uintptr FxGetSystemCall uintptr FxNextSystemCall uintptr FxOpen uintptr FxRandomness uintptr FxSetSystemCall uintptr FxSleep uintptr FzName uintptr
Structures used by the virtual table interface FnRef int32 FpModule uintptr FzErrMsg uintptr
FpVtab uintptr
typedef for the authorization callback function.
The following object holds the list of automatically loaded extensions. This list is shared across threads. The SQLITE_MUTEX_STATIC_MAIN mutex must be held while accessing this list. FaExt uintptr FnExt U32
FmxValue [10]Sqlite3StatValueType FnowValue [10]Sqlite3StatValueType
Variables in which to record status information.
CAPI3REF: 64-Bit Integer Types KEYWORDS: sqlite_int64 sqlite_uint64 Because there is no cross-platform way to specify 64-bit integer types SQLite includes typedefs for 64-bit signed and unsigned integers. The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions. The sqlite_int64 and sqlite_uint64 types are supported for backwards compatibility only. ^The sqlite3_int64 and sqlite_int64 types can store integer values between -9223372036854775808 and +9223372036854775807 inclusive. ^The sqlite3_uint64 and sqlite_uint64 types can store integer values between 0 and +18446744073709551615 inclusive.
type Sqlite_uint64 = uint64 (basic type)
FpIn uintptr FpResult uintptr FxTask uintptr
FpIn uintptr FpResult uintptr FxTask uintptr
Context pointer passed down through the tree-walk. FiSrcInner int32 FnOther int32 FnThis int32 FpSrc uintptr
FaddrFillSub int32 FcolUsed Bitmask Ffg struct{_ [0]uint32; Fjointype U8; _ [3]byte; FnotIndexed uint16; _ [2]byte} FiCursor int32 FpOn uintptr FpSchema uintptr FpSelect uintptr FpTab uintptr FpUsing uintptr FregResult int32 FregReturn int32 Fu1 struct{FzIndexedBy uintptr} Fu2 struct{FpIBIndex uintptr} FzAlias uintptr FzDatabase uintptr FzName uintptr
FaddrFillSub int32 FcolUsed Bitmask Ffg struct{_ [0]uint32; Fjointype U8; _ [3]byte; FnotIndexed uint16; _ [2]byte} FiCursor int32 FpOn uintptr FpSchema uintptr FpSelect uintptr FpTab uintptr FpUsing uintptr FregResult int32 FregReturn int32 Fu1 struct{FzIndexedBy uintptr} Fu2 struct{FpIBIndex uintptr} FzAlias uintptr FzDatabase uintptr FzName uintptr
Fa [1]SrcItem FnAlloc U32 FnSrc int32
Fa [1]SrcItem FnAlloc U32 FnSrc int32
Copyright (c) 2003-2012 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@ Copyright (c) 2000-2007 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@ Copyright 1995 NeXT Computer, Inc. All rights reserved.
Fss_flags int32 Fss_size X__darwin_size_t Fss_sp uintptr
Three SQL functions - stat_init(), stat_push(), and stat_get() - share an instance of the following structure to hold their state information. Fa uintptr FaBest uintptr Fcurrent StatSample Fdb uintptr FiGet int32 FiMin int32 FiPrn U32 FmxSample int32 FnCol int32 FnEst TRowcnt FnKeyCol int32 FnLimit int32 FnMaxEqZero int32 FnPSample TRowcnt FnRow TRowcnt FnSample int32 FnSkipAhead U8
Three SQL functions - stat_init(), stat_push(), and stat_get() - share an instance of the following structure to hold their state information. Fa uintptr FaBest uintptr Fcurrent StatSample Fdb uintptr FiGet int32 FiMin int32 FiPrn U32 FmxSample int32 FnCol int32 FnEst TRowcnt FnKeyCol int32 FnLimit int32 FnMaxEqZero int32 FnPSample TRowcnt FnRow TRowcnt FnSample int32 FnSkipAhead U8
FanDLt uintptr FanEq uintptr FanLt uintptr FiCol int32 FiHash U32 FisPSample U8 FnRowid U32 Fu struct{FiRowid I64}
FanDLt uintptr FanEq uintptr FanLt uintptr FiCol int32 FiHash U32 FisPSample U8 FnRowid U32 Fu struct{FiRowid I64}
FaccError U8 Fdb uintptr FmxAlloc U32 FnAlloc U32 FnChar U32 FprintfFlags U8 FzText uintptr
FaList uintptr FnList int32
FaOnce uintptr FaOp uintptr FnCsr int32 FnMem int32 FnOp int32 FpNext uintptr Ftoken uintptr
FaOnce uintptr FaOp uintptr FnCsr int32 FnMem int32 FnOp int32 FpNext uintptr Ftoken uintptr
An instance of the SubstContext object describes an substitution edit to be performed on a parse tree. All references to columns in table iTable are to be replaced by corresponding expressions in pEList. FiNewTable int32 FiTable int32 FisLeftJoin int32 FpEList uintptr FpParse uintptr
An instance of the SubstContext object describes an substitution edit to be performed on a parse tree. All references to columns in table iTable are to be replaced by corresponding expressions in pEList. FiNewTable int32 FiTable int32 FisLeftJoin int32 FpEList uintptr FpParse uintptr
An instance of the following structure holds the context of a sum() or avg() aggregate computation. Fapprox U8 Fcnt I64 FiSum I64 Foverflow U8 FrSum float64
An instance of the following structure holds the context of a sum() or avg() aggregate computation. Fapprox U8 Fcnt I64 FiSum I64 Foverflow U8 FrSum float64
type Suseconds_t = X__darwin_suseconds_t (basic type)
type Swblk_t = Int32_t (basic type)
This defines the size of syscall arguments after copying into the kernel:
Each entry in the following array defines a rule for folding a range of codepoints to lower case. The rule applies to a range of nRange codepoints starting at codepoint iCode. If the least significant bit in flags is clear, then the rule applies to all nRange codepoints (i.e. all nRange codepoints are upper case and need to be folded). Or, if it is set, then the rule only applies to every second codepoint in the range, starting with codepoint C. The 7 most significant bits in flags are an index into the aiOff[] array. If a specific codepoint C does require folding, then its lower case equivalent is ((C + aiOff[flags>>1]) & 0xFFFF). The contents of this array are generated by parsing the CaseFolding.txt file distributed as part of the "Unicode Character Database". See http://www.unicode.org for details. Fflags uint8 FiCode uint16 FnRange uint8
FiDb int32 FiTab Pgno FisWriteLock U8 FzLockName uintptr
FiDb int32 FiTab Pgno FisWriteLock U8 FzLockName uintptr
This structure is used to pass data from sqlite3_get_table() through to the callback function is uses to build the result. FazResult uintptr FnAlloc U32 FnColumn U32 FnData U32 FnRow U32 Frc int32 FzErrMsg uintptr
This structure is used to pass data from sqlite3_get_table() through to the callback function is uses to build the result. FazResult uintptr FnAlloc U32 FnColumn U32 FnData U32 FnRow U32 Frc int32 FzErrMsg uintptr
type Text_encoding_t = U_int32_t (basic type)
Copyright (c) 2003-2012 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@ Copyright (c) 2003-2012 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@ Copyright (c) 2003-2012 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@ Copyright (c) 2000-2007 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@ Copyright 1995 NeXT Computer, Inc. All rights reserved.
Fn uint32 Fz uintptr
Fn uint32 Fz uintptr
FpPhrase uintptr Frc int32
FpPhrase uintptr Frc int32
An instance of the following structure describes the event of a TRIGGER. "a" is the event type, one of TK_UPDATE, TK_INSERT, TK_DELETE, or TK_INSTEAD. If the event is of the form UPDATE ON (a,b,c) Then the "b" IdList records the list "a,b,c". Fa int32 Fb uintptr
FaColmask [2]U32 Forconf int32 FpNext uintptr FpProgram uintptr FpTrigger uintptr
FaColmask [2]U32 Forconf int32 FpNext uintptr FpProgram uintptr FpTrigger uintptr
************************************************************************* Start of trigram implementation. FbFold int32
************************************************************************* Start of trigram implementation. FbFold int32
The datatype used to store estimates of the number of rows in a table or index. This is an unsigned integer type. For 99.9% of the world, a 32-bit integer is sufficient. But a 64-bit integer can be used at compile-time if desired.
type U16 = uint16 (basic type)
type U32 = uint32 (basic type)
type U64 = Sqlite_uint64 (basic type)
type U8 = uint8 (basic type)
Copyright (c) 2017 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@
Copyright (c) 2017 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@
Copyright (c) 2012 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@
Copyright (c) 2012 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@
Copyright (c) 2012 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@
Copyright (c) 2016 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@
type U_long = uint64 (basic type)
type U_quad_t = U_int64_t (basic type)
Copyright (c) 2017 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@
user context Fuc_link uintptr Fuc_mcontext uintptr Fuc_mcsize X__darwin_size_t Fuc_onstack int32 Fuc_sigmask X__darwin_sigset_t Fuc_stack struct{Fss_sp uintptr; Fss_size X__darwin_size_t; Fss_flags int32; _ [4]byte}
type Uid_t = X__darwin_uid_t (basic type)
type Uint = uint32 (basic type)
type Uint16_t = uint16 (basic type)
type Uint32_t = uint32 (basic type)
type Uint64_t = uint64 (basic type)
type Uint8_t = uint8 (basic type)
type Uint_fast16_t = Uint16_t (basic type)
type Uint_fast32_t = Uint32_t (basic type)
type Uint_fast64_t = Uint64_t (basic type)
type Uint_fast8_t = Uint8_t (basic type)
type Uint_least16_t = Uint16_t (basic type)
type Uint_least32_t = Uint32_t (basic type)
type Uint_least64_t = Uint64_t (basic type)
type Uint_least8_t = Uint8_t (basic type)
type Uintmax_t = uint64 (basic type)
Copyright (c) 2003-2012 Apple Inc. All rights reserved. @APPLE_OSREFERENCE_LICENSE_HEADER_START@ This file contains Original Code and/or Modifications of Original Code as defined in and that are subject to the Apple Public Source License Version 2.0 (the 'License'). You may not use this file except in compliance with the License. The rights granted to you under the License may not be used to create, or enable the creation or redistribution of, unlawful or unlicensed copies of an Apple operating system, or to circumvent, violate, or enable the circumvention or violation of, any terms of an Apple operating system software license agreement. Please obtain a copy of the License at http://www.opensource.apple.com/apsl/ and read it before using this file. The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language governing rights and limitations under the License. @APPLE_OSREFERENCE_LICENSE_HEADER_END@
Forward references FexclMask U16 FhasMutex U8 Fid U8 FpNext uintptr FpShmNode uintptr FsharedMask U16
An i-node Ffd int32 Fflags int32 FpNext uintptr
Ffd int32 Fflags int32 FpNext uintptr
FaMem uintptr Fdefault_rc I8 FeqSeen U8 FerrCode U8 FnField U16 FpKeyInfo uintptr Fr1 I8 Fr2 I8
The uptr type is an unsigned integer large enough to hold a pointer
type Useconds_t = X__darwin_useconds_t (basic type)
These types are used for reserving the largest possible size.
type User_long_t = Int64_t (basic type)
type User_off_t = Int64_t (basic type)
type User_size_t = U_int64_t (basic type)
type User_ssize_t = Int64_t (basic type)
type User_time_t = Int64_t (basic type)
type User_ulong_t = U_int64_t (basic type)
type Ushort = uint16 (basic type)
type Uuid_t = X__darwin_uuid_t ([...]T)
The macro _VA_LIST_ is the same thing used by this file in Ultrix. But on BSD NET2 we must not test or define or undef it. (Note that the comments in NET 2's ansi.h are incorrect for _VA_LIST_--see stdio.h!) The macro _VA_LIST_DEFINED is used in Windows NT 3.5 The macro _VA_LIST is used in SCO Unix 3.2. The macro _VA_LIST_T_H is used in the Bull dpx2 The macro __va_list__ is used by BeOS.
Context object passed by sqlite3Stat4ProbeSetValue() through to valueNew(). See comments above valueNew() for details. FiVal int32 FpIdx uintptr FpParse uintptr FppRec uintptr
A single VDBE is an opaque structure named "Vdbe". Only routines in the source file sqliteVdbe.c are allowed to see the insides of this structure. FaColName uintptr FaCounter [7]U32 FaMem uintptr FaOp uintptr FaVar uintptr FapArg uintptr FapCsr uintptr FbtreeMask YDbMask FcacheCtr U32 Fdb uintptr FdoingRerun U8 FerrorAction U8 // bft expired: 2, bft explain: 2, bft changeCntOn: 1, bft runOnlyOnce: 1, bft usesStmtJournal: 1, bft readOnly: 1, bft bIsReader: 1 Fexpmask U32 FiCurrentTime I64 FiStatement int32 FiVdbeMagic U32 FlockMask YDbMask FminWriteFileFormat U8 FnChange int32 FnCursor int32 FnFkConstraint I64 FnFrame int32 FnMem int32 FnOp int32 FnOpAlloc int32 FnResColumn U16 FnStmtDefCons I64 FnStmtDefImmCons I64 FnVar YnVar FpAuxData uintptr FpDelFrame uintptr FpFrame uintptr FpFree uintptr FpNext uintptr FpParse uintptr FpPrev uintptr FpProgram uintptr FpResultSet uintptr FpVList uintptr Fpc int32 FprepFlags U8 Frc int32 FstartTime I64 FzErrMsg uintptr FzSql uintptr
A single VDBE is an opaque structure named "Vdbe". Only routines in the source file sqliteVdbe.c are allowed to see the insides of this structure. FaColName uintptr FaCounter [7]U32 FaMem uintptr FaOp uintptr FaVar uintptr FapArg uintptr FapCsr uintptr FbtreeMask YDbMask FcacheCtr U32 Fdb uintptr FdoingRerun U8 FerrorAction U8 // bft expired: 2, bft explain: 2, bft changeCntOn: 1, bft runOnlyOnce: 1, bft usesStmtJournal: 1, bft readOnly: 1, bft bIsReader: 1 Fexpmask U32 FiCurrentTime I64 FiStatement int32 FiVdbeMagic U32 FlockMask YDbMask FminWriteFileFormat U8 FnChange int32 FnCursor int32 FnFkConstraint I64 FnFrame int32 FnMem int32 FnOp int32 FnOpAlloc int32 FnResColumn U16 FnStmtDefCons I64 FnStmtDefImmCons I64 FnVar YnVar FpAuxData uintptr FpDelFrame uintptr FpFrame uintptr FpFree uintptr FpNext uintptr FpParse uintptr FpPrev uintptr FpProgram uintptr FpResultSet uintptr FpVList uintptr Fpc int32 FprepFlags U8 Frc int32 FstartTime I64 FzErrMsg uintptr FzSql uintptr
A VdbeCursor is an superclass (a wrapper) for various cursor objects: * A b-tree cursor - In the main database or in an ephemeral database - On either an index or a table * A sorter * A virtual table * A one-row "pseudotable" stored in a single register FaAltMap uintptr FaOffset uintptr FaRow uintptr FaType [1]U32 FcacheStatus U32 FdeferredMoveto U8 FeCurType U8 FiDb I8 FiHdrOffset U32 // Bool isEphemeral: 1, Bool useRandomRowid: 1, Bool isOrdered: 1, Bool hasBeenDuped: 1 FisTable U8 FmovetoTarget I64 FnField I16 FnHdrParsed U16 FnullRow U8 FpAltCursor uintptr FpBtx uintptr FpKeyInfo uintptr FpayloadSize U32 FpgnoRoot Pgno FseekHit U16 FseekResult int32 FseqCount I64 FszRow U32 Fuc struct{FpCursor uintptr}
A VdbeCursor is an superclass (a wrapper) for various cursor objects: * A b-tree cursor - In the main database or in an ephemeral database - On either an index or a table * A sorter * A virtual table * A one-row "pseudotable" stored in a single register FaAltMap uintptr FaOffset uintptr FaRow uintptr FaType [1]U32 FcacheStatus U32 FdeferredMoveto U8 FeCurType U8 FiDb I8 FiHdrOffset U32 // Bool isEphemeral: 1, Bool useRandomRowid: 1, Bool isOrdered: 1, Bool hasBeenDuped: 1 FisTable U8 FmovetoTarget I64 FnField I16 FnHdrParsed U16 FnullRow U8 FpAltCursor uintptr FpBtx uintptr FpKeyInfo uintptr FpayloadSize U32 FpgnoRoot Pgno FseekHit U16 FseekResult int32 FseqCount I64 FszRow U32 Fuc struct{FpCursor uintptr}
When a sub-program is executed (OP_Program), a structure of this type is allocated to store the current value of the program counter, as well as the current memory cell array and various other frame specific values stored in the Vdbe struct. When the sub-program is finished, these values are copied back to the Vdbe from the VdbeFrame structure, restoring the state of the VM to as it was before the sub-program began executing. The memory for a VdbeFrame object is allocated and managed by a memory cell in the parent (calling) frame. When the memory cell is deleted or overwritten, the VdbeFrame object is not freed immediately. Instead, it is linked into the Vdbe.pDelFrame list. The contents of the Vdbe.pDelFrame list is deleted when the VM is reset in VdbeHalt(). The reason for doing this instead of deleting the VdbeFrame immediately is to avoid recursive calls to sqlite3VdbeMemRelease() when the memory cells belonging to the child frame are released. The currently executing frame is stored in Vdbe.pFrame. Vdbe.pFrame is set to NULL if the currently executing frame is the main program. FaMem uintptr FaOnce uintptr FaOp uintptr FanExec uintptr FapCsr uintptr FlastRowid I64 FnChange int32 FnChildCsr int32 FnChildMem int32 FnCursor int32 FnDbChange int32 FnMem int32 FnOp int32 FpAuxData uintptr FpParent uintptr Fpc int32 Ftoken uintptr Fv uintptr
When a sub-program is executed (OP_Program), a structure of this type is allocated to store the current value of the program counter, as well as the current memory cell array and various other frame specific values stored in the Vdbe struct. When the sub-program is finished, these values are copied back to the Vdbe from the VdbeFrame structure, restoring the state of the VM to as it was before the sub-program began executing. The memory for a VdbeFrame object is allocated and managed by a memory cell in the parent (calling) frame. When the memory cell is deleted or overwritten, the VdbeFrame object is not freed immediately. Instead, it is linked into the Vdbe.pDelFrame list. The contents of the Vdbe.pDelFrame list is deleted when the VM is reset in VdbeHalt(). The reason for doing this instead of deleting the VdbeFrame immediately is to avoid recursive calls to sqlite3VdbeMemRelease() when the memory cells belonging to the child frame are released. The currently executing frame is stored in Vdbe.pFrame. Vdbe.pFrame is set to NULL if the currently executing frame is the main program. FaMem uintptr FaOnce uintptr FaOp uintptr FanExec uintptr FapCsr uintptr FlastRowid I64 FnChange int32 FnChildCsr int32 FnChildMem int32 FnCursor int32 FnDbChange int32 FnMem int32 FnOp int32 FpAuxData uintptr FpParent uintptr Fpc int32 Ftoken uintptr Fv uintptr
Fopcode U8 Fp1 int32 Fp2 int32 Fp3 int32 Fp4 struct{_ [0]uint64; Fi int32; _ [4]byte} Fp4type int8 Fp5 U16
A single instruction of the virtual machine has an opcode and as many as three operands. The instruction is recorded as an instance of the following structure: Fopcode U8 Fp1 int32 Fp2 int32 Fp3 int32 Fp4 struct{_ [0]uint64; Fi int32; _ [4]byte} Fp4type int8 Fp5 U16
Fopcode U8 Fp1 int8 Fp2 int8 Fp3 int8
A smaller version of VdbeOp used for the VdbeAddOpList() function because it takes up less space. Fopcode U8 Fp1 int8 Fp2 int8 Fp3 int8
A VList object records a mapping between parameters/variables/wildcards in the SQL statement (such as $abc, @pqr, or :xyz) and the integer variable number associated with that parameter. See the format description on the sqlite3VListAdd() routine for more information. A VList is really just an array of integers.
type Vm_map_address_t = Uint64_t (basic type)
type Vm_map_offset_t = Uint64_t (basic type)
type Vm_map_size_t = Uint64_t (basic type)
A vm_offset_t is a type-neutral pointer, e.g. an offset into a virtual memory space.
A vm_size_t is the proper type for e.g. expressing the difference between two vm_offset_t entities.
type Vnode_t = uintptr (basic type)
type Vol_capabilities_set_t = ([...]T)
FbDeclared int32 FpPrior uintptr FpTab uintptr FpVTable uintptr
FbDeclared int32 FpPrior uintptr FpTab uintptr FpVTable uintptr
FaLock [8]U8 FaReadMark [5]U32 FnBackfill U32 FnBackfillAttempted U32 FnotUsed0 U32
FaLock [8]U8 FaReadMark [5]U32 FnBackfill U32 FnBackfillAttempted U32 FnotUsed0 U32
An instance of the WalHashLoc object is used to describe the location of a page hash table in the wal-index. This becomes the return value from walHashGet(). FaHash uintptr FaPgno uintptr FiZero U32
An instance of the WalHashLoc object is used to describe the location of a page hash table in the wal-index. This becomes the return value from walHashGet(). FaHash uintptr FaPgno uintptr FiZero U32
Object declarations FaCksum [2]U32 FaFrameCksum [2]U32 FaSalt [2]U32 FbigEndCksum U8 FiChange U32 FiVersion U32 FisInit U8 FmxFrame U32 FnPage U32 FszPage U16 Funused U32
Object declarations FaCksum [2]U32 FaFrameCksum [2]U32 FaSalt [2]U32 FbigEndCksum U8 FiChange U32 FiVersion U32 FisInit U8 FmxFrame U32 FnPage U32 FszPage U16 Funused U32
FaSegment [1]struct{FiNext int32; _ [4]byte; FaIndex uintptr; FaPgno uintptr; FnEntry int32; FiZero int32} FiPrior U32 FnSegment int32
FaSegment [1]struct{FiNext int32; _ [4]byte; FaIndex uintptr; FaPgno uintptr; FnEntry int32; FiZero int32} FiPrior U32 FnSegment int32
This structure is used to implement an iterator that loops through all frames in the WAL in database page order. Where two or more frames correspond to the same database page, the iterator visits only the frame most recently written to the WAL (in other words, the frame with the largest index). The internals of this structure are only accessed by: walIteratorInit() - Create a new iterator, walIteratorNext() - Step an iterator, walIteratorFree() - Free an iterator. This functionality is used by the checkpoint code (see walCheckpoint()). FaIndex uintptr FaPgno uintptr FiNext int32 FiZero int32 FnEntry int32
Information about the current state of the WAL file and where the next fsync should occur - passed from sqlite3WalFrames() into walWriteToLog(). FiSyncPoint Sqlite3_int64 FpFd uintptr FpWal uintptr FsyncFlags int32 FszPage int32
Information about the current state of the WAL file and where the next fsync should occur - passed from sqlite3WalFrames() into walWriteToLog(). FiSyncPoint Sqlite3_int64 FpFd uintptr FpWal uintptr FsyncFlags int32 FszPage int32
type Wchar_t = int32 (basic type)
Fwc WhereClause
Fwc WhereClause
Forward references Fa uintptr FaStatic [8]WhereTerm FhasOr U8 FnSlot int32 FnTerm int32 Fop U8 FpOuter uintptr FpWInfo uintptr
Forward references Fa uintptr FaStatic [8]WhereTerm FhasOr U8 FnSlot int32 FnTerm int32 Fop U8 FpOuter uintptr FpWInfo uintptr
A structure to keep track of all of the column values that are fixed to a known value due to WHERE clause constraints of the form COLUMN=VALUE. FapExpr uintptr FbHasAffBlob int32 FnChng int32 FnConst int32 FpOomFault uintptr FpParse uintptr
Context pointer passed down through the tree-walk. FapExpr uintptr FbHasAffBlob int32 FnChng int32 FnConst int32 FpOomFault uintptr FpParse uintptr
Each instance of this object records a change to a single node in an expression tree to cause that node to point to a column of an index rather than an expression or a virtual column. All such transformations need to be undone at the end of WHERE clause processing. Forig Expr FpExpr uintptr FpNext uintptr
Each instance of this object records a change to a single node in an expression tree to cause that node to point to a column of an index rather than an expression or a virtual column. All such transformations need to be undone at the end of WHERE clause processing. Forig Expr FpExpr uintptr FpNext uintptr
FaLTerm uintptr FaLTermSpace [3]uintptr FiSortIdx U8 FiTab U8 FmaskSelf Bitmask FnLSlot U16 FnLTerm U16 FnOut LogEst FnSkip U16 FpNextLoop uintptr Fprereq Bitmask FrRun LogEst FrSetup LogEst Fu struct{Fbtree struct{FnEq U16; FnBtm U16; FnTop U16; FnDistinctCol U16; FpIndex uintptr}} FwsFlags U32
FaLTerm uintptr FaLTermSpace [3]uintptr FiSortIdx U8 FiTab U8 FmaskSelf Bitmask FnLSlot U16 FnLTerm U16 FnOut LogEst FnSkip U16 FpNextLoop uintptr Fprereq Bitmask FrRun LogEst FrSetup LogEst Fu struct{Fbtree struct{FnEq U16; FnBtm U16; FnTop U16; FnDistinctCol U16; FpIndex uintptr}} FwsFlags U32
FbVarSelect int32 Fix [64]int32 Fn int32
FbVarSelect int32 Fix [64]int32 Fn int32
FnOut LogEst Fprereq Bitmask FrRun LogEst
FnOut LogEst Fprereq Bitmask FrRun LogEst
Findexable Bitmask Fwc WhereClause
Findexable Bitmask Fwc WhereClause
Fa [3]WhereOrCost Fn U16
Fa [3]WhereOrCost Fn U16
FeMatchOp U8 FeOperator U16 FiParent int32 FleftCursor int32 FnChild U8 FpExpr uintptr FpWC uintptr FprereqAll Bitmask FprereqRight Bitmask FtruthProb LogEst Fu struct{_ [0]uint64; Fx struct{FleftColumn int32; FiField int32}} FwtFlags U16
FeMatchOp U8 FeOperator U16 FiParent int32 FleftCursor int32 FnChild U8 FpExpr uintptr FpWC uintptr FprereqAll Bitmask FprereqRight Bitmask FtruthProb LogEst Fu struct{_ [0]uint64; Fx struct{FleftColumn int32; FiField int32}} FwtFlags U16
Fcsr int32 Freg int32
Fcsr int32 Freg int32
Context object passed through sqlite3WalkExprList() to selectWindowRewriteExprCb() by selectWindowRewriteEList(). FpSrc uintptr FpSub uintptr FpSubSelect uintptr FpTab uintptr FpWin uintptr
Context pointer passed down through the tree-walk. FpSrc uintptr FpSub uintptr FpSubSelect uintptr FpTab uintptr FpWin uintptr
FeEnd int32 FeFrmType int32 FeStart int32 FzFunc uintptr
Fa [1]Cte FbView int32 FnCte int32 FpOuter uintptr
Fa [1]Cte FbView int32 FnCte int32 FpOuter uintptr
type X__builtin_va_list = uintptr (basic type)
type X__darwin_blkcnt_t = X__int64_t (basic type)
type X__darwin_blksize_t = X__int32_t (basic type)
type X__darwin_clock_t = uint64 (basic type)
type X__darwin_ct_rune_t = int32 (basic type)
type X__darwin_dev_t = X__int32_t (basic type)
// unsigned short __invalid: 1, unsigned short __denorm: 1, unsigned short __zdiv: 1, unsigned short __ovrfl: 1, unsigned short __undfl: 1, unsigned short __precis: 1, unsigned short : 2, unsigned short __pc: 2, unsigned short __rc: 2, unsigned short : 1, unsigned short : 3
// unsigned short __invalid: 1, unsigned short __denorm: 1, unsigned short __zdiv: 1, unsigned short __ovrfl: 1, unsigned short __undfl: 1, unsigned short __precis: 1, unsigned short : 2, unsigned short __pc: 2, unsigned short __rc: 2, unsigned short : 1, unsigned short : 3
type X__darwin_fsblkcnt_t = uint32 (basic type)
type X__darwin_fsfilcnt_t = uint32 (basic type)
type X__darwin_gid_t = X__uint32_t (basic type)
type X__darwin_id_t = X__uint32_t (basic type)
type X__darwin_ino64_t = X__uint64_t (basic type)
type X__darwin_ino_t = X__darwin_ino64_t (basic type)
type X__darwin_intptr_t = int64 (basic type)
F__mbstate8 [128]int8
type X__darwin_mode_t = X__uint16_t (basic type)
type X__darwin_natural_t = uint32 (basic type)
type X__darwin_nl_item = int32 (basic type)
type X__darwin_off_t = X__int64_t (basic type)
type X__darwin_pid_t = X__int32_t (basic type)
F__opaque [56]int8 F__sig int64
F__opaque [40]int8 F__sig int64
F__opaque [8]int8 F__sig int64
type X__darwin_pthread_key_t = uint64 (basic type)
F__opaque [56]int8 F__sig int64
F__opaque [8]int8 F__sig int64
F__opaque [8]int8 F__sig int64
F__opaque [192]int8 F__sig int64
F__opaque [16]int8 F__sig int64
type X__darwin_pthread_t = uintptr (basic type)
type X__darwin_ptrdiff_t = int64 (basic type)
type X__darwin_rune_t = X__darwin_wchar_t (basic type)
type X__darwin_sigset_t = X__uint32_t (basic type)
type X__darwin_size_t = uint64 (basic type)
type X__darwin_socklen_t = X__uint32_t (basic type)
type X__darwin_ssize_t = int64 (basic type)
type X__darwin_suseconds_t = X__int32_t (basic type)
type X__darwin_time_t = int64 (basic type)
type X__darwin_uid_t = X__uint32_t (basic type)
type X__darwin_useconds_t = X__uint32_t (basic type)
type X__darwin_uuid_string_t = ([...]T)
type X__darwin_uuid_t = ([...]T)
type X__darwin_wchar_t = int32 (basic type)
type X__darwin_wctrans_t = int32 (basic type)
type X__darwin_wctype_t = X__uint32_t (basic type)
type X__darwin_wint_t = int32 (basic type)
type X__float128 = float64 (basic type)
type X__gnuc_va_list = X__builtin_va_list (basic type)
Fhi int64 Flo int64
type X__int16_t = int16 (basic type)
type X__int32_t = int32 (basic type)
type X__int64_t = int64 (basic type)
type X__int8_t = int8 (basic type)
mbstate_t is an opaque object to keep conversion state, during multibyte stream conversions. The content must not be referenced by user programs. F__mbstate8 [128]int8
Fhi uint64 Flo uint64
type X__uint16_t = uint16 (basic type)
type X__uint32_t = uint32 (basic type)
type X__uint64_t = uint64 (basic type)
type X__uint8_t = uint8 (basic type)
The yDbMask datatype for the bitmask of all attached databases.
The datatype ynVar is a signed integer, either 16-bit or 32-bit. Usually it is 16-bits. But if SQLITE_MAX_VARIABLE_NUMBER is greater than 32767 we have to make it 32-bit. 16-bit is preferred because it uses less memory in the Expr object, which is a big memory user in systems with lots of prepared statements. And few applications need more than about 10 or 20 variables. But some extreme users want to have prepared statements with over 32766 variables, and for them the option is available (at compile-time).
The next sections is a series of control #defines. various aspects of the generated parser. YYCODETYPE is the data type used to store the integer codes that represent terminal and non-terminal symbols. "unsigned char" is used if there are fewer than 256 symbols. Larger types otherwise. YYNOCODE is a number of type YYCODETYPE that is not used for any terminal or nonterminal symbol. YYFALLBACK If defined, this indicates that one or more tokens (also known as: "terminal symbols") have fall-back values which should be used if the original symbol would not parse. This permits keywords to sometimes be used as identifiers, for example. YYACTIONTYPE is the data type used for "action codes" - numbers that indicate what to do in response to the next token. sqlite3ParserTOKENTYPE is the data type used for minor type for terminal symbols. Background: A "minor type" is a semantic value associated with a terminal or non-terminal symbols. For example, for an "ID" terminal symbol, the minor type might be the name of the identifier. Each non-terminal can have a different minor type. Terminal symbols all have the same minor type, though. This macros defines the minor type for terminal symbols. YYMINORTYPE is the data type used for all minor types. This is typically a union of many types, one of which is sqlite3ParserTOKENTYPE. The entry in the union for terminal symbols is called "yy0". YYSTACKDEPTH is the maximum depth of the parser's stack. If zero the stack is dynamically sized using realloc() sqlite3ParserARG_SDECL A static variable declaration for the %extra_argument sqlite3ParserARG_PDECL A parameter declaration for the %extra_argument sqlite3ParserARG_PARAM Code to pass %extra_argument as a subroutine parameter sqlite3ParserARG_STORE Code to store %extra_argument into yypParser sqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser sqlite3ParserCTX_* As sqlite3ParserARG_ except for %extra_context YYERRORSYMBOL is the code number of the error symbol. If not defined, then do no error processing. YYNSTATE the combined number of states. YYNRULE the number of rules in the grammar YYNTOKEN Number of terminal symbols YY_MAX_SHIFT Maximum value for shift actions YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions YY_ERROR_ACTION The yy_action[] code for syntax error YY_ACCEPT_ACTION The yy_action[] code for accept YY_NO_ACTION The yy_action[] code for no-op YY_MIN_REDUCE Minimum value for reduce actions YY_MAX_REDUCE Maximum value for reduce actions ************ Begin control #defines **************************************** Fyyinit int32
FpParse uintptr Fyystack [100]YyStackEntry FyystackEnd uintptr Fyytos uintptr
Fmajor uint16 Fminor YYMINORTYPE Fstateno uint16
Package-Level Functions (total 3207, in which 1238 are exported)
Format and write a message to the log if logging is enabled.
This function is called as part of restating an RBU vacuum when the current operation is writing content to an index. If possible, it queries the target index b-tree for the largest key already written to it, then composes and returns an expression that can be used in a WHERE clause to select the remaining required rows from the source table. It is only possible to return such an expression if: * The index contains no DESC columns, and * The last key written to the index before the operation was suspended does not contain any NULL values. The expression is of the form: (index-field1, index-field2, ...) > (?, ?, ...) except that the "?" placeholders are replaced with literal values. If the expression cannot be created, NULL is returned. In this case, the caller has to use an OFFSET clause to extract only the required rows from the sourct table, just as it does for an RBU update operation.
Allocate or return the aggregate context for a user function. A new context is allocated on the first call. Subsequent calls return the same context that was returned on prior calls.
Return the number of times the Step function of an aggregate has been called. This function is deprecated. Do not use it for new code. It is provide only to avoid breaking legacy code. New aggregate function implementations should keep their own counts within their aggregate context.
Register a statically linked extension that is automatically loaded by every new database connection.
Release all resources associated with an sqlite3_backup* handle.
Create an sqlite3_backup process to copy the contents of zSrcDb from connection handle pSrcDb to zDestDb in pDestDb. If successful, return a pointer to the new sqlite3_backup object. If an error occurs, NULL is returned and an error code and error message stored in database handle pDestDb.
Return the total number of pages in the source database as of the most recent call to sqlite3_backup_step().
Return the number of pages still to be backed up as of the most recent call to sqlite3_backup_step().
Copy nPage pages from the source b-tree to the destination.
Bind a blob value to an SQL statement variable.
func Xsqlite3_bind_blob64(tls *libc.TLS, pStmt uintptr, i int32, zData uintptr, nData Sqlite3_uint64, xDel uintptr) int32
func Xsqlite3_bind_double(tls *libc.TLS, pStmt uintptr, i int32, rValue float64) int32
func Xsqlite3_bind_int(tls *libc.TLS, p uintptr, i int32, iValue int32) int32
Return the number of wildcards that can be potentially bound to. This routine is added to support DBD::SQLite.
Return the name of a wildcard parameter. Return NULL if the index is out of range or if the wildcard is unnamed. The result is always UTF-8.
func Xsqlite3_bind_pointer(tls *libc.TLS, pStmt uintptr, i int32, pPtr uintptr, zPTtype uintptr, xDestructor uintptr) int32
func Xsqlite3_bind_text(tls *libc.TLS, pStmt uintptr, i int32, zData uintptr, nData int32, xDel uintptr) int32
func Xsqlite3_bind_text16(tls *libc.TLS, pStmt uintptr, i int32, zData uintptr, nData int32, xDel uintptr) int32
func Xsqlite3_bind_text64(tls *libc.TLS, pStmt uintptr, i int32, zData uintptr, nData Sqlite3_uint64, xDel uintptr, enc uint8) int32
func Xsqlite3_bind_value(tls *libc.TLS, pStmt uintptr, i int32, pValue uintptr) int32
Query a blob handle for the size of the data. The Incrblob.nByte field is fixed for the lifetime of the Incrblob so no mutex is required for access.
Close a blob handle that was previously created using sqlite3_blob_open().
Open a blob handle.
Read data from a blob handle.
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.
Write data to a blob handle.
This routine sets the busy callback for an Sqlite database to the given callback function with the given argument.
This routine installs a default busy handler that waits for the specified number of milliseconds before returning 0.
Cancel a prior call to sqlite3_auto_extension. Remove xInit from the set of routines that is invoked for each new database connection, if it is currently on the list. If xInit is not on the list, then this routine is a no-op. Return 1 if xInit was found on the list and removed. Return 0 if xInit was not on the list.
Return the number of changes in the most recent call to sqlite3_exec().
Set all the parameters in the compiled SQL statement to NULL.
Two variations on the public interface for closing a database connection. The sqlite3_close() version returns SQLITE_BUSY and leaves the connection open if there are unfinalized prepared statements or unfinished sqlite3_backups. The sqlite3_close_v2() version forces the connection to become a zombie if there are unclosed resources, and arranges for deallocation when the last prepare statement or sqlite3_backup closes.
Register a collation sequence factory callback with the database handle db. Replace any previously installed collation sequence factory.
Register a collation sequence factory callback with the database handle db. Replace any previously installed collation sequence factory.
*************************** sqlite3_column_ ******************************* The following routines are used to access elements of the current row in the result set.
Return the number of columns in the result set for the statement pStmt.
Return the name of the database from which a result column derives. NULL is returned if the result column is an expression or constant or anything else which is not an unambiguous reference to a database column.
Return the column declaration type (if applicable) of the 'i'th column of the result set of SQL statement pStmt.
Return the name of the Nth column of the result set returned by SQL statement pStmt.
Return the name of the table column from which a result column derives. NULL is returned if the result column is an expression or constant or anything else which is not an unambiguous reference to a database column.
Return the name of the table from which a result column derives. NULL is returned if the result column is an expression or constant or anything else which is not an unambiguous reference to a database column.
Register a function to be invoked when a transaction commits. If the invoked function returns non-zero, then the commit becomes a rollback.
Return the N-th compile-time option string. If N is out of range, return a NULL pointer.
Given the name of a compile-time option, return true if that option was used and false if not. The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix is not required for a match.
Return TRUE if the given SQL string ends in a semicolon. Special handling is require for CREATE TRIGGER statements. Whenever the CREATE TRIGGER keywords are seen, the statement must end with ";END;". This implementation uses a state machine with 8 states: (0) INVALID We have not yet seen a non-whitespace character. (1) START At the beginning or end of an SQL statement. This routine returns 1 if it ends in the START state and 0 if it ends in any other state. (2) NORMAL We are in the middle of statement which ends with a single semicolon. (3) EXPLAIN The keyword EXPLAIN has been seen at the beginning of a statement. (4) CREATE The keyword CREATE has been seen at the beginning of a statement, possibly preceded by EXPLAIN and/or followed by TEMP or TEMPORARY (5) TRIGGER We are in the middle of a trigger definition that must be ended by a semicolon, the keyword END, and another semicolon. (6) SEMI We've seen the first semicolon in the ";END;" that occurs at the end of a trigger definition. (7) END We've seen the ";END" of the ";END;" that occurs at the end of a trigger definition. Transitions between states above are determined by tokens extracted from the input. The following tokens are significant: (0) tkSEMI A semicolon. (1) tkWS Whitespace. (2) tkOTHER Any other SQL token. (3) tkEXPLAIN The "explain" keyword. (4) tkCREATE The "create" keyword. (5) tkTEMP The "temp" or "temporary" keyword. (6) tkTRIGGER The "trigger" keyword. (7) tkEND The "end" keyword. Whitespace never causes a state transition and is always ignored. This means that a SQL string of all whitespace is invalid. If we compile with SQLITE_OMIT_TRIGGER, all of the computation needed to recognize the end of a trigger can be omitted. All we have to do is look for a semicolon that is not part of an string or comment.
This routine is the same as the sqlite3_complete() routine described above, except that the parameter is required to be UTF-16 encoded, not UTF-8.
This API allows applications to modify the global configuration of the SQLite library at run-time. This routine should only be called when there are no outstanding database connections or memory allocations. This routine is not threadsafe. Failure to heed these warnings can lead to unpredictable behavior.
Extract the user data from a sqlite3_context structure and return a pointer to it. IMPLEMENTATION-OF: R-46798-50301 The sqlite3_context_db_handle() interface returns a copy of the pointer to the database connection (the 1st parameter) of the sqlite3_create_function() and sqlite3_create_function16() routines that originally registered the application defined function.
Register a new collation sequence with the database handle db.
Register a new collation sequence with the database handle db.
Register a new collation sequence with the database handle db.
Allocate memory to hold names for a database, journal file, WAL file, and query parameters. The pointer returned is valid for use by sqlite3_filename_database() and sqlite3_uri_parameter() and related functions. Memory layout must be compatible with that generated by the pager and expected by sqlite3_uri_parameter() and databaseName().
Create new user functions.
func Xsqlite3_create_function16(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg int32, eTextRep int32, p uintptr, xSFunc uintptr, xStep uintptr, xFinal uintptr) int32
func Xsqlite3_create_function_v2(tls *libc.TLS, db uintptr, zFunc uintptr, nArg int32, enc int32, p uintptr, xSFunc uintptr, xStep uintptr, xFinal uintptr, xDestroy uintptr) int32
External API function used to create a new virtual-table module.
External API function used to create a new virtual-table module.
func Xsqlite3_create_window_function(tls *libc.TLS, db uintptr, zFunc uintptr, nArg int32, enc int32, p uintptr, xStep uintptr, xFinal uintptr, xValue uintptr, xInverse uintptr, xDestroy uintptr) int32
Return the number of values available from the current row of the currently executing statement pStmt.
Return the sqlite3_file for the main database given the name of the corresonding WAL or Journal name as passed into xOpen.
Flush any dirty pages in the pager-cache for any attached database to disk.
Configuration settings for an individual database connection
Return the filename of the database associated with a database connection.
Return the sqlite3* database handle to which the prepared statement given in the argument belongs. This is the same database handle that was the first argument to the sqlite3_prepare() that was used to create the statement in the first place.
Return the mutex associated with a database connection.
Return 1 if database is read-only or 0 if read/write. Return -1 if no such database exists.
Free up as much memory as we can from the given database connection.
Query status information for a single database connection
This function is used to set the schema of a virtual table. It is only valid to call this function from within the xCreate() or xConnect() of a virtual table module.
Convert zSchema to a MemDB and initialize its content.
External API to drop all virtual-table modules, except those named on the azNames list.
Enable or disable extension loading. Extension loading is disabled by default so as not to open security holes in older applications.
Enable or disable the shared pager and schema features. This routine has no effect on existing database connections. The shared cache setting effects only future calls to sqlite3_open(), sqlite3_open16(), or sqlite3_open_v2().
Return the most recent error code generated by an SQLite routine. If NULL is passed to this function, we assume a malloc() failed during sqlite3_open().
Return UTF-8 encoded English language explanation of the most recent error.
Return UTF-16 encoded English language explanation of the most recent error.
Return a string that describes the kind of error specified in the argument. For now, this simply calls the internal sqlite3ErrStr() function.
Execute SQL code. Return one of the SQLITE_ success/failure codes. Also write an error message into memory obtained from malloc() and make *pzErrMsg point to that message. If the SQL is a query, then for each row in the query result the xCallback() function is called. pArg becomes the first argument to xCallback(). If xCallback=NULL then no callback is invoked, even for queries.
Return the SQL associated with a prepared statement with bound parameters expanded. Space to hold the returned string is obtained from sqlite3_malloc(). The caller is responsible for freeing the returned string by passing it to sqlite3_free(). The SQLITE_TRACE_SIZE_LIMIT puts an upper bound on the size of expanded bound parameters.
Return TRUE (non-zero) of the statement supplied as an argument needs to be recompiled. A statement needs to be recompiled whenever the execution environment changes in a way that would alter the program that sqlite3_prepare() generates. For example, if new functions or collating sequences are registered or if an authorizer function is added or changed.
Enable or disable the extended result codes.
Invoke the xFileControl method on a particular database.
Translate a filename that was handed to a VFS routine into the corresponding database, journal, or WAL file. It is an error to pass this routine a filename string that was not passed into the VFS from the SQLite core. Doing so is similar to passing free() a pointer that was not obtained from malloc() - it is an error that we cannot easily detect but that will likely cause memory corruption.
The following routine destroys a virtual machine that is created by the sqlite3_compile() routine. The integer returned is an SQLITE_ success/failure code that describes the result of executing the virtual machine. This routine sets the error code and string returned by sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16().
Free memory previously obtained from sqlite3Malloc().
Free memory obtained from sqlite3_create_filename(). It is a severe error to call this routine with any parameter other than a pointer previously obtained from sqlite3_create_filename() or a NULL pointer.
This routine frees the space the sqlite3_get_table() malloced.
Test to see whether or not the database connection is in autocommit mode. Return TRUE if it is and FALSE if not. Autocommit mode is on by default. Autocommit is disabled by a BEGIN statement and reenabled by the next COMMIT or ROLLBACK.
Return the auxiliary data pointer, if any, for the iArg'th argument to the user-function defined by pCtx. The left-most argument is 0. Undocumented behavior: If iArg is negative then access a cache of auxiliary data pointers that is available to all functions within a single prepared statement. The iArg values must match.
Query the database. But instead of invoking a callback for each row, malloc() for space to hold the result and return the entire results at the conclusion of the call. The result that is written to ***pazResult is held in memory obtained from malloc(). But the caller cannot free this memory directly. Instead, the entire table should be passed to sqlite3_free_table() when the calling procedure is finished using it.
This function is now an anachronism. It used to be used to recover from a malloc() failure, but SQLite now does this automatically.
Set the hard heap-size limit for the library. An argument of zero disables the hard heap limit. A negative argument is a no-op used to obtain the return value without affecting the hard heap limit. The return value is the value of the hard heap limit just prior to calling this interface. Setting the hard heap limit will also activate the soft heap limit and constrain the soft heap limit to be no more than the hard heap limit.
Initialize SQLite. This routine must be called to initialize the memory allocation, VFS, and mutex subsystems prior to doing any serious work with SQLite. But as long as you do not compile with SQLITE_OMIT_AUTOINIT this routine will be called automatically by key routines such as sqlite3_open(). This routine is a no-op except on its very first call for the process, or for the first call after a call to sqlite3_shutdown. The first thread to call this routine runs the initialization to completion. If subsequent threads call this routine before the first thread has finished the initialization process, then the subsequent threads must block until the first thread finishes with the initialization. The first thread might call this routine recursively. Recursive calls to this routine should not block, of course. Otherwise the initialization process would never complete. Let X be the first thread to enter this routine. Let Y be some other thread. Then while the initial invocation of this routine by X is incomplete, it is required that: * Calls to this routine from Y must block until the outer-most call by X completes. * Recursive calls to this routine from thread X return immediately without blocking.
Cause any pending operation to stop at its earliest opportunity.
func Xsqlite3_keyword_check(tls *libc.TLS, zName uintptr, nName int32) int32
func Xsqlite3_keyword_name(tls *libc.TLS, i int32, pzName uintptr, pnName uintptr) int32
Return the ROWID of the most recent insert
IMPLEMENTATION-OF: R-53536-42575 The sqlite3_libversion() function returns a pointer to the to the sqlite3_version[] string constant.
IMPLEMENTATION-OF: R-35210-63508 The sqlite3_libversion_number() function returns an integer equal to SQLITE_VERSION_NUMBER.
Change the value of a limit. Report the old value. If an invalid limit index is supplied, report -1. Make no changes but still report the old value if the new limit is negative. A new lower limit does not shrink existing constructs. It merely prevents new constructs that exceed the limit from forming.
func Xsqlite3_load_extension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintptr, pzErrMsg uintptr) int32
Format and write a message to the log if logging is enabled.
This version of the memory allocation is for use by the application. First make sure the memory subsystem is initialized, then do the allocation.
Deprecated external interface. It used to set an alarm callback that was invoked when memory usage grew too large. Now it is a no-op.
Return the maximum amount of memory that has ever been checked out since either the beginning of this process or since the most recent reset.
Return the amount of memory currently checked out.
Print into memory obtained from sqlite3_malloc()(). Omit the internal %-conversion extensions.
Retrieve a pointer to a static mutex or allocate a new dynamic one.
Obtain the mutex p. If some other thread already has the mutex, block until it can be obtained.
Free a dynamic mutex.
The sqlite3_mutex_leave() routine exits a mutex that was previously entered by the same thread. The behavior is undefined if the mutex is not currently entered. If a NULL pointer is passed as an argument this function is a no-op.
Obtain the mutex p. If successful, return SQLITE_OK. Otherwise, if another thread holds the mutex and it cannot be obtained, return SQLITE_BUSY.
Return a pointer to the next prepared statement after pStmt associated with database connection pDb. If pStmt is NULL, return the first prepared statement for the database connection. Return NULL if there are no more.
Open a new database handle.
Open a new database handle.
func Xsqlite3_open_v2(tls *libc.TLS, filename uintptr, ppDb uintptr, flags int32, zVfs uintptr) int32
Shutdown the operating system interface. Some operating systems might need to do some cleanup in this routine, to release dynamically allocated objects. But not on unix. This routine is a no-op for unix.
Initialize the operating system interface. This routine registers all VFS implementations for unix-like operating systems. This routine, and the sqlite3_os_end() routine that follows, should be the only routines in this file that are visible from other files. This routine is called once during SQLite initialization and by a single thread. The memory allocation and mutex subsystems have not necessarily been initialized when this routine is called, and so they should not be used.
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.
Two versions of the official API. Legacy and new use. In the legacy version, the original SQL text is not saved in the prepared statement and so if a schema change occurs, SQLITE_SCHEMA is returned by sqlite3_step(). In the new version, the original SQL text is retained and the statement is automatically recompiled if an schema change occurs.
Two versions of the official API. Legacy and new use. In the legacy version, the original SQL text is not saved in the prepared statement and so if a schema change occurs, SQLITE_SCHEMA is returned by sqlite3_step(). In the new version, the original SQL text is retained and the statement is automatically recompiled if an schema change occurs.
func Xsqlite3_prepare16_v2(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, ppStmt uintptr, pzTail uintptr) int32
func Xsqlite3_prepare16_v3(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prepFlags uint32, ppStmt uintptr, pzTail uintptr) int32
func Xsqlite3_prepare_v2(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, ppStmt uintptr, pzTail uintptr) int32
func Xsqlite3_prepare_v3(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prepFlags uint32, ppStmt uintptr, pzTail uintptr) int32
This function is designed to be called from within a pre-update callback only.
This function is called from within a pre-update callback to retrieve the number of columns in the row being updated, deleted or inserted.
This function is designed to be called from within a pre-update callback only. It returns zero if the change that caused the callback was made immediately by a user SQL statement. Or, if the change was made by a trigger program, it returns the number of trigger programs currently on the stack (1 for a top-level trigger, 2 for a trigger fired by a top-level trigger etc.). For the purposes of the previous paragraph, a foreign key CASCADE, SET NULL or SET DEFAULT action is considered a trigger.
Register a callback to be invoked each time a row is updated, inserted or deleted using this database connection.
This function is called from within a pre-update callback to retrieve a field of the row currently being updated or inserted.
This function is called from within a pre-update callback to retrieve a field of the row currently being updated or deleted.
Register a profile function. The pArg from the previously registered profile function is returned. A NULL profile function means that no profiling is executes. A non-NULL profile is a pointer to a function that is invoked at the conclusion of each SQL statement that is run.
This routine sets the progress callback for an Sqlite database to the given callback function with the given argument. The progress callback will be invoked every nOps opcodes.
Return N random bytes.
The public interface to sqlite3Realloc. Make sure that the memory subsystem is initialized prior to invoking sqliteRealloc.
Attempt to release up to n bytes of non-essential memory currently held by SQLite. An example of non-essential memory is memory used to cache database pages that are not currently in use.
Terminate the current execution of an SQL statement and reset it back to its starting state so that it can be reused. A success code from the prior execution is returned. This routine sets the error code and string returned by sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16().
Reset the automatic extension loading mechanism.
func Xsqlite3_result_blob(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, xDel uintptr)
func Xsqlite3_result_error_code(tls *libc.TLS, pCtx uintptr, errCode int32)
An SQLITE_NOMEM error.
Force an SQLITE_TOOBIG error.
func Xsqlite3_result_int(tls *libc.TLS, pCtx uintptr, iVal int32)
func Xsqlite3_result_int64(tls *libc.TLS, pCtx uintptr, iVal I64)
func Xsqlite3_result_pointer(tls *libc.TLS, pCtx uintptr, pPtr uintptr, zPType uintptr, xDestructor uintptr)
func Xsqlite3_result_subtype(tls *libc.TLS, pCtx uintptr, eSubtype uint32)
func Xsqlite3_result_text(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, xDel uintptr)
func Xsqlite3_result_value(tls *libc.TLS, pCtx uintptr, pValue uintptr)
Register a callback to be invoked each time a transaction is rolled back by this database connection.
Register a new geometry function for use with the r-tree MATCH operator.
Register a new 2nd-generation geometry function for use with the r-tree MATCH operator.
Return the serialization of a database
Set or clear the access authorization function. The access authorization function is be called during the compilation phase to verify that the user has read and/or write access permission on various fields of the database. The first argument to the auth function is a copy of the 3rd argument to this routine. The second argument to the auth function is one of these constants: SQLITE_CREATE_INDEX SQLITE_CREATE_TABLE SQLITE_CREATE_TEMP_INDEX SQLITE_CREATE_TEMP_TABLE SQLITE_CREATE_TEMP_TRIGGER SQLITE_CREATE_TEMP_VIEW SQLITE_CREATE_TRIGGER SQLITE_CREATE_VIEW SQLITE_DELETE SQLITE_DROP_INDEX SQLITE_DROP_TABLE SQLITE_DROP_TEMP_INDEX SQLITE_DROP_TEMP_TABLE SQLITE_DROP_TEMP_TRIGGER SQLITE_DROP_TEMP_VIEW SQLITE_DROP_TRIGGER SQLITE_DROP_VIEW SQLITE_INSERT SQLITE_PRAGMA SQLITE_READ SQLITE_SELECT SQLITE_TRANSACTION SQLITE_UPDATE The third and fourth arguments to the auth function are the name of the table and the column that are being accessed. The auth function should return either SQLITE_OK, SQLITE_DENY, or SQLITE_IGNORE. If SQLITE_OK is returned, it means that access is allowed. SQLITE_DENY means that the SQL statement will never-run - the sqlite3_exec() call will return with an error. SQLITE_IGNORE means that the SQL statement should run but attempts to read the specified column will return NULL and attempts to write the column will be ignored. Setting the auth function to NULL disables this hook. The default setting of the auth function is NULL.
Set the auxiliary data pointer and delete function, for the iArg'th argument to the user-function defined by pCtx. Any previous value is deleted by calling the delete function specified when it was set. The left-most argument is 0. Undocumented behavior: If iArg is negative then make the data available to all functions within the current prepared statement using iArg as an access code.
Set the value returned by the sqlite3_last_insert_rowid() API function.
Undo the effects of sqlite3_initialize(). Must not be called while there are outstanding database connections or memory allocations or while any part of SQLite is otherwise in use in any thread. This routine is not threadsafe. But it is safe to invoke this routine on when SQLite is already shut down. If SQLite is already shut down when this routine is invoked, then this routine is a harmless no-op.
Sleep for a little while. Return the amount of time slept.
Return a +ve value if snapshot p1 is newer than p2. A -ve value if p1 is older than p2 and zero if p1 and p2 are the same snapshot.
Free a snapshot handle obtained from sqlite3_snapshot_get().
Obtain a snapshot handle for the snapshot of database zDb currently being read by handle db.
Open a read-transaction on the snapshot idendified by pSnapshot.
Recover as many snapshots as possible from the wal file associated with schema zDb of database db.
func Xsqlite3_snprintf(tls *libc.TLS, n int32, zBuf uintptr, zFormat uintptr, va uintptr) uintptr
Set the soft heap-size limit for the library. An argument of zero disables the limit. A negative argument is a no-op used to obtain the return value. The return value is the value of the heap limit just before this interface was called. If the hard heap limit is enabled, then the soft heap limit cannot be disabled nor raised above the hard heap limit.
************* End of stmt.c *********************************************** Return the source-id for this library
Return the SQL associated with a prepared statement
func Xsqlite3_status(tls *libc.TLS, op int32, pCurrent uintptr, pHighwater uintptr, resetFlag int32) int32
Query status information.
This is the top-level implementation of sqlite3_step(). Call sqlite3Step() to do most of the work. If a schema error occurs, call sqlite3Reprepare() and try again.
Return true if the prepared statement is in need of being reset.
Return 1 if the statement is an EXPLAIN and return 2 if the statement is an EXPLAIN QUERY PLAN
Return true if the prepared statement is guaranteed to not modify the database.
Return the value of a status counter for a prepared statement
Append N bytes of text from z to the StrAccum object. Increase the size of the memory allocation for StrAccum if necessary.
Append the complete text of zero-terminated string z[] to the p string.
Append N copies of character c to the given string buffer.
variable-argument wrapper around sqlite3_str_vappendf(). The bFlags argument can contain the bit SQLITE_PRINTF_INTERNAL enable internal formats.
Return any error code associated with p
Finalize a string created using sqlite3_str_new().
Return the current length of p in bytes
Allocate and initialize a new dynamic string object
Reset an StrAccum string. Reclaim all malloced memory.
Return the current value for p
Render a string given by "fmt" into the StrAccum object.
The sqlite3_strglob() interface. Return 0 on a match (like strcmp()) and non-zero if there is no match.
Some systems have stricmp(). Others have strcasecmp(). Because there is no consistency, we will define our own. IMPLEMENTATION-OF: R-30243-02494 The sqlite3_stricmp() and sqlite3_strnicmp() APIs allow applications and extensions to compare the contents of two buffers containing UTF-8 strings in a case-independent fashion, using the same definition of "case independence" that SQLite uses internally when comparing identifiers.
The sqlite3_strlike() interface. Return 0 on a match and non-zero for a miss - like strcmp().
func Xsqlite3_strnicmp(tls *libc.TLS, zLeft uintptr, zRight uintptr, N int32) int32
Return meta information about a specific column of a database table. See comment in sqlite3.h (sqlite.h.in) for details.
Interface to the testing logic.
This is a convenience routine that makes sure that all thread-specific data for this thread has been deallocated. SQLite no longer uses thread-specific data so this routine is now a no-op. It is retained for historical compatibility.
IMPLEMENTATION-OF: R-20790-14025 The sqlite3_threadsafe() function returns zero if and only if SQLite was compiled with mutexing code omitted due to the SQLITE_THREADSAFE compile-time option being set to 0.
Return the number of changes since the database handle was opened.
Register a trace function. The pArg from the previously registered trace is returned. A NULL trace function means that no tracing is executes. A non-NULL trace is a pointer to a function that is invoked at the start of each SQL statement.
Register a trace callback using the version-2 interface.
Deprecated external interface. Internal/core SQLite code should call sqlite3TransferBindings. It is misuse to call this routine with statements from different database connections. But as this is a deprecated interface, we will not bother to check for that condition. If the two statements contain a different number of bindings, then an SQLITE_ERROR is returned. Nothing else can go wrong, so otherwise SQLITE_OK is returned.
Return the transaction state for a single databse, or the maximum transaction state over all attached databases if zSchema is null.
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.
Register a callback to be invoked each time a row is updated, inserted or deleted using this database connection.
Return a boolean value for a query parameter.
Return a 64-bit integer value for a query parameter.
Return a pointer to the name of Nth query parameter of the filename.
This is a utility routine, useful to VFS implementations, that checks to see if a database file was a URI that contained a specific query parameter, and if so obtains the value of the query parameter. The zFilename argument is the filename pointer passed into the xOpen() method of a VFS implementation. The zParam argument is the name of the query parameter we seek. This routine returns the value of the zParam parameter if it exists. If the parameter does not exist, this routine returns a NULL pointer.
Extract the user data from a sqlite3_context structure and return a pointer to it.
*************************** sqlite3_value_ ******************************* The following routines extract information from a Mem or sqlite3_value structure.
Make a copy of an sqlite3_value object
Destroy an sqlite3_value object previously obtained from sqlite3_value_dup().
Return true if a parameter value originated from an sqlite3_bind()
Return true if a parameter to xUpdate represents an unchanged column
Try to convert the type of a function argument or a result column into a numeric representation. Use either INTEGER or REAL whichever is appropriate. But only do the conversion if it is possible without loss of information and return the revised type of the argument.
EVIDENCE-OF: R-12793-43283 Every value in SQLite has one of five fundamental datatypes: 64-bit signed integer 64-bit IEEE floating point number string BLOB NULL
Locate a VFS by name. If no name is given, simply return the first VFS on the list.
Register a VFS with the system. It is harmless to register the same VFS multiple times. The new VFS becomes the default if makeDflt is true.
Unregister a VFS so that it is no longer accessible.
Print into memory obtained from sqlite3_malloc(). Omit the internal %-conversion extensions.
sqlite3_snprintf() works like snprintf() except that it ignores the current locale settings. This is important for SQLite because we are not able to use a "," as the decimal point in place of "." as specified by some locales. Oops: The first two arguments of sqlite3_snprintf() are backwards from the snprintf() standard. Unfortunately, it is too late to change this without breaking compatibility, so we just have to live with the mistake. sqlite3_vsnprintf() is the varargs version.
If this function is invoked from within an xBestIndex() callback, it returns a pointer to a buffer containing the name of the collation sequence associated with element iCons of the sqlite3_index_info.aConstraint array. Or, if iCons is out of range or there is no active xBestIndex call, return NULL.
Call from within the xCreate() or xConnect() methods to provide the SQLite core with additional information about the behavior of the virtual table being implemented.
If this routine is invoked from within an xColumn method of a virtual table, then it returns true if and only if the the call is during an UPDATE operation and the value of the column will not be modified by the UPDATE. If this routine is called from any context other than within the xColumn method of a virtual table, then the return value is meaningless and arbitrary. Virtual table implements might use this routine to optimize their performance by substituting a NULL result, or some other light-weight value, as a signal to the xUpdate routine that the column is unchanged.
Return the ON CONFLICT resolution mode in effect for the virtual table update operation currently in progress. The results of this routine are undefined unless it is called from within an xUpdate method.
Configure an sqlite3_wal_hook() callback to automatically checkpoint a database after committing a transaction if there are nFrame or more frames in the log file. Passing zero or a negative value as the nFrame parameter disables automatic checkpoints entirely. The callback registered by this function replaces any existing callback registered using sqlite3_wal_hook(). Likewise, registering a callback using sqlite3_wal_hook() disables the automatic checkpoint mechanism configured by this function.
Checkpoint database zDb. If zDb is NULL, or if the buffer zDb points to contains a zero-length string, all attached databases are checkpointed.
Checkpoint database zDb.
Register a callback to be invoked each time a transaction is written into the write-ahead-log by this database connection.
Compute the absolute value of a 32-bit signed integer, of possible. Or if the integer has a value of -2147483648, return +2147483647
Add a new CHECK constraint to the table currently under construction.
Set the collation function of the most recently parsed table column to the CollSeq given.
Add a new column to the table currently being constructed. The parser calls this routine once for each column declaration in a CREATE TABLE statement. sqlite3StartTable() gets called first to get things going. Then this routine is called for each column.
The expression is the default value for the most recently added column of the table currently under construction. Default value expressions must be constant. Raise an exception if this is not the case. This routine is called by the parser while in the middle of parsing a CREATE TABLE statement.
Change the most recently parsed column to be a GENERATED ALWAYS AS column.
Attempt to add, substract, or multiply the 64-bit signed value iB against the other 64-bit signed integer at *pA and store the result in *pA. Return 0 on success. Or if the operation would have resulted in an overflow, leave *pA unchanged and return 1.
This routine is called by the parser while in the middle of parsing a CREATE TABLE statement. A "NOT NULL" constraint has been seen on a column. This routine sets the notNull flag on the column currently under construction.
Designate the PRIMARY KEY for the table. pList is a list of names of columns that form the primary key. If pList is NULL, then the most recently added column of the table is the primary key. A table can have at most one primary key. If the table already has a primary key (and this is the second primary key) then create an error. If the PRIMARY KEY is on a single column whose datatype is INTEGER, then we will try to use that column as the rowid. Set the Table.iPKey field of the table under construction to be the index of the INTEGER PRIMARY KEY column. Table.iPKey is set to -1 if there is no INTEGER PRIMARY KEY. If the key is not an INTEGER PRIMARY KEY, then create a unique index for the key. No index is created for INTEGER PRIMARY KEYs.
Add the RETURNING clause to the parse currently underway. This routine creates a special TEMP trigger that will fire for each row of the DML statement. That TEMP trigger contains a single SELECT statement with a result set that is the argument of the RETURNING clause. The trigger has the Trigger.bReturning flag and an opcode of TK_RETURNING instead of TK_SELECT, so that the trigger code generator knows to handle it specially. The TEMP trigger is automatically removed at the end of the parse. When this routine is called, we do not yet know if the RETURNING clause is attached to a DELETE, INSERT, or UPDATE, so construct it as a RETURNING trigger instead. It will then be converted into the appropriate type on the first call to sqlite3TriggersExist().
Scan the column type name zType (length nType) and return the associated affinity type. This routine does a case-independent search of zType for the substrings in the following table. If one of the substrings is found, the corresponding affinity is returned. If zType contains more than one of the substrings, entries toward the top of the table take priority. For example, if zType is 'BLOBINT', SQLITE_AFF_INTEGER is returned. Substring | Affinity -------------------------------- 'INT' | SQLITE_AFF_INTEGER 'CHAR' | SQLITE_AFF_TEXT 'CLOB' | SQLITE_AFF_TEXT 'TEXT' | SQLITE_AFF_TEXT 'BLOB' | SQLITE_AFF_BLOB 'REAL' | SQLITE_AFF_REAL 'FLOA' | SQLITE_AFF_REAL 'DOUB' | SQLITE_AFF_REAL If none of the substrings in the above table are found, SQLITE_AFF_NUMERIC is returned.
Initialize a Walker object so that will persist AggInfo entries referenced by the tree that is walked.
Allocate heap space to hold an Index object with nCol columns. Increase the allocation size to provide an extra nExtra bytes of 8-byte aligned space after the Index object and return a pointer to this extra space in *ppExtra.
This function is called by the parser after the table-name in an "ALTER TABLE <table-name> ADD" statement is parsed. Argument pSrc is the full-name of the table being altered. This routine makes a (partial) copy of the Table structure for the table being altered and sets Parse.pNewTable to point to it. Routines called by the parser as the column definition is parsed (i.e. sqlite3AddColumn()) add the new Column data to the copy. The copy of the Table structure is deleted by tokenize.c after parsing is finished. Routine sqlite3AlterFinishAddColumn() will be called to complete coding the "ALTER TABLE ... ADD" statement.
This function is called by the parser upon parsing an ALTER TABLE pSrc DROP COLUMN pName statement. Argument pSrc contains the possibly qualified name of the table being edited, and token pName the name of the column to drop.
This function is called after an "ALTER TABLE ... ADD" statement has been parsed. Argument pColDef contains the text of the new column definition. The Table structure pParse->pNewTable was extended to include the new column during parsing.
Register built-in functions used to help implement ALTER TABLE
Handles the following parser reduction: cmd ::= ALTER TABLE pSrc RENAME COLUMN pOld TO pNew
Generate code to implement the "ALTER TABLE xxx RENAME TO yyy" command.
Load the content of the sqlite_stat1 and sqlite_stat4 tables. The contents of sqlite_stat1 are used to populate the Index.aiRowEst[] arrays. The contents of sqlite_stat4 are used to populate the Index.aSample[] arrays. If the sqlite_stat1 table is not present in the database, SQLITE_ERROR is returned. In this case, even if SQLITE_ENABLE_STAT4 was defined during compilation and the sqlite_stat4 table is present, no data is read from it. If SQLITE_ENABLE_STAT4 was defined during compilation and the sqlite_stat4 table is not present in the database, SQLITE_ERROR is returned. However, in this case, data is read from the sqlite_stat1 table (if it is present) before returning. If an OOM error occurs, this function always sets db->mallocFailed. This means if the caller does not care about other errors, the return code may be ignored.
Generate code for the ANALYZE command. The parser calls this routine when it recognizes an ANALYZE command. ANALYZE -- 1 ANALYZE <database> -- 2 ANALYZE ?<database>.?<tablename> -- 3 Form 1 causes all indices in all attached databases to be analyzed. Form 2 analyzes all indices the single database named. Form 3 analyzes all indices associated with the named table.
This function must be called before exiting any API function (i.e. returning control to the user) that has called sqlite3_malloc or sqlite3_realloc. The returned value is normally a copy of the second argument to this function. However, if a malloc() failure has occurred since the previous invocation SQLITE_NOMEM is returned instead. If an OOM as occurred, then the connection error-code (the value returned by sqlite3_errcode()) is set to SQLITE_NOMEM.
pArray is a pointer to an array of objects. Each object in the array is szEntry bytes in size. This routine uses sqlite3DbRealloc() to extend the array so that there is space for a new object at the end. When this function is called, *pnEntry contains the current size of the array (in entries - so the allocation is ((*pnEntry) * szEntry) bytes in total). If the realloc() is successful (i.e. if no OOM condition occurs), the space allocated for the new object is zeroed, *pnEntry updated to reflect the new size of the array and a pointer to the new allocation returned. *pIdx is set to the index of the new array entry in this case. Otherwise, if the realloc() fails, *pIdx is set to -1, *pnEntry remains unchanged and a copy of pArray returned.
The string z[] is an text representation of a real number. Convert this string to a double and write it into *pResult. The string z[] is length bytes in length (bytes, not characters) and uses the encoding enc. The string is not necessarily zero-terminated. Return TRUE if the result is a valid real number (or integer) and FALSE if the string is empty or contains extraneous text. More specifically return 1 => The input string is a pure integer 2 or more => The input has a decimal point or eNNN clause 0 or less => The input string is not a valid number -1 => Not a valid number, but has a valid prefix which includes a decimal point and/or an eNNN clause Valid numbers are in one of these formats: [+-]digits[E[+-]digits] [+-]digits.[digits][E[+-]digits] [+-].digits[E[+-]digits] Leading and trailing whitespace is ignored for the purpose of determining validity. If some prefix of the input string is a valid number, this routine returns FALSE but it still converts the prefix and writes the result into *pResult.
Return a 32-bit integer value extracted from a string. If the string is not an integer, just return 0.
Convert zNum to a 64-bit signed integer. zNum must be decimal. This routine does *not* accept hexadecimal notation. Returns: -1 Not even a prefix of the input text looks like an integer 0 Successful transformation. Fits in a 64-bit signed integer. 1 Excess non-space text after the integer value 2 Integer too large for a 64-bit signed integer or is malformed 3 Special case of 9223372036854775808 length is the number of bytes in the string (bytes, not characters). The string is not necessarily zero-terminated. The encoding is given by enc.
Called by the parser to compile an ATTACH statement. ATTACH p AS pDbname KEY pKey
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.
Pop an authorization context that was previously pushed by sqlite3AuthContextPush
Push an authorization context. After this routine is called, the zArg3 argument to authorization callbacks will be zContext until popped. Or if pParse==0, this routine is a no-op.
The pExpr should be a TK_COLUMN expression. The table referred to is in pTabList or else it is the NEW or OLD table of a trigger. Check to see if it is OK to read this particular column. If the auth function returns SQLITE_IGNORE, change the TK_COLUMN instruction into a TK_NULL. If the auth function returns SQLITE_DENY, then generate an error.
Invoke the authorization callback for permission to read column zCol from table zTab in database zDb. This function assumes that an authorization callback has been registered (i.e. that sqlite3.xAuth is not NULL). If SQLITE_IGNORE is returned and pExpr is not NULL, then pExpr is changed to an SQL NULL expression. Otherwise, if pExpr is NULL, then SQLITE_IGNORE is treated as SQLITE_DENY. In this case an error is left in pParse.
This routine generates code that will initialize all of the register used by the autoincrement tracker.
Load all automatic extensions. If anything goes wrong, set an error in the database connection.
Restart the backup process. This is called when the pager layer detects that the database has been modified by an external database connection. In this case there is no way of knowing which of the pages that have been copied into the destination database are still valid and which are not, so the entire process needs to be restarted. It is assumed that the mutex associated with the BtShared object corresponding to the source database is held when this function is called.
func Xsqlite3BackupUpdate(tls *libc.TLS, pBackup uintptr, iPage Pgno, aData uintptr)
This (sqlite3EndBenignMalloc()) is called by SQLite code to indicate that subsequent malloc failures are benign. A call to sqlite3EndBenignMalloc() indicates that subsequent malloc failures are non-benign.
Generate VDBE code for a BEGIN statement.
This is called by the parser when it sees a CREATE TRIGGER statement up to the point of the BEGIN before the trigger actions. A Trigger structure is generated based on the information available and stored in pParse->pNewTrigger. After the trigger actions have been parsed, the sqlite3FinishTrigger() function is called to complete the trigger construction process.
Generate VDBE code that prepares for doing an operation that might change the database. This routine starts a new transaction if we are not already within a transaction. If we are already within a transaction, then a checkpoint is set if the setStatement parameter is true. A checkpoint should be set for operations that might fail (due to a constraint) part of the way through and which will need to undo some writes without having to rollback the whole transaction. For operations where all constraints can be checked before any changes are made to the database, it is never necessary to undo a write and the checkpoint should not be set.
Register hooks to call when sqlite3BeginBenignMalloc() and sqlite3EndBenignMalloc() are called, respectively.
Return a pointer to the collation sequence that should be used by a binary comparison operator comparing pLeft and pRight. If the left hand expression has a collating sequence type, then it is used. Otherwise the collation sequence for the right hand expression is used, or the default (BINARY) if neither expression has a collating type. Argument pRight (but not pLeft) may be a null pointer. In this case, it is not considered.
This routine runs an extensive test of the Bitvec code. The input is an array of integers that acts as a program to test the Bitvec. The integers are opcodes followed by 0, 1, or 3 operands, depending on the opcode. Another opcode follows immediately after the last operand. There are 6 opcodes numbered from 0 through 5. 0 is the "halt" opcode and causes the test to end. 0 Halt and return the number of errors 1 N S X Set N bits beginning with S and incrementing by X 2 N S X Clear N bits beginning with S and incrementing by X 3 N Set N randomly chosen bits 4 N Clear N randomly chosen bits 5 N S X Set N bits from S increment X in array only, not in bitvec The opcodes 1 through 4 perform set and clear operations are performed on both a Bitvec object and on a linear array of bits obtained from malloc. Opcode 5 works on the linear array only, not on the Bitvec. Opcode 5 is used to deliberately induce a fault in order to confirm that error detection works. At the conclusion of the test the linear array is compared against the Bitvec object. If there are any differences, an error is returned. If they are the same, zero is returned. If a memory allocation error occurs, return -1.
Clear the i-th bit. pBuf must be a pointer to at least BITVEC_SZ bytes of temporary storage that BitvecClear can use to rebuilt its hash table.
Create a new bitmap object able to handle bits between 0 and iSize, inclusive. Return a pointer to the new object. Return NULL if malloc fails.
Destroy a bitmap object. Reclaim all memory used.
Set the i-th bit. Return 0 on success and an error code if anything goes wrong. This routine might cause sub-bitmaps to be allocated. Failing to get the memory needed to hold the sub-bitmap is the only that can go wrong with an insert, assuming p and i are valid. The calling function must ensure that p is a valid Bitvec object and that the value for "i" is within range of the Bitvec object. Otherwise the behavior is undefined.
Return the value of the iSize parameter specified when Bitvec *p was created.
Check to see if the i-th bit is set. Return true or false. If p is NULL (if the bitmap has not been created) or if i is out of range, then return false.
Compare two blobs. Return negative, zero, or positive if the first is less than, equal to, or greater than the second, respectively. If one blob is a prefix of the other, then the shorter is the lessor.
Start a statement subtransaction. The subtransaction can be rolled back independently of the main transaction. You must start a transaction before starting a subtransaction. The subtransaction is ended automatically if the main transaction commits or rolls back. Statement subtransactions are used around individual SQL statements that are contained within a BEGIN...COMMIT block. If a constraint error occurs within the statement, the effect of that one statement can be rolled back without having to rollback the entire transaction. A statement sub-transaction is implemented as an anonymous savepoint. The value passed as the second parameter is the total number of savepoints, including the new anonymous savepoint, open on the B-Tree. i.e. if there are no active savepoints and no other statement-transactions open, iStatement is 1. This anonymous savepoint can be released or rolled back using the sqlite3BtreeSavepoint() function.
Attempt to start a new transaction. A write-transaction is started if the second argument is nonzero, otherwise a read- transaction. If the second argument is 2 or more and exclusive transaction is started, meaning that no other process is allowed to access the database. A preexisting transaction may not be upgraded to exclusive by calling this routine a second time - the exclusivity flag only works for a new transaction. A write-transaction must be started before attempting any changes to the database. None of the following routines will work unless a transaction is started first: sqlite3BtreeCreateTable() sqlite3BtreeCreateIndex() sqlite3BtreeClearTable() sqlite3BtreeDropTable() sqlite3BtreeInsert() sqlite3BtreeDelete() sqlite3BtreeUpdateMeta() If an initial attempt to acquire the lock fails because of lock contention and the database was previously unlocked, then invoke the busy handler if there is one. But if there was previously a read-lock, do not invoke the busy handler - just return SQLITE_BUSY. SQLITE_BUSY is returned when there is already a read-lock in order to avoid a deadlock. Suppose there are two processes A and B. A has a read lock and B has a reserved lock. B tries to promote to exclusive but is blocked because of A's read lock. A tries to promote to reserved but is blocked by B. One or the other of the two processes must give way or there can be no progress. By returning SQLITE_BUSY and not invoking the busy callback when A already has a read lock, we encourage A to give up and let B proceed.
Run a checkpoint on the Btree passed as the first argument. Return SQLITE_LOCKED if this or any other connection has an open transaction on the shared-cache the argument Btree is connected to. Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL or RESTART.
Clear the current cursor position.
Delete all information from a single table in the database. iTable is the page number of the root of the table. After this routine returns, the root page is empty, but still exists. This routine will fail with SQLITE_LOCKED if there are any open read cursors on the table. Open write cursors are moved to the root of the table. If pnChange is not NULL, then the integer value pointed to by pnChange is incremented by the number of entries in the table.
Delete all information from the single table that pCur is open on. This routine only work for pCur on an ephemeral table.
Close an open database and invalidate all cursors.
Close a cursor. The read lock on the database file is released when the last cursor is closed.
Do both phases of a commit.
This routine does the first phase of a two-phase commit. This routine causes a rollback journal to be created (if it does not already exist) and populated with enough information so that if a power loss occurs the database can be restored to its original state by playing back the journal. Then the contents of the journal are flushed out to the disk. After the journal is safely on oxide, the changes to the database are written into the database file and flushed to oxide. At the end of this call, the rollback journal still exists on the disk and we are still holding all locks, so the transaction has not committed. See sqlite3BtreeCommitPhaseTwo() for the second phase of the commit process. This call is a no-op if no write-transaction is currently active on pBt. Otherwise, sync the database file for the btree pBt. zSuperJrnl points to the name of a super-journal file that should be written into the individual journal file, or is NULL, indicating no super-journal file (single database transaction). When this is called, the super-journal should already have been created, populated with this journal pointer and synced to disk. Once this is routine has returned, the only thing required to commit the write-transaction for this database file is to delete the journal.
Commit the transaction currently in progress. This routine implements the second phase of a 2-phase commit. The sqlite3BtreeCommitPhaseOne() routine does the first phase and should be invoked prior to calling this routine. The sqlite3BtreeCommitPhaseOne() routine did all the work of writing information out to disk and flushing the contents so that they are written onto the disk platter. All this routine has to do is delete or truncate or zero the header in the the rollback journal (which causes the transaction to commit) and drop locks. Normally, if an error occurs while the pager layer is attempting to finalize the underlying journal file, this function returns an error and the upper layer will attempt a rollback. However, if the second argument is non-zero then this b-tree transaction is part of a multi-file transaction. In this case, the transaction has already been committed (by deleting a super-journal file) and the caller will ignore this functions return code. So, even if an error occurs in the pager layer, reset the b-tree objects internal state to indicate that the write transaction has been closed. This is quite safe, as the pager will have transitioned to the error state. This will release the write lock on the database file. If there are no active cursors, it also releases the read lock.
Return the number of connections to the BtShared object accessed by the Btree handle passed as the only argument. For private caches this is always 1. For shared caches it may be 1 or greater.
Copy the complete content of pBtFrom into pBtTo. A transaction must be active for both files. The size of file pTo may be reduced by this operation. If anything goes wrong, the transaction on pTo is rolled back. If successful, the transaction is committed before returning.
The first argument, pCur, is a cursor opened on some b-tree. Count the number of entries in the b-tree and write the result to *pnEntry. SQLITE_OK is returned if the operation is successfully executed. Otherwise, if an error is encountered (i.e. an IO error or database corruption) an SQLite error code is returned.
func Xsqlite3BtreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, flags int32) int32
func Xsqlite3BtreeCursor(tls *libc.TLS, p uintptr, iTable Pgno, wrFlag int32, pKeyInfo uintptr, pCur uintptr) int32
Return true if the cursor has a hint specified. This routine is only used from within assert() statements
Determine whether or not a cursor has moved from the position where it was last placed, or has been invalidated for any other reason. Cursors can move when the row they are pointing at is deleted out from under them, for example. Cursor might also move if a btree is rebalanced. Calling this routine with a NULL cursor pointer returns false. Use the separate sqlite3BtreeCursorRestore() routine to restore a cursor back to where it ought to be if this routine returns true.
Provide flag hints to the cursor.
Pin or unpin a cursor.
This routine restores a cursor back to its original position after it has been moved by some outside activity (such as a btree rebalance or a row having been deleted out from under the cursor). On success, the *pDifferentRow parameter is false if the cursor is left pointing at exactly the same row. *pDifferntRow is the row the cursor was pointing to has been deleted, forcing the cursor to point to some nearby row. This routine should only be called for a cursor that just returned TRUE from sqlite3BtreeCursorHasMoved().
Return the size of a BtCursor object in bytes. This interfaces is needed so that users of cursors can preallocate sufficient storage to hold a cursor. The BtCursor object is opaque to users so they cannot do the sizeof() themselves - they must call this routine.
Initialize memory that will be converted into a BtCursor object. The simple approach here would be to memset() the entire object to zero. But it turns out that the apPage[] and aiIdx[] arrays do not need to be zeroed and they are large, so we can save a lot of run-time by skipping the initialization of those elements.
Delete the entry that the cursor is pointing to. If the BTREE_SAVEPOSITION bit of the flags parameter is zero, then the cursor is left pointing at an arbitrary location after the delete. But if that bit is set, then the cursor is left in a state such that the next call to BtreeNext() or BtreePrev() moves it to the same row as it would have been on if the call to BtreeDelete() had been omitted. The BTREE_AUXDELETE bit of flags indicates that is one of several deletes associated with a single table entry and its indexes. Only one of those deletes is considered the "primary" delete. The primary delete occurs on a cursor that is not a BTREE_FORDELETE cursor. All but one delete operation on non-FORDELETE cursors is tagged with the AUXDELETE flag. The BTREE_AUXDELETE bit is a hint that is not used by this implementation, but which might be used by alternative storage engines.
func Xsqlite3BtreeDropTable(tls *libc.TLS, p uintptr, iTable int32, piMoved uintptr) int32
Enter a mutex on the given BTree object. If the object is not sharable, then no mutex is ever required and this routine is a no-op. The underlying mutex is non-recursive. But we keep a reference count in Btree.wantToLock so the behavior of this interface is recursive. To avoid deadlocks, multiple Btrees are locked in the same order by all database connections. The p->pNext is a list of other Btrees belonging to the same database connection as the p Btree which need to be locked after p. If we cannot get a lock on p, then first unlock all of the others on p->pNext, then wait for the lock to become available on p, then relock all of the subsequent Btrees that desire a lock.
Enter a mutex on a Btree given a cursor owned by that Btree. These entry points are used by incremental I/O only. Enter() is required any time OMIT_SHARED_CACHE is not defined, regardless of whether or not the build is threadsafe. Leave() is only required by threadsafe builds.
Return TRUE if the cursor is not pointing at an entry of the table. TRUE will be returned after a call to sqlite3BtreeNext() moves past the last entry in the table or sqlite3BtreePrev() moves past the first entry. TRUE is also returned if the table is empty.
Return a pointer to a fake BtCursor object that will always answer false to the sqlite3BtreeCursorHasMoved() routine above. The fake cursor returned must not be used with any other Btree interface.
Move the cursor to the first entry in the table. Return SQLITE_OK on success. Set *pRes to 0 if the cursor actually points to something or set *pRes to 1 if the table is empty.
Return the value of the 'auto-vacuum' property. If auto-vacuum is enabled 1 is returned. Otherwise 0.
Return the full pathname of the underlying database file. Return an empty string if the database is in-memory or a TEMP database. The pager filename is invariant as long as the pager is open so it is safe to access without the BtShared mutex.
Return the pathname of the journal file for this database. The return value of this routine is the same regardless of whether the journal file has been created or not. The pager journal filename is invariant as long as the pager is open so it is safe to access without the BtShared mutex.
This function may only be called if the b-tree connection already has a read or write transaction open on the database. Read the meta-information out of a database file. Meta[0] is the number of free pages currently in the database. Meta[1] through meta[15] are available for use by higher layers. Meta[0] is read-only, the others are read/write. The schema layer numbers meta values differently. At the schema layer (and the SetCookie and ReadCookie opcodes) the number of free pages is not visible. So Cookie[0] is the same as Meta[1]. This routine treats Meta[BTREE_DATA_VERSION] as a special case. Instead of reading the value out of the header, it instead loads the "DataVersion" from the pager. The BTREE_DATA_VERSION value is not actually stored in the database file. It is a number computed by the pager. But its access pattern is the same as header meta values, and so it is convenient to read it from this routine.
Return the currently defined page size
Return the number of bytes of space at the end of every page that are intentually left unused. This is the "reserved" space that is sometimes used by extensions. The value returned is the larger of the current reserve size and the latest reserve size requested by SQLITE_FILECTRL_RESERVE_BYTES. The amount of reserve can only grow - never shrink.
This function is similar to sqlite3BtreeGetReserve(), except that it may only be called if it is guaranteed that the b-tree mutex is already held. This is useful in one special case in the backup API code where it is known that the shared b-tree mutex is held, but the mutex on the database handle that owns *p is not. In this case if sqlite3BtreeEnter() were to be called, it might collide with some other operation on the database handle that owns *p, causing undefined behavior.
Mark this cursor as an incremental blob cursor.
A write-transaction must be opened before calling this function. It performs a single unit of work towards an incremental vacuum. If the incremental vacuum is finished after this function has run, SQLITE_DONE is returned. If it is not finished, but no error occurred, SQLITE_OK is returned. Otherwise an SQLite error code.
Insert a new record into the BTree. The content of the new record is described by the pX object. The pCur cursor is used only to define what table the record should be inserted into, and is left pointing at a random location. For a table btree (used for rowid tables), only the pX.nKey value of the key is used. The pX.pKey value must be NULL. The pX.nKey is the rowid or INTEGER PRIMARY KEY of the row. The pX.nData,pData,nZero fields hold the content of the row. For an index btree (used for indexes and WITHOUT ROWID tables), the key is an arbitrary byte sequence stored in pX.pKey,nKey. The pX.pData,nData,nZero fields must be zero. If the seekResult parameter is non-zero, then a successful call to MovetoUnpacked() to seek cursor pCur to (pKey,nKey) has already been performed. In other words, if seekResult!=0 then the cursor is currently pointing to a cell that will be adjacent to the cell to be inserted. If seekResult<0 then pCur points to a cell that is smaller then (pKey,nKey). If seekResult>0 then pCur points to a cell that is larger than (pKey,nKey). If seekResult==0, that means pCur is pointing at some unknown location. In that case, this routine must seek the cursor to the correct insertion point for (pKey,nKey) before doing the insertion. For index btrees, if pX->nMem is non-zero, then pX->aMem contains pointers to the unpacked key values and pX->aMem can be used instead of pX->pKey to avoid having to decode the key.
Return the value of the integer key or "rowid" for a table btree. This routine is only valid for a cursor that is pointing into a ordinary table btree. If the cursor points to an index btree or is invalid, the result of this routine is undefined.
This routine does a complete check of the given BTree file. aRoot[] is an array of pages numbers were each page number is the root page of a table. nRoot is the number of entries in aRoot. A read-only or read-write transaction must be opened before calling this function. Write the number of error seen in *pnErr. Except for some memory allocation errors, an error message held in memory obtained from malloc is returned if *pnErr is non-zero. If *pnErr==0 then NULL is returned. If a memory allocation error occurs, NULL is returned. If the first entry in aRoot[] is 0, that indicates that the list of root pages is incomplete. This is a "partial integrity-check". This happens when performing an integrity check on a single table. The zero is skipped, of course. But in addition, the freelist checks and the checks to make sure every page is referenced are also skipped, since obviously it is not possible to know which pages are covered by the unverified btrees. Except, if aRoot[1] is 1, then the freelist checks are still performed.
Return true if there is currently a backup running on Btree p.
Return true if the given Btree is read-only.
Move the cursor to the last entry in the table. Return SQLITE_OK on success. Set *pRes to 0 if the cursor actually points to something or set *pRes to 1 if the table is empty.
Exit the recursive mutex on a Btree.
Obtain a lock on the table whose root page is iTab. The lock is a write lock if isWritelock is true or a read lock if it is false.
Set the maximum page count for a database if mxPage is positive. No changes are made if mxPage is 0 or negative. Regardless of the value of mxPage, return the maximum page count.
Return an upper bound on the size of any record for the table that the cursor is pointing into. This is an optimization. Everything will still work if this routine always returns 2147483647 (which is the largest record that SQLite can handle) or more. But returning a smaller value might prevent large memory allocations when trying to interpret a corrupt datrabase. The current implementation merely returns the size of the underlying database file.
Move the cursor so that it points to an entry near the key specified by pIdxKey or intKey. Return a success code. For INTKEY tables, the intKey parameter is used. pIdxKey must be NULL. For index tables, pIdxKey is used and intKey is ignored. If an exact match is not found, then the cursor is always left pointing at a leaf page which would hold the entry if it were present. The cursor might point to an entry that comes before or after the key. An integer is written into *pRes which is the result of comparing the key with the entry to which the cursor is pointing. The meaning of the integer written into *pRes is as follows: *pRes<0 The cursor is left pointing at an entry that is smaller than intKey/pIdxKey or if the table is empty and the cursor is therefore left point to nothing. *pRes==0 The cursor is left pointing at an entry that exactly matches intKey/pIdxKey. *pRes>0 The cursor is left pointing at an entry that is larger than intKey/pIdxKey. For index tables, the pIdxKey->eqSeen field is set to 1 if there exists an entry in the table that exactly matches pIdxKey.
Initialize the first page of the database file (creating a database consisting of a single page and no schema objects). Return SQLITE_OK if successful, or an SQLite error code otherwise.
func Xsqlite3BtreeNext(tls *libc.TLS, pCur uintptr, flags int32) int32
Return the offset into the database file for the start of the payload to which the cursor is pointing.
Open a database file. zFilename is the name of the database file. If zFilename is NULL then an ephemeral database is created. The ephemeral database might be exclusively in memory, or it might use a disk-based memory cache. Either way, the ephemeral database will be automatically deleted when sqlite3BtreeClose() is called. If zFilename is ":memory:" then an in-memory database is created that is automatically destroyed when it is closed. The "flags" parameter is a bitmask that might contain bits like BTREE_OMIT_JOURNAL and/or BTREE_MEMORY. If the database is already opened in the same database connection and we are in shared cache mode, then the open will fail with an SQLITE_CONSTRAINT error. We cannot allow two or more BtShared objects in the same database connection since doing so will lead to problems with locking.
Return the pager associated with a BTree. This routine is used for testing and debugging only.
Read part of the payload for the row at which that cursor pCur is currently pointing. "amt" bytes will be transferred into pBuf[]. The transfer begins at "offset". pCur can be pointing to either a table or an index b-tree. If pointing to a table btree, then the content section is read. If pCur is pointing to an index b-tree then the key section is read. For sqlite3BtreePayload(), the caller must ensure that pCur is pointing to a valid row in the table. For sqlite3BtreePayloadChecked(), the cursor might be invalid or might need to be restored before being read. Return SQLITE_OK on success or an error code if anything goes wrong. An error is returned if "offset+amt" is larger than the available payload.
func Xsqlite3BtreePayloadChecked(tls *libc.TLS, pCur uintptr, offset U32, amt U32, pBuf uintptr) int32
For the entry that cursor pCur is point to, return as many bytes of the key or data as are available on the local b-tree page. Write the number of available bytes into *pAmt. The pointer returned is ephemeral. The key/data may move or be destroyed on the next call to any Btree routine, including calls from other threads against the same cache. Hence, a mutex on the BtShared should be held prior to calling this routine. These routines is used to get quick access to key and data in the common case where no overflow pages are used.
Return the number of bytes of payload for the entry that pCur is currently pointing to. For table btrees, this will be the amount of data. For index btrees, this will be the size of the key. The caller must guarantee that the cursor is pointing to a non-NULL valid entry. In other words, the calling procedure must guarantee that the cursor has Cursor.eState==CURSOR_VALID.
func Xsqlite3BtreePrevious(tls *libc.TLS, pCur uintptr, flags int32) int32
Argument pCsr must be a cursor opened for writing on an INTKEY table currently pointing at a valid table entry. This function modifies the data stored as part of that entry. Only the data content may only be modified, it is not possible to change the length of the data stored. If this function is called with parameters that attempt to write past the end of the existing data, no modifications are made and SQLITE_CORRUPT is returned.
Rollback the transaction in progress. If tripCode is not SQLITE_OK then cursors will be invalidated (tripped). Only write cursors are tripped if writeOnly is true but all cursors are tripped if writeOnly is false. Any attempt to use a tripped cursor will result in an error. This will release the write lock on the database file. If there are no active cursors, it also releases the read lock.
Return an estimate for the number of rows in the table that pCur is pointing to. Return a negative number if no estimate is currently available.
The second argument to this function, op, is always SAVEPOINT_ROLLBACK or SAVEPOINT_RELEASE. This function either releases or rolls back the savepoint identified by parameter iSavepoint, depending on the value of op. Normally, iSavepoint is greater than or equal to zero. However, if op is SAVEPOINT_ROLLBACK, then iSavepoint may also be -1. In this case the contents of the entire transaction are rolled back. This is different from a normal transaction rollback, as no locks are released and the transaction remains open.
This function returns a pointer to a blob of memory associated with a single shared-btree. The memory is used by client code for its own purposes (for example, to store a high-level schema associated with the shared-btree). The btree layer manages reference counting issues. The first time this is called on a shared-btree, nBytes bytes of memory are allocated, zeroed, and returned to the caller. For each subsequent call the nBytes parameter is ignored and a pointer to the same blob of memory returned. If the nBytes parameter is 0 and the blob of memory has not yet been allocated, a null pointer is returned. If the blob has already been allocated, it is returned as normal. Just before the shared-btree is closed, the function passed as the xFree argument when the memory allocation was made is invoked on the blob of allocated memory. The xFree function should not call sqlite3_free() on the memory, the btree layer does that.
Return SQLITE_LOCKED_SHAREDCACHE if another user of the same shared btree as the argument handle holds an exclusive lock on the sqlite_schema table. Otherwise SQLITE_OK.
Change the values for the BTS_SECURE_DELETE and BTS_OVERWRITE flags: newFlag==0 Both BTS_SECURE_DELETE and BTS_OVERWRITE are cleared newFlag==1 BTS_SECURE_DELETE set and BTS_OVERWRITE is cleared newFlag==2 BTS_SECURE_DELETE cleared and BTS_OVERWRITE is set newFlag==(-1) No changes This routine acts as a query if newFlag is less than zero With BTS_OVERWRITE set, deleted content is overwritten by zeros, but freelist leaf pages are not written back to the database. Thus in-page deleted content is cleared, but freelist deleted content is not. With BTS_SECURE_DELETE, operation is like BTS_OVERWRITE with the addition that freelist leaf pages are written back into the database, increasing the amount of disk I/O.
Change the 'auto-vacuum' property of the database. If the 'autoVacuum' parameter is non-zero, then auto-vacuum mode is enabled. If zero, it is disabled. The default value for the auto-vacuum property is determined by the SQLITE_DEFAULT_AUTOVACUUM macro.
Change the "soft" limit on the number of pages in the cache. Unused and unmodified pages will be recycled when the number of pages in the cache exceeds this soft limit. But the size of the cache is allowed to grow larger than this limit if it contains dirty pages or pages still in active use.
Change the limit on the amount of the database file that may be memory mapped.
Change the way data is synced to disk in order to increase or decrease how well the database resists damage due to OS crashes and power failures. Level 1 is the same as asynchronous (no syncs() occur and there is a high probability of damage) Level 2 is the default. There is a very low but non-zero probability of damage. Level 3 reduces the probability of damage to near zero but with a write performance reduction.
Change the default pages size and the number of reserved bytes per page. Or, if the page size has already been fixed, return SQLITE_READONLY without changing anything. The page size must be a power of 2 between 512 and 65536. If the page size supplied does not meet this constraint then the page size is not changed. Page sizes are constrained to be a power of two so that the region of the database file used for locking (beginning at PENDING_BYTE, the first byte past the 1GB boundary, 0x40000000) needs to occur at the beginning of a page. If parameter nReserve is less than zero, then the number of reserved bytes per page is left unchanged. If the iFix!=0 then the BTS_PAGESIZE_FIXED flag is set so that the page size and autovacuum mode can no longer be changed.
Change the "spill" limit on the number of pages in the cache. If the number of pages exceeds this limit during a write transaction, the pager might attempt to "spill" pages to the journal early in order to free up memory. The value returned is the current spill size. If zero is passed as an argument, no changes are made to the spill size setting, so using mxPage of 0 is a way to query the current spill size.
Set both the "read version" (single byte at byte offset 18) and "write version" (single byte at byte offset 19) fields in the database header to iVersion.
Return true if the Btree passed as the only argument is sharable.
This function is used as part of copying the current row from cursor pSrc into cursor pDest. If the cursors are open on intkey tables, then parameter iKey is used as the rowid value when the record is copied into pDest. Otherwise, the record is copied verbatim. This function does not actually write the new value to cursor pDest. Instead, it creates and populates any required overflow pages and writes the data for the new cell into the BtShared.pTmpSpace buffer for the destination database. The size of the cell, in bytes, is left in BtShared.nPreformatSize. The caller completes the insertion by calling sqlite3BtreeInsert() with the BTREE_PREFORMAT flag specified. SQLITE_OK is returned if successful, or an SQLite error code otherwise.
This routine sets the state to CURSOR_FAULT and the error code to errCode for every cursor on any BtShared that pBtree references. Or if the writeOnly flag is set to 1, then only trip write cursors and leave read cursors unchanged. Every cursor is a candidate to be tripped, including cursors that belong to other database connections that happen to be sharing the cache with pBtree. This routine gets called when a rollback occurs. If the writeOnly flag is true, then only write-cursors need be tripped - read-only cursors save their current positions so that they may continue following the rollback. Or, if writeOnly is false, all cursors are tripped. In general, writeOnly is false if the transaction being rolled back modified the database schema. In this case b-tree root pages may be moved or deleted from the database altogether, making it unsafe for read cursors to continue. If the writeOnly flag is true and an error is encountered while saving the current position of a read-only cursor, all cursors, including all read-cursors are tripped. SQLITE_OK is returned if successful, or if an error occurs while saving a cursor position, an SQLite error code.
Return one of SQLITE_TXN_NONE, SQLITE_TXN_READ, or SQLITE_TXN_WRITE to describe the current transaction state of Btree p.
Write meta-information back into the database. Meta[0] is read-only and may not be written.
Generate code that will increment the schema cookie. The schema cookie is used to determine when the schema for the database changes. After each schema change, the cookie value changes. When a process first reads the schema it records the cookie. Thereafter, whenever it goes to access the database, it checks the cookie to make sure the schema has not changed since it was last read. This plan is not completely bullet-proof. It is possible for the schema to change multiple times and for the cookie to be set back to prior value. But schema changes are infrequent and the probability of hitting the same cookie value is only 1 chance in 2^32. So we're safe enough. IMPLEMENTATION-OF: R-34230-56049 SQLite automatically increments the schema-version whenever the schema changes.
This routine is called on a collation sequence before it is used to check that it is defined. An undefined collation sequence exists when a database is loaded that contains references to collation sequences that have not been defined by sqlite3_create_collation() etc. If required, this routine calls the 'collation needed' callback to request a definition of the collating sequence. If this doesn't work, an equivalent collating sequence that uses a text encoding different from the main database is substituted, if one is available.
This routine is used to check if the UTF-8 string zName is a legal unqualified name for a new schema object (table, index, view or trigger). All names are legal except those that begin with the string "sqlite_" (in upper, lower or mixed case). This portion of the namespace is reserved for internal use. When parsing the sqlite_schema table, this routine also checks to make sure the "type", "name", and "tbl_name" columns are consistent with the SQL.
Run a checkpoint on database iDb. This is a no-op if database iDb is not currently open in WAL mode. If a transaction is open on the database being checkpointed, this function returns SQLITE_LOCKED and a checkpoint is not attempted. If an error occurs while running the checkpoint, an SQLite error code is returned (i.e. SQLITE_IOERR). Otherwise, SQLITE_OK. The mutex on database handle db should be held by the caller. The mutex associated with the specific b-tree being checkpointed is taken by this function while the checkpoint is running. If iDb is passed SQLITE_MAX_DB then all attached databases are checkpointed. If an error is encountered it is returned immediately - no attempt is made to checkpoint any remaining databases. Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL, RESTART or TRUNCATE.
Mark all temporary registers as being unavailable for reuse. Always invoke this procedure after coding a subroutine or co-routine that might be invoked from other parts of the code, to ensure that the sub/co-routine does not use registers in common with the code that invokes the sub/co-routine.
Call this routine when the database connection is closing in order to clean up loaded extensions
Close all open savepoints. This function only manipulates fields of the database handle object, it does not close any savepoints that may be open at the b-tree/pager level.
Generate code to drop a table.
Generate code that will construct an ephemeral table containing all terms in the RHS of an IN operator. The IN operator can be in either of two forms: x IN (4,5,11) -- IN operator with list on right-hand side x IN (SELECT a FROM b) -- IN operator with subquery on the right The pExpr parameter is the IN operator. The cursor number for the constructed ephermeral table is returned. The first time the ephemeral table is computed, the cursor number is also stored in pExpr->iTable, however the cursor number returned might not be the same, as it might have been duplicated using OP_OpenDup. If the LHS expression ("x" in the examples) is a column value, or the SELECT statement returns a column value, then the affinity of that column is used to build the index keys. If both 'x' and the SELECT... statement are columns, then numeric affinity is used if either column has NUMERIC or INTEGER affinity. If neither 'x' nor the SELECT... statement are columns, then numeric affinity is used.
This is called to code the required FOR EACH ROW triggers for an operation on table pTab. The operation to code triggers for (INSERT, UPDATE or DELETE) is given by the op parameter. The tr_tm parameter determines whether the BEFORE or AFTER triggers are coded. If the operation is an UPDATE, then parameter pChanges is passed the list of columns being modified. If there are no triggers that fire at the specified time for the specified operation on pTab, this function is a no-op. The reg argument is the address of the first in an array of registers that contain the values substituted for the new.* and old.* references in the trigger program. If N is the number of columns in table pTab (a copy of pTab->nCol), then registers are populated as follows: Register Contains ------------------------------------------------------ reg+0 OLD.rowid reg+1 OLD.* value of left-most column of pTab ... ... reg+N OLD.* value of right-most column of pTab reg+N+1 NEW.rowid reg+N+2 NEW.* value of left-most column of pTab ... ... reg+N+N+1 NEW.* value of right-most column of pTab For ON DELETE triggers, the registers containing the NEW.* values will never be accessed by the trigger program, so they are not allocated or populated by the caller (there is no data to populate them with anyway). Similarly, for ON INSERT triggers the values stored in the OLD.* registers are never accessed, and so are not allocated by the caller. So, for an ON INSERT trigger, the value passed to this function as parameter reg is not a readable register, although registers (reg+N) through (reg+N+N+1) are. Parameter orconf is the default conflict resolution algorithm for the trigger program to use (REPLACE, IGNORE etc.). Parameter ignoreJump is the instruction that control should jump to if a trigger program raises an IGNORE exception.
Generate code for the trigger program associated with trigger p on table pTab. The reg, orconf and ignoreJump parameters passed to this function are the same as those described in the header function for sqlite3CodeRowTrigger()
Generate code for scalar subqueries used as a subquery expression or EXISTS operator: (SELECT a FROM b) -- subquery EXISTS (SELECT a FROM b) -- EXISTS subquery The pExpr parameter is the SELECT or EXISTS operator to be coded. Return the register that holds the result. For a multi-column SELECT, the result is stored in a contiguous array of registers and the return value is the register of the left-most result column. Return 0 if an error occurs.
If argument zDb is NULL, then call sqlite3CodeVerifySchema() for each attached database. Otherwise, invoke it for the database named zDb only.
func Xsqlite3CodeVerifySchema(tls *libc.TLS, pParse uintptr, iDb int32)
Look through the list of open database files in db->aDb[] and if any have been closed, remove them from the list. Reallocate the db->aDb[] structure to a smaller size, if possible. Entry 0 (the "main" database) and entry 1 (the "temp" database) are never candidates for being collapsed.
The most recently coded instruction was an OP_Column to retrieve the i-th column of table pTab. This routine sets the P4 parameter of the OP_Column to the default value, if any. The default value of a column is specified by a DEFAULT clause in the column definition. This was either supplied by the user when the table was created, or added later to the table definition by an ALTER TABLE command. If the latter, then the row-records in the table btree on disk may not contain a value for the column and the default value, taken from the P4 parameter of the OP_Column instruction, is returned instead. If the former, then all row-records are guaranteed to include a value for the column and the P4 value is not required. Column definitions created by an ALTER TABLE command may only have literal default values specified: a number, null or a string. (If a more complicated default expression value was provided, it is evaluated when the ALTER TABLE is executed and one of the literal values written into the sqlite_schema table.) Therefore, the P4 parameter is only required if the default value for the column is a literal number, string or null. The sqlite3ValueFromExpr() function is capable of transforming these types of expressions into sqlite3_value objects. If column as REAL affinity and the table is an ordinary b-tree table (not a virtual table) then the value might have been stored as an integer. In that case, add an OP_RealAffinity opcode to make sure it has been converted into REAL.
Return the index of a column in a table. Return -1 if the column is not contained in the table.
Given an expression list (which is really the list of expressions that form the result set of a SELECT statement) compute appropriate column names for a table that would hold the expression list. All column names will be unique. Only the column names are computed. Column.zType, Column.zColl, and other fields of Column are zeroed. Return SQLITE_OK on success. If a memory allocation error occurs, store NULL in *paCol and 0 in *pnCol and return SQLITE_NOMEM. The only guarantee that SQLite makes about column names is that if the column has an AS clause assigning it a name, that will be the name used. That is the only documented guarantee. However, countless applications developed over the years have made baseless assumptions about column names and will break if those assumptions changes. Hence, use extreme caution when modifying this routine to avoid breaking legacy. See Also: sqlite3GenerateColumnNames()
Return the declared type of a column. Or return zDflt if the column has no declared type. The column type is an extra string stored after the zero-terminator on the column name if and only if the COLFLAG_HASTYPE flag is set.
This routine is called when a commit occurs.
pExpr is an operand of a comparison operator. aff2 is the type affinity of the other operand. This routine returns the type affinity that should be used for the comparison operator.
This routine generates code to finish the INSERT or UPDATE operation that was started by a prior call to sqlite3GenerateConstraintChecks. A consecutive range of registers starting at regNewData contains the rowid and the content to be inserted. The arguments to this routine should be the same as the first six arguments to sqlite3GenerateConstraintChecks.
All regular columns for table pTab have been puts into registers starting with iRegStore. The registers that correspond to STORED or VIRTUAL columns have not yet been initialized. This routine goes back and computes the values for those columns based on the previously computed normal columns.
This function is called while stepping or preparing a statement associated with connection db. The operation will return SQLITE_LOCKED to the user because it requires a lock that will not be available until connection pBlocker concludes its current transaction.
This is called when the database connection passed as an argument is being closed. The connection is removed from the blocked list.
This function is called when the transaction opened by database db has just finished. Locks held by database connection db have been released. This function loops through each entry in the blocked connections list and does the following: 1) If the sqlite3.pBlockingConnection member of a list entry is set to db, then set pBlockingConnection=0. 2) If the sqlite3.pUnlockConnection member of a list entry is set to db, then invoke the configured unlock-notify callback and set pUnlockConnection=0. 3) If the two steps above mean that pBlockingConnection==0 and pUnlockConnection==0, remove the entry from the blocked connections list.
Allocate and return a pointer to an expression to load the column iCol from datasource iSrc in SrcList pSrc.
This routine is called to create a new foreign key on the table currently under construction. pFromCol determines which columns in the current table point to the foreign key. If pFromCol==0 then connect the key to the last column inserted. pTo is the name of the table referred to (a.k.a the "parent" table). pToCol is a list of tables in the parent pTo table. flags contains all information about the conflict resolution algorithms specified in the ON DELETE, ON UPDATE and ON INSERT clauses. An FKey structure is created and added to the table currently under construction in the pParse->pNewTable field. The foreign key is set for IMMEDIATE processing. A subsequent call to sqlite3DeferForeignKey() might change this to DEFERRED.
This function is exactly the same as sqlite3_create_function(), except that it is designed to be called by internal code. The difference is that if a malloc() fails in sqlite3_create_function(), an error code is returned and the mallocFailed flag cleared.
Create a new index for an SQL table. pName1.pName2 is the name of the index and pTblList is the name of the table that is to be indexed. Both will be NULL for a primary key or an index that is created to satisfy a UNIQUE constraint. If pTable and pIndex are NULL, use pParse->pNewTable as the table to be indexed. pParse->pNewTable is a table that is currently being constructed by a CREATE TABLE statement. pList is a list of columns to be indexed. pList will be NULL if this is a primary key or unique-constraint on the most recent column added to the table currently under construction.
The parser calls this routine in order to create a new VIEW
Free the contents of the CTE object passed as the second argument.
Create a new CTE object
Free memory that might be associated with a particular database connection. Calling sqlite3DbFree(D,X) for X==0 is a harmless no-op. The sqlite3DbFreeNN(D,X) version requires that X be non-NULL.
Return true if zName points to a name that may be used to refer to database iDb attached to handle db.
Allocate memory, either lookaside (if possible) or heap. If the allocation fails, set the mallocFailed flag in the connection pointer. If db!=0 and db->mallocFailed is true (indicating a prior malloc failure on the same database connection) then always return 0. Hence for a particular database connection, once malloc starts failing, it fails consistently until mallocFailed is reset. This is an important assumption. There are many places in the code that do things like this: int *a = (int*)sqlite3DbMallocRaw(db, 100); int *b = (int*)sqlite3DbMallocRaw(db, 200); if( b ) a[10] = 9; In other words, if a subsequent malloc (ex: "b") worked, it is assumed that all prior mallocs (ex: "a") worked too. The sqlite3MallocRawNN() variant guarantees that the "db" parameter is not a NULL pointer.
Allocate and zero memory. If the allocation fails, make the mallocFailed flag in the connection pointer.
Return the Btree pointer identified by zDbName. Return NULL if not found.
Resize the block of memory pointed to by p to n bytes. If the resize fails, set the mallocFailed flag in the connection object.
Attempt to reallocate p. If the reallocation fails, then free p and set the mallocFailed flag in the database connection.
The text between zStart and zEnd represents a phrase within a larger SQL statement. Make a copy of this phrase in space obtained form sqlite3DbMalloc(). Omit leading and trailing whitespace.
Make a copy of a string in memory obtained from sqliteMalloc(). These functions call sqlite3MallocRaw() directly instead of sqliteMalloc(). This is because when memory debugging is turned on, these two functions are called via macros that record the current file and line number in the ThreadData structure.
Transform a UTF-8 integer literal, in either decimal or hexadecimal, into a 64-bit signed integer. This routine accepts hexadecimal literals, whereas sqlite3Atoi64() does not. Returns: 0 Successful transformation. Fits in a 64-bit signed integer. 1 Excess text after the integer value 2 Integer too large for a 64-bit signed integer or is malformed 3 Special case of 9223372036854775808
If compiled with SQLITE_MUTEX_NOOP, then the no-op mutex implementation is used regardless of the run-time threadsafety setting.
Fill the Index.aiRowEst[] array with default information - information to be used when we have not run the ANALYZE command. aiRowEst[0] is supposed to contain the number of elements in the index. Since we do not know, guess 1 million. aiRowEst[1] is an estimate of the number of rows in the table that match any particular value of the first column of the index. aiRowEst[2] is an estimate of the number of rows that match any particular combination of the first 2 columns of the index. And so forth. It must always be the case that aiRowEst[N]<=aiRowEst[N-1] aiRowEst[N]>=1 Apart from that, we have little to go on besides intuition as to how aiRowEst[] should be initialized. The numbers generated here are based on typical values found in actual indices.
This routine is called when an INITIALLY IMMEDIATE or INITIALLY DEFERRED clause is seen as part of a foreign key definition. The isDeferred parameter is 1 for INITIALLY DEFERRED and 0 for INITIALLY IMMEDIATE. The behavior of the most recently created foreign key is adjusted accordingly.
Delete memory allocated for the column names of a table or view (the Table.aCol[] array).
Generate code for a DELETE FROM statement. DELETE FROM table_wxyz WHERE a<5 AND b NOT NULL; \________/ \________________/ pTabList pWhere
If the Index.aSample variable is not NULL, delete the aSample[] array and its contents.
func Xsqlite3DeleteTable(tls *libc.TLS, db uintptr, pTable uintptr)
Recursively delete a Trigger structure
Delete a linked list of TriggerStep structures.
Convert an SQL-style quoted string into a normal string by removing the quote characters. The conversion is done in-place. If the input does not begin with a quote character, then this routine is a no-op. The input string must be zero-terminated. A new zero-terminator is added to the dequoted string. The return value is -1 if no dequoting occurs or the length of the dequoted string, exclusive of the zero terminator, if dequoting does occur. 2002-02-14: This routine is extended to remove MS-Access style brackets from around identifiers. For example: "[a-b-c]" becomes "a-b-c".
Called by the parser to compile a DETACH statement. DETACH pDbname
This routine will drop an existing named index. This routine implements the DROP INDEX statement.
This routine is called to do the work of a DROP TABLE statement. pName is the name of the table to be dropped.
This function is called to drop a trigger from the database schema. This may be called directly from the parser and therefore identifies the trigger by name. The sqlite3DropTriggerPtr() routine does the same job as this routine except it takes a pointer to the trigger instead of the trigger name.
Drop a trigger given a pointer to that trigger.
This routine is called to report the final ")" that terminates a CREATE TABLE statement. The table structure that other action routines have been building is added to the internal hash tables, assuming no errors have occurred. An entry for the table is made in the schema table on disk, unless this is a temporary table or db->init.busy==1. When db->init.busy==1 it means we are reading the sqlite_schema table because we just connected to the database or because the sqlite_schema table has recently changed, so the entry for this table already exists in the sqlite_schema table. We do not want to create it again. If the pSelect argument is not NULL, it means that this routine was called to create a table generated from a "CREATE TABLE ... AS SELECT ..." statement. The column names of the new table will match the result set of the SELECT.
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.
Set the current error code to err_code and clear any prior error message. Also set iSysErrno (by calling sqlite3System) if the err_code indicates that would be appropriate.
The equivalent of sqlite3Error(db, SQLITE_OK). Clear the error state and error message.
Add an error message to pParse->zErrMsg and increment pParse->nErr. The following formatting characters are allowed: %s Insert a string %z A string that should be freed after use %d Insert an integer %T Insert a token %S Insert the first element of a SrcList This function should be used to report any error that occurs while compiling an SQL statement (i.e. within sqlite3_prepare()). The last thing the sqlite3_prepare() function does is copy the error stored by this function into the database handle using sqlite3Error(). Functions sqlite3Error() or sqlite3ErrorWithMsg() should be used during statement execution (sqlite3_step() etc.).
If database connection db is currently parsing SQL, then transfer error code errCode to that parser if the parser has not already encountered some other kind of error.
Set the most recent error code and error string for the sqlite handle "db". The error code is set to "err_code". If it is not NULL, string zFormat specifies the format of the error string in the style of the printf functions: The following format characters are allowed: %s Insert a string %z A string that should be freed after use %d Insert an integer %T Insert a token %S Insert the first element of a SrcList zFormat and any string tokens that follow it are assumed to be encoded in UTF-8. To clear the most recent error for sqlite handle "db", sqlite3Error should be called with err_code set to SQLITE_OK and zFormat set to NULL.
Return a static string that describes the kind of error specified in the argument.
The SrcList_item structure passed as the second argument represents a sub-query in the FROM clause of a SELECT statement. This function allocates and populates the SrcList_item.pTab object. If successful, SQLITE_OK is returned. Otherwise, if an OOM error is encountered, SQLITE_NOMEM.
Mark every prepared statement associated with a database connection as expired. An expired statement means that recompilation of the statement is recommend. Statements expire when things happen that make their programs obsolete. Removing user-defined functions or collating sequences, or changing an authorization function are the types of things that make prepared statements obsolete. If iCode is 1, then expiration is advisory. The statement should be reprepared before being restarted, but if it is already running it is allowed to run to completion. Internally, this function just sets the Vdbe.expired flag on all prepared statements. The flag is set to 1 for an immediate expiration and set to 2 for an advisory expiration.
Allocate a new expression node from a zero-terminated token that has already been dequoted.
Set the collating sequence for expression pExpr to be the collating sequence named by pToken. Return a pointer to a new Expr node that implements the COLLATE operator. If a memory allocation error occurs, that fact is recorded in pParse->db and the pExpr parameter is returned unchanged.
Return the 'affinity' of the expression pExpr if any. If pExpr is a column, a reference to a column via an 'AS' alias, or a sub-select with a column as the return value, then the affinity of that column is returned. Otherwise, 0x00 is returned, indicating no affinity for the expression. i.e. the WHERE clause expressions in the following statements all have an affinity: CREATE TABLE t1(a); SELECT * FROM t1 WHERE a; SELECT a AS b FROM t1 WHERE b; SELECT * FROM t1 WHERE (select a from t1);
This routine is the core allocator for Expr nodes. Construct a new expression node and return a pointer to it. Memory for this node and for the pToken argument is a single allocation obtained from sqlite3DbMalloc(). The calling function is responsible for making sure the node eventually gets freed. If dequote is true, then the token (if it exists) is dequoted. If dequote is false, no dequoting is performed. The deQuote parameter is ignored if pToken is NULL or if the token does not appear to be quoted. If the quotes were of the form "..." (double-quotes) then the EP_DblQuoted flag is set on the expression node. Special case: If op==TK_INTEGER and pToken points to a string that can be translated into a 32-bit integer, then the token is not stored in u.zToken. Instead, the integer values is written into u.iValue and the EP_IntValue flag is set. No extra storage is allocated to hold the integer text and the dequote flag is ignored.
Call sqlite3ExprAnalyzeAggregates() for every expression in an expression list. Return the number of errors. If an error is found, the analysis is cut short.
Analyze the pExpr expression looking for aggregate functions and for variables that need to be added to AggInfo object that pNC->pAggInfo points to. Additional entries are made on the AggInfo object as necessary. This routine should only be called after the expression has been analyzed by sqlite3ResolveExprNames().
Join two expressions using an AND operator. If either expression is NULL, then just return the other expression. If one side or the other of the AND is known to be false, then instead of returning an AND expression, just return a constant expression with a value of false.
Assign a variable number to an expression that encodes a wildcard in the original SQL statement. Wildcards consisting of a single "?" are assigned the next sequential variable number. Wildcards of the form "?nnn" are assigned the number "nnn". We make sure "nnn" is not too big to avoid a denial of service attack when the SQL statement comes from an external source. Wildcards of the form ":aaa", "@aaa", or "$aaa" are assigned the same number as the previous instance of the same wildcard. Or if this is the first instance of the wildcard, the next sequential variable number is assigned.
Attach subtrees pLeft and pRight to the Expr node pRoot. If pRoot==NULL that means that a memory allocation error has occurred. In that case, delete the subtrees pLeft and pRight.
Return FALSE if there is no chance that the expression can be NULL. If the expression might be NULL or if the expression is too complex to tell return TRUE. This routine is used as an optimization, to skip OP_IsNull opcodes when we know that a value cannot be NULL. Hence, a false positive (returning TRUE when in fact the expression can never be NULL) might be a small performance hit but is otherwise harmless. On the other hand, a false negative (returning FALSE when the result could be NULL) will likely result in an incorrect answer. So when in doubt, return TRUE.
Check that argument nHeight is less than or equal to the maximum expression depth allowed. If it is not, leave an error message in pParse.
Expr pIn is an IN(...) expression. This function checks that the sub-select on the RHS of the IN() operator has the same number of columns as the vector on the LHS. Or, if the RHS of the IN() is not a sub-query, that the LHS is a vector of size 1.
Generate code that will evaluate expression pExpr and store the results in register target. The results are guaranteed to appear in register target.
Make a transient copy of expression pExpr and then code it using sqlite3ExprCode(). This routine works just like sqlite3ExprCode() except that the input expression is guaranteed to be unchanged.
Generate code that pushes the value of every element of the given expression list into a sequence of registers beginning at target. Return the number of elements evaluated. The number returned will usually be pList->nExpr but might be reduced if SQLITE_ECEL_OMITREF is defined. The SQLITE_ECEL_DUP flag prevents the arguments from being filled using OP_SCopy. OP_Copy must be used instead. The SQLITE_ECEL_FACTOR argument allows constant arguments to be factored out into initialization code. The SQLITE_ECEL_REF flag means that expressions in the list with ExprList.a[].u.x.iOrderByCol>0 have already been evaluated and stored in registers at srcReg, and so the value can be copied from there. If SQLITE_ECEL_OMITREF is also set, then the values with u.x.iOrderByCol>0 are simply omitted rather than being copied from srcReg.
Generate code that will evaluate expression pExpr and store the results in register target. The results are guaranteed to appear in register target. If the expression is constant, then this routine might choose to code the expression at initialization time.
Generate code that will compute the value of generated column pCol and store the result in register regOut
Generate code that will extract the iColumn-th column from table pTab and store the column value in register iReg. There must be an open cursor to pTab in iTable when this routine is called. If iColumn<0 then code is generated that extracts the rowid.
Generate code to extract the value of the iCol-th column of a table.
Generate code that will load into register regOut a value that is appropriate for the iIdxCol-th column of index pIdx.
Generate code to move content from registers iFrom...iFrom+nReg-1 over to iTo..iTo+nReg-1.
Generate code that will evaluate expression pExpr just one time per prepared statement execution. If the expression uses functions (that might throw an exception) then guard them with an OP_Once opcode to ensure that the code is only executed once. If no functions are involved, then factor the code out and put it at the end of the prepared statement in the initialization section. If regDest>=0 then the result is always stored in that register and the result is not reusable. If regDest<0 then this routine is free to store the value whereever it wants. The register where the expression is stored is returned. When regDest<0, two identical expressions might code to the same register, if they do not contain function calls and hence are factored out into the initialization section at the end of the prepared statement.
Generate code into the current Vdbe to evaluate the given expression. Attempt to store the results in register "target". Return the register where results are stored. With this routine, there is no guarantee that results will be stored in target. The result might be stored in some other register if it is convenient to do so. The calling function must check the return code and move the results to the desired register.
Generate code to evaluate an expression and store the results into a register. Return the register number where the results are stored. If the register is a temporary register that can be deallocated, then write its number into *pReg. If the result register is not a temporary, then set *pReg to zero. If pExpr is a constant, then this routine might generate this code to fill the register in the initialization section of the VDBE program, in order to factor it out of the evaluation loop.
Return the collation sequence for the expression pExpr. If there is no defined collating sequence, return NULL. See also: sqlite3ExprNNCollSeq() The sqlite3ExprNNCollSeq() works the same exact that it returns the default collation if pExpr has no defined collation. The collating sequence might be determined by a COLLATE operator or by the presence of a column with a defined collating sequence. COLLATE operators take first precedence. Left operands take precedence over right operands.
Return TRUE if the two expressions have equivalent collating sequences.
The argument is guaranteed to be a non-NULL Expr node of type TK_COLUMN. return the appropriate colUsed mask.
Do a deep comparison of two expression trees. Return 0 if the two expressions are completely identical. Return 1 if they differ only by a COLLATE operator at the top level. Return 2 if there are differences other than the top-level COLLATE operator. If any subelement of pB has Expr.iTable==(-1) then it is allowed to compare equal to an equivalent element in pA with Expr.iTable==iTab. The pA side might be using TK_REGISTER. If that is the case and pB is not using TK_REGISTER but is otherwise equivalent, then still return 0. Sometimes this routine will return 2 even if the two expressions really are equivalent. If we cannot prove that the expressions are identical, we return 2 just to be safe. So if this routine returns 2, then you do not really know for certain if the two expressions are the same. But if you get a 0 or 1 return, then you can be sure the expressions are the same. In the places where this routine is used, it does not hurt to get an extra 2 - that just might result in some slightly slower code. But returning an incorrect 0 or 1 could lead to a malfunction. If pParse is not NULL then TK_VARIABLE terms in pA with bindings in pParse->pReprepare can be matched against literals in pB. The pParse->pVdbe->expmask bitmask is updated for each variable referenced. If pParse is NULL (the normal case) then any TK_VARIABLE term in Argument pParse should normally be NULL. If it is not NULL and pA or pB causes a return value of 2.
Expresssion p is a comparison operator. Return a collation sequence appropriate for the comparison operator. This is normally just a wrapper around sqlite3BinaryCompareCollSeq(). However, if the OP_Commuted flag is set, then the order of the operands is reversed in the sqlite3BinaryCompareCollSeq() call so that the correct collating sequence is found.
Like sqlite3ExprCompare() except COLLATE operators at the top-level are ignored.
Determine if an index pIdx on table with cursor iCur contains will the expression pExpr. Return true if the index does cover the expression and false if the pExpr expression references table columns that are not found in the index pIdx. An index covering an expression means that the expression can be evaluated using only the index and without having to lookup the corresponding table entry.
Arrange to cause pExpr to be deleted when the pParse is deleted. This is similar to sqlite3ExprDelete() except that the delete is deferred untilthe pParse is deleted. The pExpr might be deleted immediately on an OOM error. The deferred delete is (currently) implemented by adding the pExpr to the pParse->pConstExpr list with a register number of 0.
The following group of routines make deep copies of expressions, expression lists, ID lists, and select statements. The copies can be deleted (by being passed to their respective ...Delete() routines) without effecting the originals. The expression list, ID, and source lists return by sqlite3ExprListDup(), sqlite3IdListDup(), and sqlite3SrcListDup() can not be further expanded by subsequent calls to sqlite*ListAppend() routines. Any tables that the SrcList might point to are not duplicated. The flags parameter contains a combination of the EXPRDUP_XXX flags. If the EXPRDUP_REDUCE flag is set, then the structure returned is a truncated version of the usual Expr structure that will be stored as part of the in-memory representation of the database schema.
Compute and return a new Expr object which when passed to sqlite3ExprCode() will generate all necessary code to compute the iField-th column of the vector expression pVector. It is ok for pVector to be a scalar (as long as iField==0). In that case, this routine works like sqlite3ExprDup(). The caller owns the returned Expr object and is responsible for ensuring that the returned value eventually gets freed. The caller retains ownership of pVector. If pVector is a TK_SELECT, then the returned object will reference pVector and so pVector must remain valid for the life of the returned object. If pVector is a TK_VECTOR or a scalar expression, then it can be deleted as soon as this routine returns. A trick to cause a TK_SELECT pVector to be deleted together with the returned Expr object is to attach the pVector to the pRight field of the returned TK_SELECT_COLUMN Expr object.
Construct a new expression node for a function with multiple arguments.
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.
If the input expression is an ID with the name "true" or "false" then convert it into an TK_TRUEFALSE term. Return non-zero if the conversion happened, and zero if the expression is unaltered.
Generate code for a boolean expression such that a jump is made to the label "dest" if the expression is false but execution continues straight thru if the expression is true. If the expression evaluates to NULL (neither true nor false) then jump if jumpIfNull is SQLITE_JUMPIFNULL or fall through if jumpIfNull is 0.
Like sqlite3ExprIfFalse() except that a copy is made of pExpr before code generation, and that copy is deleted after code generation. This ensures that the original pExpr is unchanged.
Generate code for a boolean expression such that a jump is made to the label "dest" if the expression is true but execution continues straight thru if the expression is false. If the expression evaluates to NULL (neither true nor false), then take the jump if the jumpIfNull flag is SQLITE_JUMPIFNULL. This code depends on the fact that certain token values (ex: TK_EQ) are the same as opcode values (ex: OP_Eq) that implement the corresponding operation. Special comments in vdbe.c and the mkopcodeh.awk script in the make process cause these values to align. Assert()s in the code below verify that the numbers are aligned correctly.
Return true if we can prove the pE2 will always be true if pE1 is true. Return false if we cannot complete the proof or if pE2 might be false. Examples: pE1: x==5 pE2: x==5 Result: true pE1: x>0 pE2: x==5 Result: false pE1: x=21 pE2: x=21 OR y=43 Result: true pE1: x!=123 pE2: x IS NOT NULL Result: true pE1: x!=?1 pE2: x IS NOT NULL Result: true pE1: x IS NULL pE2: x IS NOT NULL Result: false pE1: x IS ?2 pE2: x IS NOT NULL Reuslt: false When comparing TK_COLUMN nodes between pE1 and pE2, if pE2 has Expr.iTable<0 then assume a table number given by iTab. If pParse is not NULL, then the values of bound variables in pE1 are compared against literal values in pE2 and pParse->pVdbe->expmask is modified to record which bound variables are referenced. If pParse is NULL, then false will be returned if pE1 contains any bound variables. When in doubt, return false. Returning true might give a performance improvement. Returning false might cause a performance reduction, but it will always give the correct answer and is hence always safe.
Return true (non-zero) if expression p can only be true if at least one column of table iTab is non-null. In other words, return true if expression p will always be NULL or false if every column of iTab is NULL. False negatives are acceptable. In other words, it is ok to return zero even if expression p will never be true of every column of iTab is NULL. A false negative is merely a missed optimization opportunity. False positives are not allowed, however. A false positive may result in an incorrect answer. Terms of p that are marked with EP_FromJoin (and hence that come from the ON or USING clauses of LEFT JOINS) are excluded from the analysis. This routine is used to check if a LEFT JOIN can be converted into an ordinary JOIN. The p argument is the WHERE clause. If the WHERE clause requires that some column of the right table of the LEFT JOIN be non-NULL, then the LEFT JOIN can be safely converted into an ordinary join.
Walk an expression tree. Return non-zero if the expression is constant and 0 if it involves variables or function calls. For the purposes of this function, a double-quoted string (ex: "abc") is considered a variable but a single-quoted string (ex: 'abc') is a constant.
Walk an expression tree. Return non-zero if (1) the expression is constant, and (2) the expression does originate in the ON or USING clause of a LEFT JOIN, and (3) the expression does not contain any EP_FixedCol TK_COLUMN operands created by the constant propagation optimization. When this routine returns true, it indicates that the expression can be added to the pParse->pConstExpr list and evaluated once when the prepared statement starts up. See sqlite3ExprCodeRunJustOnce().
Walk an expression tree for the DEFAULT field of a column definition in a CREATE TABLE statement. Return non-zero if the expression is acceptable for use as a DEFAULT. That is to say, return non-zero if the expression is constant or a function call with constant arguments. Return and 0 if there are any variables. isInit is true when parsing from sqlite_schema. isInit is false when processing a new CREATE TABLE statement. When isInit is true, parameters (such as ? or $abc) in the expression are converted into NULL. When isInit is false, parameters raise an error. Parameters should not be allowed in a CREATE TABLE statement, but some legacy versions of SQLite allowed it, so we need to support it when reading sqlite_schema for backwards compatibility. If isInit is true, set EP_FromDDL on every TK_FUNCTION node. For the purposes of this function, a double-quoted string (ex: "abc") is considered a variable but a single-quoted string (ex: 'abc') is a constant.
Walk the expression tree passed as the first argument. Return non-zero if the expression consists entirely of constants or copies of terms in pGroupBy that sort with the BINARY collation sequence. This routine is used to determine if a term of the HAVING clause can be promoted into the WHERE clause. In order for such a promotion to work, the value of the HAVING clause term must be the same for all members of a "group". The requirement that the GROUP BY term must be BINARY assumes that no other collating sequence will have a finer-grained grouping than binary. In other words (A=B COLLATE binary) implies A=B in every other collating sequence. The requirement that the GROUP BY be BINARY is stricter than necessary. It would also work to promote HAVING clauses that use the same alternative collating sequence as the GROUP BY term, but that is much harder to check, alternative collating sequences are uncommon, and this is only an optimization, so we take the easy way out and simply require the GROUP BY to use the BINARY collating sequence.
If the expression p codes a constant integer that is small enough to fit in a 32-bit integer, return 1 and put the value of the integer in *pValue. If the expression is not an integer or if it is too big to fit in a signed 32-bit integer, return 0 and leave *pValue unchanged.
Walk an expression tree. Return non-zero if the expression is constant for any single row of the table with cursor iCur. In other words, the expression must not refer to any non-deterministic function nor any table other than iCur.
Return true if expression pExpr is a vector, or false otherwise. A vector is defined as any expression that results in two or more columns of result. Every TK_VECTOR node is an vector because the parser will not generate a TK_VECTOR with fewer than two entries. But a TK_SELECT might be either a vector or a scalar. It is only considered a vector if it has two or more result columns.
func Xsqlite3ExprListAppend(tls *libc.TLS, pParse uintptr, pList uintptr, pExpr uintptr) uintptr
pColumns and pExpr form a vector assignment which is part of the SET clause of an UPDATE statement. Like this: (a,b,c) = (expr1,expr2,expr3) Or: (a,b,c) = (SELECT x,y,z FROM ....) For each term of the vector assignment, append new entries to the expression list pList. In the case of a subquery on the RHS, append TK_SELECT_COLUMN expressions.
If the expression list pEList contains more than iLimit elements, leave an error message in pParse.
Compare two ExprList objects. Return 0 if they are identical, 1 if they are certainly different, or 2 if it is not possible to determine if they are identical or not. If any subelement of pB has Expr.iTable==(-1) then it is allowed to compare equal to an equivalent element in pA with Expr.iTable==iTab. This routine might return non-zero for equivalent ExprLists. The only consequence will be disabled optimizations. But this routine must never return 0 if the two ExprList objects are different, or a malfunction will result. Two NULL pointers are considered to be the same. But a NULL pointer always differs from a non-NULL pointer.
Return the bitwise-OR of all Expr.flags fields in the given ExprList.
Set the ExprList.a[].zEName element of the most recently added item on the expression list. pList might be NULL following an OOM error. But pName should never be NULL. If a memory allocation fails, the pParse->db->mallocFailed flag is set.
Set the sort order for the last element on the given ExprList.
Set the ExprList.a[].zSpan element of the most recently added item on the expression list. pList might be NULL following an OOM error. But pSpan should never be NULL. If a memory allocation fails, the pParse->db->mallocFailed flag is set.
Return TRUE if the given expression is a constant which would be unchanged by OP_Affinity with the affinity given in the second argument. This routine is used to determine if the OP_Affinity operation can be omitted. When in doubt return FALSE. A false negative is harmless. A false positive, however, can result in the wrong answer.
Return the collation sequence for the expression pExpr. If there is no defined collating sequence, return a pointer to the defautl collation sequence. See also: sqlite3ExprCollSeq() The sqlite3ExprCollSeq() routine works the same except that it returns NULL if there is no defined collation.
pExpr is a CHECK constraint on a row that is being UPDATE-ed. The only columns that are modified by the UPDATE are those for which aiChng[i]>=0, and also the ROWID is modified if chngRowid is true. Return true if CHECK constraint pExpr uses any of the changing columns (or the rowid if it is changing). In other words, return true if this CHECK constraint must be validated for the new row in the UPDATE statement. 2018-09-15: pExpr might also be an expression for an index-on-expressions. The operation of this routine is the same - return true if an only if the expression uses one or more of columns identified by the second and third arguments.
Set the Expr.nHeight variable using the exprSetHeight() function. If the height is greater than the maximum allowed expression depth, leave an error in pParse. Also propagate all EP_Propagate flags from the Expr.x.pList into Expr.flags.
If pExpr is an AND or OR expression, try to simplify it by eliminating terms that are always true or false. Return the simplified expression. Or return the original expression if no simplification is possible. Examples: (x<10) AND true => (x<10) (x<10) AND false => false (x<10) AND (y=22 OR false) => (x<10) AND (y=22) (x<10) AND (y=22 OR true) => (x<10) (y=22) OR true => true
Skip over any TK_COLLATE operators.
Skip over any TK_COLLATE operators and/or any unlikely() or likelihood() or likely() functions at the root of an expression.
The argument must be a TK_TRUEFALSE Expr node. Return 1 if it is TRUE and 0 if it is FALSE.
Invoke sqlite3RenameExprUnmap() and sqlite3ExprDelete() on the expression.
If the expression passed as the only argument is of type TK_VECTOR return the number of expressions in the vector. Or, if the expression is a sub-select, return the number of columns in the sub-select. For any other type of expression, return 1.
No-op routine for the parse-tree walker. When this routine is the Walker.xExprCallback then expression trees are walked without any actions being taken at each node. Presumably, when this routine is used for Walker.xExprCallback then Walker.xSelectCallback is set to do something useful for every subquery in the parser tree.
Calls to sqlite3FaultSim() are used to simulate a failure during testing, or to bypass normal error detection during testing in order to let execute proceed futher downstream. In deployment, sqlite3FaultSim() *always* return SQLITE_OK (0). The sqlite3FaultSim() function only returns non-zero during testing. During testing, if the test harness has set a fault-sim callback using a call to sqlite3_test_control(SQLITE_TESTCTRL_FAULT_INSTALL), then each call to sqlite3FaultSim() is relayed to that application-supplied callback and the integer return value form the application-supplied callback is returned by sqlite3FaultSim(). The integer argument to sqlite3FaultSim() is a code to identify which sqlite3FaultSim() instance is being invoked. Each call to sqlite3FaultSim() should have a unique code. To prevent legacy testing applications from breaking, the codes should not be changed or reused.
Parameter zName points to a UTF-8 encoded string nName bytes long. Return the CollSeq* pointer for the collation sequence named zName for the encoding 'enc' from the database 'db'. If the entry specified is not found and 'create' is true, then create a new entry. Otherwise return NULL. A separate function sqlite3LocateCollSeq() is a wrapper around this routine. sqlite3LocateCollSeq() invokes the collation factory if necessary and generates an error message if the collating sequence cannot be found. See also: sqlite3LocateCollSeq(), sqlite3GetCollSeq()
The token *pName contains the name of a database (either "main" or "temp" or the name of an attached db). This routine returns the index of the named database in db->aDb[], or -1 if the named db does not exist.
Parameter zName points to a nul-terminated buffer containing the name of a database ("main", "temp" or the name of an attached db). This function returns the index of the named database in db->aDb[], or -1 if the named db cannot be found.
Locate a user function given a name, a number of arguments and a flag indicating whether the function prefers UTF-16 over UTF-8. Return a pointer to the FuncDef structure that defines that function, or return NULL if the function does not exist. If the createFlag argument is true, then a new (blank) FuncDef structure is created and liked into the "db" structure if a no matching function previously existed. If nArg is -2, then the first valid function found is returned. A function is valid if xSFunc is non-zero. The nArg==(-2) case is used to see if zName is a valid function name for some number of arguments. If nArg is -2, then createFlag must be 0. If createFlag is false, then a function with the required name and number of arguments may be returned even if the eTextRep flag does not match that requested.
Locate the in-memory structure that describes a particular index given the name of that index and the name of the database that contains the index. Return NULL if not found. If zDatabase is 0, all databases are searched for the table and the first matching index is returned. (No checking for duplicate index names is done.) The search order is TEMP first, then MAIN, then any auxiliary databases added using the ATTACH command.
This function is used by the implementation of the IN (...) operator. The pX parameter is the expression on the RHS of the IN operator, which might be either a list of expressions or a subquery. The job of this routine is to find or create a b-tree object that can be used either to test for membership in the RHS set or to iterate through all members of the RHS set, skipping duplicates. A cursor is opened on the b-tree object that is the RHS of the IN operator and pX->iTable is set to the index of that cursor. The returned value of this function indicates the b-tree type, as follows: IN_INDEX_ROWID - The cursor was opened on a database table. IN_INDEX_INDEX_ASC - The cursor was opened on an ascending index. IN_INDEX_INDEX_DESC - The cursor was opened on a descending index. IN_INDEX_EPH - The cursor was opened on a specially created and populated epheremal table. IN_INDEX_NOOP - No cursor was allocated. The IN operator must be implemented as a sequence of comparisons. An existing b-tree might be used if the RHS expression pX is a simple subquery such as: SELECT <column1>, <column2>... FROM <table> If the RHS of the IN operator is a list or a more complex subquery, then an ephemeral table might need to be generated from the RHS and then pX->iTable made to point to the ephemeral table instead of an existing table. The inFlags parameter must contain, at a minimum, one of the bits IN_INDEX_MEMBERSHIP or IN_INDEX_LOOP but not both. If inFlags contains IN_INDEX_MEMBERSHIP, then the generated table will be used for a fast membership test. When the IN_INDEX_LOOP bit is set, the IN index will be used to loop over all values of the RHS of the IN operator. When IN_INDEX_LOOP is used (and the b-tree will be used to iterate through the set members) then the b-tree must not contain duplicates. An epheremal table will be created unless the selected columns are guaranteed to be unique - either because it is an INTEGER PRIMARY KEY or due to a UNIQUE constraint or index. When IN_INDEX_MEMBERSHIP is used (and the b-tree will be used for fast set membership tests) then an epheremal table must be used unless <columns> is a single INTEGER PRIMARY KEY column or an index can be found with the specified <columns> as its left-most. If the IN_INDEX_NOOP_OK and IN_INDEX_MEMBERSHIP are both set and if the RHS of the IN operator is a list (not a subquery) then this routine might decide that creating an ephemeral b-tree for membership testing is too expensive and return IN_INDEX_NOOP. In that case, the calling routine should implement the IN operator using a sequence of Eq or Ne comparison operations. When the b-tree is being used for membership tests, the calling function might need to know whether or not the RHS side of the IN operator contains a NULL. If prRhsHasNull is not a NULL pointer and if there is any chance that the (...) might contain a NULL value at runtime, then a register is allocated and the register number written to *prRhsHasNull. If there is no chance that the (...) contains a NULL value, then *prRhsHasNull is left unchanged. If a register is allocated and its location stored in *prRhsHasNull, then the value in that register will be NULL if the b-tree contains one or more NULL values, and it will be some non-NULL value if the b-tree contains no NULL values. If the aiMap parameter is not NULL, it must point to an array containing one element for each column returned by the SELECT statement on the RHS of the IN(...) operator. The i'th entry of the array is populated with the offset of the index column that matches the i'th column returned by the SELECT. For example, if the expression and selected index are: (?,?,?) IN (SELECT a, b, c FROM t1) CREATE INDEX i1 ON t1(b, c, a); then aiMap[] is populated with {2, 0, 1}.
Locate the in-memory structure that describes a particular database table given the name of that table and (optionally) the name of the database containing the table. Return NULL if not found. If zDatabase is 0, all databases are searched for the table and the first matching table is returned. (No checking for duplicate table names is done.) The search order is TEMP first, then MAIN, then any auxiliary databases added using the ATTACH command. See also sqlite3LocateTable().
This routine is called after a single SQL statement has been parsed and a VDBE program to execute that statement has been prepared. This routine puts the finishing touches on the VDBE program and resets the pParse structure for the next parse. Note that if an error occurred, it might be the case that no VDBE code was generated.
This routine is called after all of the trigger actions have been parsed in order to complete the process of building the trigger.
func Xsqlite3FixExpr(tls *libc.TLS, pFix uintptr, pExpr uintptr) int32
Initialize a DbFixer structure. This routine must be called prior to passing the structure to one of the sqliteFixAAAA() routines below.
func Xsqlite3FixSelect(tls *libc.TLS, pFix uintptr, pSelect uintptr) int32
The following set of routines walk through the parse tree and assign a specific database to all table references where the database name was left unspecified in the original SQL statement. The pFix structure must have been initialized by a prior call to sqlite3FixInit(). These routines are used to make sure that an index, trigger, or view in one database does not refer to objects in a different database. (Exception: indices, triggers, and views in the TEMP database are allowed to refer to anything.) If a reference is explicitly made to an object in a different database, an error message is added to pParse->zErrMsg and these routines return non-zero. If everything checks out, these routines return 0.
This function is called when deleting or updating a row to implement any required CASCADE, SET NULL or SET DEFAULT actions.
This function is called when inserting, deleting or updating a row of table pTab to generate VDBE code to perform foreign key constraint processing for the operation. For a DELETE operation, parameter regOld is passed the index of the first register in an array of (pTab->nCol+1) registers containing the rowid of the row being deleted, followed by each of the column values of the row being deleted, from left to right. Parameter regNew is passed zero in this case. For an INSERT operation, regOld is passed zero and regNew is passed the first register of an array of (pTab->nCol+1) registers containing the new row data. For an UPDATE operation, this function is called twice. Once before the original record is deleted from the table using the calling convention described for DELETE. Then again after the original record is deleted but before the new record is inserted using the INSERT convention.
Free all memory associated with foreign key definitions attached to table pTab. Remove the deleted foreign keys from the Schema.fkeyHash hash table.
This function is called to generate code that runs when table pTab is being dropped from the database. The SrcList passed as the second argument to this function contains a single entry guaranteed to resolve to table pTab. Normally, no code is required. However, if either (a) The table is the parent table of a FK constraint, or (b) The table is the child table of a deferred FK constraint and it is determined at runtime that there are outstanding deferred FK constraint violations in the database, then the equivalent of "DELETE FROM <tbl>" is executed before dropping the table from the database. Triggers are disabled while running this DELETE, but foreign key actions are not.
A foreign key constraint requires that the key columns in the parent table are collectively subject to a UNIQUE or PRIMARY KEY constraint. Given that pParent is the parent table for foreign key constraint pFKey, search the schema for a unique index on the parent key columns. If successful, zero is returned. If the parent key is an INTEGER PRIMARY KEY column, then output variable *ppIdx is set to NULL. Otherwise, *ppIdx is set to point to the unique index. If the parent key consists of a single column (the foreign key constraint is not a composite foreign key), output variable *paiCol is set to NULL. Otherwise, it is set to point to an allocated array of size N, where N is the number of columns in the parent key. The first element of the array is the index of the child table column that is mapped by the FK constraint to the parent table column stored in the left-most column of index *ppIdx. The second element of the array is the index of the child table column that corresponds to the second left-most column of *ppIdx, and so on. If the required index cannot be found, either because: 1) The named parent key columns do not exist, or 2) The named parent key columns do exist, but are not subject to a UNIQUE or PRIMARY KEY constraint, or 3) No parent key columns were provided explicitly as part of the foreign key definition, and the parent table does not have a PRIMARY KEY, or 4) No parent key columns were provided explicitly as part of the foreign key definition, and the PRIMARY KEY of the parent table consists of a different number of columns to the child key in the child table. then non-zero is returned, and a "foreign key mismatch" error loaded into pParse. If an OOM error occurs, non-zero is returned and the pParse->db->mallocFailed flag is set.
This function is called before generating code to update or delete a row contained in table pTab.
This function returns a linked list of FKey objects (connected by FKey.pNextTo) holding all children of table pTab. For example, given the following schema: CREATE TABLE t1(a PRIMARY KEY); CREATE TABLE t2(b REFERENCES t1(a); Calling this function with table "t1" as an argument returns a pointer to the FKey structure representing the foreign key constraint on table "t2". Calling this function with "t2" as the argument would return a NULL pointer (as there are no FK constraints for which t2 is the parent table).
This function is called before generating code to update or delete a row contained in table pTab. If the operation is a DELETE, then parameter aChange is passed a NULL value. For an UPDATE, aChange points to an array of size N, where N is the number of columns in table pTab. If the i'th column is not modified by the UPDATE, then the corresponding entry in the aChange[] array is set to -1. If the column is modified, the value is 0 or greater. Parameter chngRowid is set to true if the UPDATE statement modifies the rowid fields of the table. If any foreign key processing will be required, this function returns non-zero. If there is no foreign key related processing, this function returns zero. For an UPDATE, this function returns 2 if: * There are any FKs for which pTab is the child and the parent table and any FK processing at all is required (even of a different FK), or * the UPDATE modifies one or more parent keys for which the action is not "NO ACTION" (i.e. is CASCADE, SET DEFAULT or SET NULL). Or, assuming some other foreign key processing is required, 1.
Reclaim the memory used by an index
The following functions are used to register the module with SQLite. If this module is being built as part of the SQLite core (SQLITE_CORE is defined), then sqlite3_open() will call sqlite3Fts5Init() directly. Or, if this module is being built as a loadable extension, sqlite3Fts5Init() is omitted and the two standard entry points sqlite3_fts_init() and sqlite3_fts5_init() defined instead.
Search a FuncDefHash for a function with the given name. Return a pointer to the matching FuncDef if found, or 0 if there is no match.
Determine if any of the arguments to the pExpr Function reference pSrcList. Return true if they do. Also return true if the function has no arguments or has only constant arguments. Return false if pExpr references columns but not columns of tables found in pSrcList.
Compute the column names for a SELECT statement. The only guarantee that SQLite makes about column names is that if the column has an AS clause assigning it a name, that will be the name used. That is the only documented guarantee. However, countless applications developed over the years have made baseless assumptions about column names and will break if those assumptions changes. Hence, use extreme caution when modifying this routine to avoid breaking legacy. See Also: sqlite3ColumnsFromExprList() The PRAGMA short_column_names and PRAGMA full_column_names settings are deprecated. The default setting is short=ON, full=OFF. 99.9% of all applications should operate this way. Nevertheless, we need to support the other modes for legacy: short=OFF, full=OFF: Column name is the text of the expression has it originally appears in the SELECT statement. In other words, the zSpan of the result expression. short=ON, full=OFF: (This is the default setting). If the result refers directly to a table column, then the result column name is just the table column name: COLUMN. Otherwise use zSpan. full=ON, short=ANY: If the result refers directly to a table column, then the result column name with the table name prefix, ex: TABLE.COLUMN. Otherwise use zSpan.
Generate code to do constraint checks prior to an INSERT or an UPDATE on table pTab. The regNewData parameter is the first register in a range that contains the data to be inserted or the data after the update. There will be pTab->nCol+1 registers in this range. The first register (the one that regNewData points to) will contain the new rowid, or NULL in the case of a WITHOUT ROWID table. The second register in the range will contain the content of the first table column. The third register will contain the content of the second table column. And so forth. The regOldData parameter is similar to regNewData except that it contains the data prior to an UPDATE rather than afterwards. regOldData is zero for an INSERT. This routine can distinguish between UPDATE and INSERT by checking regOldData for zero. For an UPDATE, the pkChng boolean is true if the true primary key (the rowid for a normal table or the PRIMARY KEY for a WITHOUT ROWID table) might be modified by the UPDATE. If pkChng is false, then the key of the iDataCur content table is guaranteed to be unchanged by the UPDATE. For an INSERT, the pkChng boolean indicates whether or not the rowid was explicitly specified as part of the INSERT statement. If pkChng is zero, it means that the either rowid is computed automatically or that the table is a WITHOUT ROWID table and has no rowid. On an INSERT, pkChng will only be true if the INSERT statement provides an integer value for either the rowid column or its INTEGER PRIMARY KEY alias. The code generated by this routine will store new index entries into registers identified by aRegIdx[]. No index entry is created for indices where aRegIdx[i]==0. The order of indices in aRegIdx[] is the same as the order of indices on the linked list of indices at pTab->pIndex. (2019-05-07) The generated code also creates a new record for the main table, if pTab is a rowid table, and stores that record in the register identified by aRegIdx[nIdx] - in other words in the first entry of aRegIdx[] past the last index. It is important that the record be generated during constraint checks to avoid affinity changes to the register content that occur after constraint checks but before the new record is inserted. The caller must have already opened writeable cursors on the main table and all applicable indices (that is to say, all indices for which aRegIdx[] is not zero). iDataCur is the cursor for the main table when inserting or updating a rowid table, or the cursor for the PRIMARY KEY index when operating on a WITHOUT ROWID table. iIdxCur is the cursor for the first index in the pTab->pIndex list. Cursors for other indices are at iIdxCur+N for the N-th element of the pTab->pIndex list. This routine also generates code to check constraints. NOT NULL, CHECK, and UNIQUE constraints are all checked. If a constraint fails, then the appropriate action is performed. There are five possible actions: ROLLBACK, ABORT, FAIL, REPLACE, and IGNORE. Constraint type Action What Happens --------------- ---------- ---------------------------------------- any ROLLBACK The current transaction is rolled back and sqlite3_step() returns immediately with a return code of SQLITE_CONSTRAINT. any ABORT Back out changes from the current command only (do not do a complete rollback) then cause sqlite3_step() to return immediately with SQLITE_CONSTRAINT. any FAIL Sqlite3_step() returns immediately with a return code of SQLITE_CONSTRAINT. The transaction is not rolled back and any changes to prior rows are retained. any IGNORE The attempt in insert or update the current row is skipped, without throwing an error. Processing continues with the next row. (There is an immediate jump to ignoreDest.) NOT NULL REPLACE The NULL value is replace by the default value for that column. If the default value is NULL, the action is the same as ABORT. UNIQUE REPLACE The other row that conflicts with the row being inserted is removed. CHECK REPLACE Illegal. The results in an exception. Which action to take is determined by the overrideError parameter. Or if overrideError==OE_Default, then the pParse->onError parameter is used. Or if pParse->onError==OE_Default then the onError value for the constraint is used.
Generate code that will assemble an index key and stores it in register regOut. The key with be for index pIdx which is an index on pTab. iCur is the index of a cursor open on the pTab table and pointing to the entry that needs indexing. If pTab is a WITHOUT ROWID table, then iCur must be the cursor of the PRIMARY KEY index. Return a register number which is the first in a block of registers that holds the elements of the index key. The block of registers has already been deallocated by the time this routine returns. If *piPartIdxLabel is not NULL, fill it in with a label and jump to that label if pIdx is a partial index that should be skipped. The label should be resolved using sqlite3ResolvePartIdxLabel(). A partial index should be skipped if its WHERE clause evaluates to false or null. If pIdx is not a partial index, *piPartIdxLabel will be set to zero which is an empty label that is ignored by sqlite3ResolvePartIdxLabel(). The pPrior and regPrior parameters are used to implement a cache to avoid unnecessary register loads. If pPrior is not NULL, then it is a pointer to a different index for which an index key has just been computed into register regPrior. If the current pIdx index is generating its key into the same sequence of registers and if pPrior and pIdx share a column in common, then the register corresponding to that column already holds the correct value and the loading of that register is skipped. This optimization is helpful when doing a DELETE or an INTEGRITY_CHECK on a table with multiple indices, and especially with the ROWID or PRIMARY KEY columns of the index.
This routine generates VDBE code that causes a single row of a single table to be deleted. Both the original table entry and all indices are removed. Preconditions: 1. iDataCur is an open cursor on the btree that is the canonical data store for the table. (This will be either the table itself, in the case of a rowid table, or the PRIMARY KEY index in the case of a WITHOUT ROWID table.) 2. Read/write cursors for all indices of pTab must be open as cursor number iIdxCur+i for the i-th index. 3. The primary key for the row to be deleted must be stored in a sequence of nPk memory cells starting at iPk. If nPk==0 that means that a search record formed from OP_MakeRecord is contained in the single memory location iPk. eMode: Parameter eMode may be passed either ONEPASS_OFF (0), ONEPASS_SINGLE, or ONEPASS_MULTI. If eMode is not ONEPASS_OFF, then the cursor iDataCur already points to the row to delete. If eMode is ONEPASS_OFF then this function must seek iDataCur to the entry identified by iPk and nPk before reading from it. If eMode is ONEPASS_MULTI, then this call is being made as part of a ONEPASS delete that affects multiple rows. In this case, if iIdxNoSeek is a valid cursor number (>=0) and is not the same as iDataCur, then its position should be preserved following the delete operation. Or, if iIdxNoSeek is not a valid cursor number, the position of iDataCur should be preserved instead. iIdxNoSeek: If iIdxNoSeek is a valid cursor number (>=0) not equal to iDataCur, then it identifies an index cursor (from within array of cursors starting at iIdxCur) that already points to the index entry to be deleted. Except, this optimization is disabled if there are BEFORE triggers since the trigger body might have moved the cursor.
This routine generates VDBE code that causes the deletion of all index entries associated with a single row of a single table, pTab Preconditions: 1. A read/write cursor "iDataCur" must be open on the canonical storage btree for the table pTab. (This will be either the table itself for rowid tables or to the primary key index for WITHOUT ROWID tables.) 2. Read/write cursors for all indices of pTab must be open as cursor number iIdxCur+i for the i-th index. (The pTab->pIndex index is the 0-th index.) 3. The "iDataCur" cursor must be already be positioned on the row that is to be deleted.
Read or write a four-byte big-endian integer value.
Interpret the given string as a boolean value.
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()
If zNum represents an integer that will fit in 32-bits, then set *pValue to that integer and return true. Otherwise return false. This routine accepts both decimal and hexadecimal notation for integers. Any non-numeric characters that following zNum are ignored. This is different from sqlite3Atoi64() which requires the input number to be zero-terminated.
Allocate or deallocate a block of nReg consecutive registers.
Allocate a single new register for use to hold some intermediate result.
Return the length (in bytes) of the token that begins at z[0]. Store the token type in *tokenType before returning.
Try to convert z into an unsigned 32-bit integer. Return true on success and false if there is an error. Only decimal notation is accepted.
Read a 64-bit variable-length integer from memory starting at p[0]. Return the number of bytes read. The value is stored in *v.
Read a 32-bit variable-length integer from memory starting at p[0]. Return the number of bytes read. The value is stored in *v. If the varint stored in p[0] is larger than can fit in a 32-bit unsigned integer, then set *v to 0xffffffff. A MACRO version, getVarint32, is provided which inlines the single-byte case. All code should use the MACRO version as this function assumes the single-byte case has already been handled.
Get a VDBE for the given parser context. Create a new one if necessary. If an error occurs, return NULL and leave a message in pParse.
pTab is a pointer to a Table structure representing a virtual-table. Return a pointer to the VTable object used by connection db to access this virtual-table, if one has been created, or NULL otherwise.
Code an OP_Halt that causes the vdbe to return an SQLITE_CONSTRAINT error. The onError parameter determines which (if any) of the statement and/or current transaction is rolled back.
If expression list pList contains an expression that was parsed with an explicit "NULLS FIRST" or "NULLS LAST" clause, leave an error in pParse and return non-zero. Otherwise, return zero.
Remove all entries from a hash table. Reclaim all memory. Call this routine to delete a hash table or to reset a hash table to the empty state.
Attempt to locate an element of the hash table pH with a key that matches pKey. Return the data for this element if it is found, or NULL if there is no match.
Turn bulk memory into a hash table object by initializing the fields of the Hash structure. "pNew" is a pointer to the hash table that is to be initialized.
Insert an element into the hash table pH. The key is pKey and the data is "data". If no element exists with a matching key, then a new element is created and NULL is returned. If another element already exists with the same key, then the new data replaces the old data and the old data is returned. The key is not copied in this instance. If a malloc fails, then the new data is returned and the hash table is unchanged. If the "data" parameter to this function is NULL, then the element corresponding to "key" is removed from the hash table.
Return the size of the header added to each page by this module.
Return the size of the header added by this middleware layer in the page-cache hierarchy.
Return the size of the header on each page of this PCACHE implementation.
Return true if the heap is currently under memory pressure - in other words if the amount of heap used is close to the limit set by sqlite3_soft_heap_limit().
Convert a BLOB literal of the form "x'hhhhhh'" into its binary value. Return a pointer to its binary value. Space to hold the binary value has been obtained from malloc and must be freed by the calling routine.
Translate a single byte of Hex into an integer. This routine only works if h really is a valid hexadecimal character: 0..9a..fA..F
Append a new element to the given IdList. Create a new IdList if need be. A new IdList is returned, or NULL if malloc() fails.
Delete an IdList.
Return the index in pList of the identifier named zId. Return -1 if not found.
pExpr is a comparison expression, eg. '=', '<', IN(...) etc. idx_affinity is the affinity of an indexed column. Return true if the index with affinity idx_affinity may be used to implement the comparison in pExpr.
Return a pointer to the column affinity string associated with index pIdx. A column affinity string has one character for each column in the table, according to the affinity of the column: Character Column affinity ------------------------------ 'A' BLOB 'B' TEXT 'C' NUMERIC 'D' INTEGER 'F' REAL An extra 'D' is appended to the end of the string to cover the rowid that appears as the last column in every index. Memory for the buffer containing the column index affinity string is managed along with the rest of the Index structure. It will be released when sqlite3DeleteIndex() is called.
Return the affinity for a single column of an index.
If the source-list item passed as an argument was augmented with an INDEXED BY clause, then try to locate the specified index. If there was such a clause and the named index cannot be found, return SQLITE_ERROR and leave an error in pParse. Otherwise, populate pFrom->pIndex and return SQLITE_OK.
Check to see if any sibling index (another index on the same table) of pIndex has the same root page number, and if it does, return true. This would indicate a corrupt schema.
Initialize all database files - the main database file, the file used to store temporary tables, and any additional database files created using ATTACH statements. Return a success code. If an error occurs, write an error message into *pzErrMsg. After a database is initialized, the DB_SchemaLoaded bit is set bit is set in the flags field of the Db structure.
This is the callback routine for the code that initializes the database. See sqlite3Init() below for additional information. This routine is also called from the OP_ParseSchema opcode of the VDBE. Each callback contains the following information: argv[0] = type of object: "table", "index", "trigger", or "view". argv[1] = name of thing being created argv[2] = associated table if an index or trigger argv[3] = root page number for table or index. 0 for trigger or view. argv[4] = SQL text for the CREATE statement.
Attempt to read the database schema and initialize internal data structures for a single database file. The index of the database file is given by iDb. iDb==0 is used for the main database. iDb==1 should never be used. iDb>=2 is used for auxiliary databases. Return one of the SQLITE_ error codes to indicate success or failure.
This routine is called to handle SQL of the following forms: insert into TABLE (IDLIST) values(EXPRLIST),(EXPRLIST),... insert into TABLE (IDLIST) select insert into TABLE (IDLIST) default values The IDLIST following the table name is always optional. If omitted, then a list of all (non-hidden) columns for the table is substituted. The IDLIST appears in the pColumn parameter. pColumn is NULL if IDLIST is omitted. For the pSelect parameter holds the values to be inserted for the first two forms shown above. A VALUES clause is really just short-hand for a SELECT statement that omits the FROM clause and everything else that follows. If the pSelect parameter is NULL, that means that the DEFAULT VALUES form of the INSERT statement is intended. The code generated follows one of four templates. For a simple insert with data coming from a single-row VALUES clause, the code executes once straight down through. Pseudo-code follows (we call this the "1st template"): open write cursor to <table> and its indices put VALUES clause expressions into registers write the resulting record into <table> cleanup The three remaining templates assume the statement is of the form INSERT INTO <table> SELECT ... If the SELECT clause is of the restricted form "SELECT * FROM <table2>" - in other words if the SELECT pulls all columns from a single table and there is no WHERE or LIMIT or GROUP BY or ORDER BY clauses, and if <table2> and <table1> are distinct tables but have identical schemas, including all the same indices, then a special optimization is invoked that copies raw records from <table2> over to <table1>. See the xferOptimization() function for the implementation of this template. This is the 2nd template. open a write cursor to <table> open read cursor on <table2> transfer all records in <table2> over to <table> close cursors foreach index on <table> open a write cursor on the <table> index open a read cursor on the corresponding <table2> index transfer all records from the read to the write cursors close cursors end foreach The 3rd template is for when the second template does not apply and the SELECT clause does not read from <table> at any time. The generated code follows this template: X <- A goto B A: setup for the SELECT loop over the rows in the SELECT load values into registers R..R+n yield X end loop cleanup after the SELECT end-coroutine X B: open write cursor to <table> and its indices C: yield X, at EOF goto D insert the select result into <table> from R..R+n goto C D: cleanup The 4th template is used if the insert statement takes its values from a SELECT but the data is being inserted into a table that is also read as part of the SELECT. In the third form, we have to use an intermediate table to store the results of the select. The template is like this: X <- A goto B A: setup for the SELECT loop over the tables in the SELECT load value into register R..R+n yield X end loop cleanup after the SELECT end co-routine R B: open temp table L: yield X, at EOF goto M insert row from R..R+n into temp table goto L M: open write cursor to <table> and its indices rewind temp table C: loop over rows of intermediate table transfer values form intermediate table into <table> end loop D: cleanup
Insert a new FuncDef into a FuncDefHash hash table.
Render an signed 64-bit integer as text. Store the result in zOut[]. The caller must ensure that zOut[] is at least 21 bytes in size.
Invoke the given busy handler. This routine is called when an operation failed to acquire a lock on VFS file pFile. If this routine returns non-zero, the lock is retried. If it returns 0, the operation aborts with an SQLITE_BUSY error.
Return true if CollSeq is the default built-in BINARY.
Make the IdChar function accessible from ctime.c and alter.c
pExpr points to an expression which implements a function. If it is appropriate to apply the LIKE optimization to that function then set aWc[0] through aWc[2] to the wildcard characters and the escape character and then return TRUE. If the function is not a LIKE-style function then return FALSE. The expression "a LIKE b ESCAPE c" is only considered a valid LIKE operator if c is a string literal that is exactly one byte in length. That one byte is stored in aWc[3]. aWc[3] is set to zero if there is no ESCAPE clause. *pIsNocase is set to true if uppercase and lowercase are equivalent for the function (default for LIKE). If the function makes the distinction between uppercase and lowercase (as does GLOB) then *pIsNocase is set to false.
Return true if the floating point value is Not a Number (NaN).
Check to make sure the given table is writable. If it is not writable, generate an error message and return 1. If it is writable return 0;
Return TRUE if the given string is a row-id column name.
Return true if pTab is a virtual table and zName is a shadow table name for that virtual table.
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
Given 1 to 3 identifiers preceding the JOIN keyword, determine the type of join. Return an integer constant that expresses that type in terms of the following bit values: JT_INNER JT_CROSS JT_OUTER JT_NATURAL JT_LEFT JT_RIGHT A full outer join is the combination of JT_LEFT and JT_RIGHT. If an illegal or unsupported join type is seen, then still return a join type, but put an error in the pParse structure.
The file-handle passed as the only argument is open on a journal file. Return true if this "journal file" is currently stored in heap memory, or false otherwise.
Parameter eMode must be one of the PAGER_JOURNALMODE_XXX constants defined in pager.h. This function returns the associated lowercase journal-mode name.
Open a journal file. The behaviour of the journal file depends on the value of parameter nSpill. If nSpill is 0, then the journal file is always create and accessed using the underlying VFS. If nSpill is less than zero, then all content is always stored in main-memory. Finally, if nSpill is a positive value, then the journal file is initially created in-memory but may be flushed to disk later on. In this case the journal file is flushed to disk either when it grows larger than nSpill bytes in size, or when sqlite3JournalCreate() is called.
Return the number of bytes required to store a JournalFile that uses vfs pVfs to create the underlying on-disk files.
Allocate a KeyInfo object sufficient for an index of N key columns and X extra columns.
Given an expression list, generate a KeyInfo structure that records the collating sequence for each expression in that expression list. If the ExprList is an ORDER BY or GROUP BY clause then the resulting KeyInfo structure is appropriate for initializing a virtual index to implement that clause. If the ExprList is the result set of a SELECT then the KeyInfo structure is appropriate for initializing a virtual index to implement a DISTINCT test. Space to hold the KeyInfo structure is obtained from malloc. The calling function is responsible for seeing that this structure is eventually freed.
Return a KeyInfo structure that is appropriate for the given Index. The caller should invoke sqlite3KeyInfoUnref() on the returned object when it has finished using it.
Make a new pointer to a KeyInfo object
Deallocate a KeyInfo object
Close the mutex on database connection db. Furthermore, if database connection db is a zombie (meaning that there has been a prior call to sqlite3_close(db) or sqlite3_close_v2(db)) and every sqlite3_stmt has now been finalized and every sqlite3_backup has finished, then free all resources.
This function returns the collation sequence for database native text encoding identified by the string zName. If the requested collation sequence is not available, or not available in the database native encoding, the collation factory is invoked to request it. If the collation factory does not supply such a sequence, and the sequence is available in another text encoding, then that is returned instead. If no versions of the requested collations sequence are available, or another error occurs, NULL is returned and an error message written into pParse. This routine is a wrapper around sqlite3FindCollSeq(). This routine invokes the collation factory if the named collation cannot be found and generates an error message. See also: sqlite3FindCollSeq(), sqlite3GetCollSeq()
Locate the in-memory structure that describes a particular database table given the name of that table and (optionally) the name of the database containing the table. Return NULL if not found. Also leave an error message in pParse->zErrMsg. The difference between this routine and sqlite3FindTable() is that this routine leaves an error message in pParse->zErrMsg where sqlite3FindTable() does not.
Locate the table identified by *p. This is a wrapper around sqlite3LocateTable(). The difference between sqlite3LocateTable() and this function is that this function restricts the search to schema (p->pSchema) if it is not NULL. p->pSchema may be non-NULL if it is part of a view or trigger program definition. See sqlite3FixSrcList() for details.
Convert an integer into a LogEst. In other words, compute an approximation for 10*log2(x).
Find (an approximate) sum of two LogEst values. This computation is not a simple "+" operator because LogEst is stored as a logarithmic value.
Convert a double into a LogEst In other words, compute an approximation for 10*log2(x).
Convert a LogEst into an integer. Note that this routine is only used when one or more of various non-standard compile-time options is enabled.
Count the number of slots of lookaside memory that are outstanding
Allocate memory. This routine is like sqlite3_malloc() except that it assumes the memory subsystem has already been initialized.
Deinitialize the memory allocation subsystem.
Initialize the memory allocation subsystem.
Return the memory allocator mutex. sqlite3_status() needs it.
Return the size of a memory allocation previously obtained from sqlite3Malloc() or sqlite3_malloc().
Allocate and zero memory.
Subqueries stores the original database, table and column names for their result sets in ExprList.a[].zSpan, in the form "DATABASE.TABLE.COLUMN". Check to see if the zSpan given to this routine matches the zDb, zTab, and zCol. If any of zDb, zTab, and zCol are NULL then those fields will match anything.
Evaluate a view and store its result in an ephemeral table. The pWhere argument is an optional WHERE clause that restricts the set of rows in the view that are to be added to the ephemeral table.
The code generator calls this routine if is discovers that it is possible to abort a statement prior to completion. In order to perform this abort without corrupting the database, we need to make sure that the statement is protected by a statement transaction. Technically, we only need to set the mayAbort flag if the isMultiWrite flag was previously set. There is a time dependency such that the abort must occur after the multiwrite. This makes some statements involving the REPLACE conflict resolution algorithm go a little faster. But taking advantage of this time dependency makes it more difficult to prove that the code is correct (in particular, it prevents us from writing an effective implementation of sqlite3AssertMayAbort()) and so we have chosen to take the safe route and skip the optimization.
Compare the values contained by the two memory cells, returning negative, zero or positive if pMem1 is less than, equal to, or greater than pMem2. Sorting order is NULL's first, followed by numbers (integers and reals) sorted numerically, followed by text ordered by the collating sequence pColl and finally blob's ordered by memcmp(). Two NULL values are considered equal by this function.
This routine is called when the extension is loaded. Register the new VFS.
Open an in-memory journal file.
This routine is the only routine in this file with external linkage. Populate the low-level memory allocation function pointers in sqlite3GlobalConfig.m with pointers to the routines in this file.
func Xsqlite3MisuseError(tls *libc.TLS, lineno int32) int32
Print into memory obtained from sqliteMalloc(). Use the internal %-conversion extensions.
Indicate that the statement currently under construction might write more than one entry (example: deleting one row then inserting another, inserting multiple rows in a table, or inserting a row and index entries.) If an abort occurs after some of these writes have completed, then it will be necessary to undo the completed writes.
Shutdown the mutex system. This call frees resources allocated by sqlite3MutexInit().
Initialize the mutex system.
Given a token, return a string that consists of the text of that token. Space to hold the returned string is obtained from sqliteMalloc() and must be freed by the calling function. Any quotation marks (ex: "name", 'name', [name], or `name`) that surround the body of the token are removed. Tokens are often just pointers into the original SQL text and so are not \000 terminated and are not persistent. The returned string is \000 terminated and is persistent.
Run the parser and code generator recursively in order to generate code for the SQL statement given onto the end of the pParse context currently under construction. When the parser is run recursively this way, the final OP_Halt is not appended and other initialization and finalization steps are omitted because those are handling by the outermost parser. Not everything is nestable. This facility is designed to permit INSERT, UPDATE, and DELETE operations against the schema table. Use care if you decide to try to use this routine for some other purposes.
A no-op destructor
Cause a function to throw an error if it was call from OP_PureFunc rather than OP_Function. OP_PureFunc means that the function must be deterministic, and should throw an error if it is given inputs that would make it non-deterministic. This routine is invoked by date/time functions that use non-deterministic features such as 'now'.
This routine reactivates the memory allocator and clears the db->mallocFailed flag as necessary. The memory allocator is not restarted if there are running VDBEs.
Call this routine to record the fact that an OOM (out-of-memory) error has happened. This routine will set db->mallocFailed, and also temporarily disable the lookaside memory allocator and interrupt any running VDBEs.
************* End of hash.c *********************************************** ************* Begin file opcodes.c **************************************** Automatically generated. Do not edit See the tool/mkopcodec.tcl script for details.
Open the sqlite_schema table stored in database number iDb for writing. The table is opened using cursor 0.
Generate code that will (1) acquire a lock for table pTab then (2) open pTab as cursor iCur. If pTab is a WITHOUT ROWID table, then it is the PRIMARY KEY index for that table that is actually opened.
Allocate cursors for the pTab table and all its indices and generate code to open and initialized those cursors. The cursor for the object that contains the complete data (normally the table itself, but the PRIMARY KEY index in the case of a WITHOUT ROWID table) is returned in *piDataCur. The first index cursor is returned in *piIdxCur. The number of indices is returned. Use iBase as the first cursor (either the *piDataCur for rowid tables or the first index for WITHOUT ROWID tables) if it is non-negative. If iBase is negative, then allocate the next available cursor. For a rowid table, *piDataCur will be exactly one less than *piIdxCur. For a WITHOUT ROWID table, *piDataCur will be somewhere in the range of *piIdxCurs, depending on where the PRIMARY KEY index appears on the pTab->pIndex list. If pTab is a virtual table, then this routine is a no-op and the *piDataCur and *piIdxCur values are left uninitialized.
Make sure the TEMP database is open and available for use. Return the number of errors. Leave any error messages in the pParse structure.
func Xsqlite3OsAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) int32
The following routines are convenience wrappers around methods of the sqlite3_file object. This is mostly just syntactic sugar. All of this would be completely automatic if SQLite were coded using C++ instead of plain old C.
func Xsqlite3OsCloseFree(tls *libc.TLS, pFile uintptr)
func Xsqlite3OsDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) int32
func Xsqlite3OsDlClose(tls *libc.TLS, pVfs uintptr, pHandle uintptr)
func Xsqlite3OsDlError(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr)
func Xsqlite3OsDlOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr) uintptr
func Xsqlite3OsDlSym(tls *libc.TLS, pVfs uintptr, pHdle uintptr, zSym uintptr) uintptr
The real implementation of xFetch and xUnfetch
Use sqlite3OsFileControl() when we are doing something that might fail and we need to know about the failures. Use sqlite3OsFileControlHint() when simply tossing information over the wall to the VFS and we do not really care if the VFS receives and understands the information since it is only a hint and can be safely ignored. The sqlite3OsFileControlHint() routine has no return value since the return value would be meaningless.
func Xsqlite3OsFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nPathOut int32, zPathOut uintptr) int32
This function is a wrapper around the OS specific implementation of sqlite3_os_init(). The purpose of the wrapper is to provide the ability to simulate a malloc failure, so that the handling of an error in sqlite3_os_init() by the upper layers can be tested.
func Xsqlite3OsLock(tls *libc.TLS, id uintptr, lockType int32) int32
The next group of routines are convenience wrappers around the VFS methods.
func Xsqlite3OsOpenMalloc(tls *libc.TLS, pVfs uintptr, zFile uintptr, ppFile uintptr, flags int32, pOutFlags uintptr) int32
func Xsqlite3OsRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) int32
func Xsqlite3OsRead(tls *libc.TLS, id uintptr, pBuf uintptr, amt int32, offset I64) int32
func Xsqlite3OsShmLock(tls *libc.TLS, id uintptr, offset int32, n int32, flags int32) int32
func Xsqlite3OsShmMap(tls *libc.TLS, id uintptr, iPage int32, pgsz int32, bExtend int32, pp uintptr) int32
func Xsqlite3OsShmUnmap(tls *libc.TLS, id uintptr, deleteFlag int32) int32
func Xsqlite3OsSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) int32
func Xsqlite3OsSync(tls *libc.TLS, id uintptr, flags int32) int32
func Xsqlite3OsTruncate(tls *libc.TLS, id uintptr, size I64) int32
func Xsqlite3OsUnfetch(tls *libc.TLS, id uintptr, iOff I64, p uintptr) int32
func Xsqlite3OsUnlock(tls *libc.TLS, id uintptr, lockType int32) int32
func Xsqlite3OsWrite(tls *libc.TLS, id uintptr, pBuf uintptr, amt int32, offset I64) int32
Free an allocated buffer obtained from sqlite3PageMalloc().
Malloc function used by SQLite to obtain space from the buffer configured using sqlite3_config(SQLITE_CONFIG_PAGECACHE) option. If no such buffer exists, this function falls back to sqlite3Malloc().
Return a pointer to the pPager->pBackup variable. The backup module in backup.c maintains the content of this variable. This module uses it opaquely as an argument to sqlite3BackupRestart() and sqlite3BackupUpdate() only.
Begin a write-transaction on the specified pager object. If a write-transaction has already been opened, this function is a no-op. If the exFlag argument is false, then acquire at least a RESERVED lock on the database file. If exFlag is true, then acquire at least an EXCLUSIVE lock. If such a lock is already held, no locking functions need be called. If the subjInMemory argument is non-zero, then any sub-journal opened within this transaction will be opened as an in-memory file. This has no effect if the sub-journal is already opened (as it may be when running in exclusive mode) or if the transaction does not require a sub-journal. If the subjInMemory argument is zero, then any required sub-journal is implemented in-memory if pPager is an in-memory database, or using a temporary file otherwise.
Parameter eStat must be one of SQLITE_DBSTATUS_CACHE_HIT, _MISS, _WRITE, or _WRITE+1. The SQLITE_DBSTATUS_CACHE_WRITE+1 case is a translation of SQLITE_DBSTATUS_CACHE_SPILL. The _SPILL case is not contiguous because it was added later. Before returning, *pnVal is incremented by the current cache hit or miss count, according to the value of eStat. If the reset parameter is non-zero, the cache hit or miss count is zeroed before returning.
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.
Unless this is an in-memory or temporary database, clear the pager cache.
Shutdown the page cache. Free all memory and close all files. If a transaction was in progress when this routine is called, that transaction is rolled back. All outstanding pages are invalidated and their memory is freed. Any attempt to use a page associated with this page cache after this function returns will likely result in a coredump. This function always succeeds. If a transaction is active an attempt is made to roll it back. If an error occurs during the rollback a hot journal may be left in the filesystem but no error is returned to the caller.
This function is called to close the connection to the log file prior to switching from WAL to rollback mode. Before closing the log file, this function attempts to take an EXCLUSIVE lock on the database file. If this cannot be obtained, an error (SQLITE_BUSY) is returned and the log connection is not closed. If successful, the EXCLUSIVE lock is not released before returning.
Sync the database file for the pager pPager. zSuper points to the name of a super-journal file that should be written into the individual journal file. zSuper may be NULL, which is interpreted as no super-journal (a single database transaction). This routine ensures that: * The database file change-counter is updated, * the journal is synced (unless the atomic-write optimization is used), * all dirty pages are written to the database file, * the database file is truncated (if required), and * the database file synced. The only thing that remains to commit the transaction is to finalize (delete, truncate or zero the first part of) the journal file (or delete the super-journal file if specified). Note that if zSuper==NULL, this does not overwrite a previous value passed to an sqlite3PagerCommitPhaseOne() call. If the final parameter - noSync - is true, then the database file itself is not synced. The caller must call sqlite3PagerSync() directly to sync the database file before calling CommitPhaseTwo() to delete the journal file in this case.
When this function is called, the database file has been completely updated to reflect the changes made by the current transaction and synced to disk. The journal file still exists in the file-system though, and if a failure occurs at this point it will eventually be used as a hot-journal and the current transaction rolled back. This function finalizes the journal file, either by deleting, truncating or partially zeroing it, so that it cannot be used for hot-journal rollback. Once this is done the transaction is irrevocably committed. If an error occurs, an IO error code is returned and the pager moves into the error state. Otherwise, SQLITE_OK is returned.
Return the pPager->iDataVersion value
A call to this routine tells the pager that it is not necessary to write the information on page pPg back to the disk, even though that page might be marked as dirty. This happens, for example, when the page has been added as a leaf of the freelist and so its content no longer matters. The overlying software layer calls this routine when all of the data on the given page is unused. The pager marks the page as clean so that it does not get written to disk. Tests show that this optimization can quadruple the speed of large DELETE operations. This optimization cannot be used with a temp-file, as the page may have been dirty at the start of the transaction. In that case, if memory pressure forces page pPg out of the cache, the data does need to be written out to disk so that it may be read back in if the current transaction is rolled back.
This function may only be called while a write-transaction is active in rollback. If the connection is in WAL mode, this call is a no-op. Otherwise, if the connection does not already have an EXCLUSIVE lock on the database file, an attempt is made to obtain one. If the EXCLUSIVE lock is already held or the attempt to obtain it is successful, or the connection is in WAL mode, SQLITE_OK is returned. Otherwise, either SQLITE_BUSY or an SQLITE_IOERR_XXX error code is returned.
Return the file handle for the database file associated with the pager. This might return NULL if the file has not yet been opened.
Return the full pathname of the database file. Except, if the pager is in-memory only, then return an empty string if nullIfMemDb is true. This routine is called with nullIfMemDb==1 when used to report the filename to the user, for compatibility with legacy behavior. But when the Btree needs to know the filename for matching to shared cache, it uses nullIfMemDb==0 so that in-memory databases can participate in shared-cache. The return value to this routine is always safe to use with sqlite3_uri_parameter() and sqlite3_filename_database() and friends.
Flush all unreferenced dirty pages to disk.
Dispatch all page fetch requests to the appropriate getter method.
Return a pointer to the data for the specified page.
Return a pointer to the Pager.nExtra bytes of "extra" space allocated along with the specified page.
Return the current journal mode.
Return true if this is an in-memory or temp-file backed pager.
Return TRUE if the database file is opened read-only. Return FALSE if the database is (in theory) writable.
Return the full pathname of the journal file.
Get/set the size-limit used for persistent journal files. Setting the size limit to -1 means no limit is enforced. An attempt to set a limit smaller than -1 is a no-op.
Return the file handle for the journal file (if it exists). This will be either the rollback journal or the WAL file.
Get/set the locking-mode for this pager. Parameter eMode must be one of PAGER_LOCKINGMODE_QUERY, PAGER_LOCKINGMODE_NORMAL or PAGER_LOCKINGMODE_EXCLUSIVE. If the parameter is not _QUERY, then the locking-mode is set to the value specified. The returned value is either PAGER_LOCKINGMODE_NORMAL or PAGER_LOCKINGMODE_EXCLUSIVE, indicating the current (possibly updated) locking-mode.
Acquire a page if it is already in the in-memory cache. Do not read the page from disk. Return a pointer to the page, or 0 if the page is not in cache. See also sqlite3PagerGet(). The difference between this routine and sqlite3PagerGet() is that _get() will go to the disk and read in the page if the page is not already in cache. This routine returns NULL if the page is not in cache or if a disk I/O error has ever happened.
Attempt to set the maximum database page count if mxPage is positive. Make no changes if mxPage is zero or negative. And never reduce the maximum page count below the current size of the database. Regardless of mxPage, return the current maximum page count.
Return the approximate number of bytes of memory currently used by the pager and its associated cache.
Move the page pPg to location pgno in the file. There must be no references to the page previously located at pgno (which we call pPgOld) though that page is allowed to be in cache. If the page previously located at pgno is not already in the rollback journal, it is not put there by by this routine. References to the page pPg remain valid. Updating any meta-data associated with pPg (i.e. data stored in the nExtra bytes allocated along with the page) is the responsibility of the caller. A transaction must be active when this routine is called. It used to be required that a statement transaction was not active, but this restriction has been removed (CREATE INDEX needs to move a page when a statement transaction is active). If the fourth argument, isCommit, is non-zero, then this page is being moved as part of a database reorganization just before the transaction is being committed. In this case, it is guaranteed that the database page pPg refers to will not be written to again within this transaction. This function may return SQLITE_NOMEM or an IO error code if an error occurs. Otherwise, it returns SQLITE_OK.
Return TRUE if the pager is in a state where it is OK to change the journalmode. Journalmode changes can only happen when the database is unmodified.
Allocate and initialize a new Pager object and put a pointer to it in *ppPager. The pager should eventually be freed by passing it to sqlite3PagerClose(). The zFilename argument is the path to the database file to open. If zFilename is NULL then a randomly-named temporary file is created and used as the file to be cached. Temporary files are be deleted automatically when they are closed. If zFilename is ":memory:" then all information is held in cache. It is never written to disk. This can be used to implement an in-memory database. The nExtra parameter specifies the number of bytes of space allocated along with each page reference. This space is available to the user via the sqlite3PagerGetExtra() API. When a new page is allocated, the first 8 bytes of this space are zeroed but the remainder is uninitialized. (The extra space is used by btree as the MemPage object.) The flags argument is used to specify properties that affect the operation of the pager. It should be passed some bitwise combination of the PAGER_* flags. The vfsFlags parameter is a bitmask to pass to the flags parameter of the xOpen() method of the supplied VFS when opening files. If the pager object is allocated and the specified file opened successfully, SQLITE_OK is returned and *ppPager set to point to the new pager object. If an error occurs, *ppPager is set to NULL and error code returned. This function may return SQLITE_NOMEM (sqlite3Malloc() is used to allocate memory), SQLITE_CANTOPEN or various SQLITE_IO_XXX errors.
func Xsqlite3PagerOpenSavepoint(tls *libc.TLS, pPager uintptr, nSavepoint int32) int32
The caller must be holding a SHARED lock on the database file to call this function. If the pager passed as the first argument is open on a real database file (not a temp file or an in-memory database), and the WAL file is not already open, make an attempt to open it now. If successful, return SQLITE_OK. If an error occurs or the VFS used by the pager does not support the xShmXXX() methods, return an error code. *pbOpen is not modified in either case. If the pager is open on a temp-file (or in-memory database), or if the WAL file is already open, set *pbOpen to 1 and return SQLITE_OK without doing anything.
This function may only be called when a read-transaction is open on the pager. It returns the total number of pages in the database. However, if the file is between 1 and <page-size> bytes in size, then this is considered a 1 page file.
Return the number of references to the specified page.
Read the first N bytes from the beginning of the file into memory that pDest points to. If the pager was opened on a transient file (zFilename==""), or opened on a file less than N bytes in size, the output buffer is zeroed and SQLITE_OK returned. The rationale for this is that this function is used to read database headers, and a new transient or zero sized database has a header than consists entirely of zeroes. If any IO error apart from SQLITE_IOERR_SHORT_READ is encountered, the error code is returned to the caller and the contents of the output buffer undefined.
Increment the reference count for page pPg.
The page handle passed as the first argument refers to a dirty page with a page number other than iNew. This function changes the page's page number to iNew and sets the value of the PgHdr.flags field to the value passed as the third parameter.
If a write transaction is open, then all changes made within the transaction are reverted and the current write-transaction is closed. The pager falls back to PAGER_READER state if successful, or PAGER_ERROR state if an error occurs. If the pager is already in PAGER_ERROR state when this function is called, it returns Pager.errCode immediately. No work is performed in this case. Otherwise, in rollback mode, this function performs two functions: 1) It rolls back the journal file, restoring all database file and in-memory cache pages to the state they were in when the transaction was opened, and 2) It finalizes the journal file, so that it is not used for hot rollback at any point in the future. Finalization of the journal file (task 2) is only performed if the rollback is successful. In WAL mode, all cache-entries containing data modified within the current transaction are either expelled from the cache or reverted to their pre-transaction state by re-reading data from the database or WAL files. The WAL transaction is then closed.
This function is called to rollback or release (commit) a savepoint. The savepoint to release or rollback need not be the most recently created savepoint. Parameter op is always either SAVEPOINT_ROLLBACK or SAVEPOINT_RELEASE. If it is SAVEPOINT_RELEASE, then release and destroy the savepoint with index iSavepoint. If it is SAVEPOINT_ROLLBACK, then rollback all changes that have occurred since the specified savepoint was created. The savepoint to rollback or release is identified by parameter iSavepoint. A value of 0 means to operate on the outermost savepoint (the first created). A value of (Pager.nSavepoint-1) means operate on the most recently created savepoint. If iSavepoint is greater than (Pager.nSavepoint-1), then this function is a no-op. If a negative value is passed to this function, then the current transaction is rolled back. This is different to calling sqlite3PagerRollback() because this function does not terminate the transaction or unlock the database, it just restores the contents of the database to its original state. In any case, all savepoints with an index greater than iSavepoint are destroyed. If this is a release operation (op==SAVEPOINT_RELEASE), then savepoint iSavepoint is also destroyed. This function may return SQLITE_NOMEM if a memory allocation fails, or an IO error code if an IO error occurs while rolling back a savepoint. If no errors occur, SQLITE_OK is returned.
Set the busy handler function. The pager invokes the busy-handler if sqlite3OsLock() returns SQLITE_BUSY when trying to upgrade from no-lock to a SHARED lock, or when trying to upgrade from a RESERVED lock to an EXCLUSIVE lock. It does *not* invoke the busy handler when upgrading from SHARED to RESERVED, or when upgrading from SHARED to EXCLUSIVE (which occurs during hot-journal rollback). Summary: Transition | Invokes xBusyHandler -------------------------------------------------------- NO_LOCK -> SHARED_LOCK | Yes SHARED_LOCK -> RESERVED_LOCK | No SHARED_LOCK -> EXCLUSIVE_LOCK | No RESERVED_LOCK -> EXCLUSIVE_LOCK | Yes If the busy-handler callback returns non-zero, the lock is retried. If it returns zero, then the SQLITE_BUSY error is returned to the caller of the pager API function.
Change the maximum number of in-memory pages that are allowed before attempting to recycle clean and unused pages.
Adjust settings of the pager to those specified in the pgFlags parameter. The "level" in pgFlags & PAGER_SYNCHRONOUS_MASK sets the robustness of the database to damage due to OS crashes or power failures by changing the number of syncs()s when writing the journals. There are four levels: OFF sqlite3OsSync() is never called. This is the default for temporary and transient files. NORMAL The journal is synced once before writes begin on the database. This is normally adequate protection, but it is theoretically possible, though very unlikely, that an inopertune power failure could leave the journal in a state which would cause damage to the database when it is rolled back. FULL The journal is synced twice before writes begin on the database (with some additional information - the nRec field of the journal header - being written in between the two syncs). If we assume that writing a single disk sector is atomic, then this mode provides assurance that the journal will not be corrupted to the point of causing damage to the database during rollback. EXTRA This is like FULL except that is also syncs the directory that contains the rollback journal after the rollback journal is unlinked. The above is for a rollback-journal mode. For WAL mode, OFF continues to mean that no syncs ever occur. NORMAL means that the WAL is synced prior to the start of checkpoint and that the database file is synced at the conclusion of the checkpoint if the entire content of the WAL was written back into the database. But no sync operations occur for an ordinary commit in NORMAL mode with WAL. FULL means that the WAL file is synced following each commit operation, in addition to the syncs associated with NORMAL. There is no difference between FULL and EXTRA for WAL mode. Do not confuse synchronous=FULL with SQLITE_SYNC_FULL. The SQLITE_SYNC_FULL macro means to use the MacOSX-style full-fsync using fcntl(F_FULLFSYNC). SQLITE_SYNC_NORMAL means to do an ordinary fsync() call. There is no difference between SQLITE_SYNC_FULL and SQLITE_SYNC_NORMAL on platforms other than MacOSX. But the synchronous=FULL versus synchronous=NORMAL setting determines when the xSync primitive is called and is relevant to all platforms. Numeric values associated with these states are OFF==1, NORMAL=2, and FULL=3.
Set the journal-mode for this pager. Parameter eMode must be one of: PAGER_JOURNALMODE_DELETE PAGER_JOURNALMODE_TRUNCATE PAGER_JOURNALMODE_PERSIST PAGER_JOURNALMODE_OFF PAGER_JOURNALMODE_MEMORY PAGER_JOURNALMODE_WAL The journalmode is set to the value specified if the change is allowed. The change may be disallowed for the following reasons: * An in-memory database can only have its journal_mode set to _OFF or _MEMORY. * Temporary databases cannot have _WAL journalmode. The returned indicate the current (possibly updated) journal-mode.
Change the maximum size of any memory mapping made of the database file.
Change the page size used by the Pager object. The new page size is passed in *pPageSize. If the pager is in the error state when this function is called, it is a no-op. The value returned is the error state error code (i.e. one of SQLITE_IOERR, an SQLITE_IOERR_xxx sub-code or SQLITE_FULL). Otherwise, if all of the following are true: * the new page size (value of *pPageSize) is valid (a power of two between 512 and SQLITE_MAX_PAGE_SIZE, inclusive), and * there are no outstanding page references, and * the database is either not an in-memory database or it is an in-memory database that currently consists of zero pages. then the pager object page size is set to *pPageSize. If the page size is changed, then this function uses sqlite3PagerMalloc() to obtain a new Pager.pTmpSpace buffer. If this allocation attempt fails, SQLITE_NOMEM is returned and the page size remains unchanged. In all other cases, SQLITE_OK is returned. If the page size is not changed, either because one of the enumerated conditions above is not true, the pager was in error state when this function was called, or because the memory allocation attempt failed, then *pPageSize is set to the old, retained page size before returning.
Change the maximum number of in-memory pages that are allowed before attempting to spill pages to journal.
This function is called to obtain a shared lock on the database file. It is illegal to call sqlite3PagerGet() until after this function has been successfully called. If a shared-lock is already held when this function is called, it is a no-op. The following operations are also performed by this function. 1) If the pager is currently in PAGER_OPEN state (no lock held on the database file), then an attempt is made to obtain a SHARED lock on the database file. Immediately after obtaining the SHARED lock, the file-system is checked for a hot-journal, which is played back if present. Following any hot-journal rollback, the contents of the cache are validated by checking the 'change-counter' field of the database file header and discarded if they are found to be invalid. 2) If the pager is running in exclusive-mode, and there are currently no outstanding references to any pages, and is in the error state, then an attempt is made to clear the error state by discarding the contents of the page cache and rolling back any open journal file. If everything is successful, SQLITE_OK is returned. If an IO error occurs while locking the database, checking for a hot-journal file or rolling back a journal file, the IO error code is returned.
Free as much memory as possible from the pager.
The caller currently has a read transaction open on the database. If this is not a WAL database, SQLITE_ERROR is returned. Otherwise, this function takes a SHARED lock on the CHECKPOINTER slot and then checks if the snapshot passed as the second argument is still available. If so, SQLITE_OK is returned. If the snapshot is not available, SQLITE_ERROR is returned. Or, if the CHECKPOINTER lock cannot be obtained, SQLITE_BUSY. If any error occurs (any value other than SQLITE_OK is returned), the CHECKPOINTER lock is released before returning.
If this is a WAL database, obtain a snapshot handle for the snapshot currently open. Otherwise, return an error.
If this is a WAL database, store a pointer to pSnapshot. Next time a read transaction is opened, attempt to read from the snapshot it identifies. If this is not a WAL database, return an error.
If this is a WAL database, call sqlite3WalSnapshotRecover(). If this is not a WAL database, return an error.
Release a lock obtained by an earlier successful call to sqlite3PagerSnapshotCheck().
Sync the database file to disk. This is a no-op for in-memory databases or pages with the Pager.noSync flag set. If successful, or if called on a pager for which it is a no-op, this function returns SQLITE_OK. Otherwise, an IO error code is returned.
Return a pointer to the "temporary page" buffer held internally by the pager. This is a buffer that is big enough to hold the entire content of a database page. This buffer is used internally during rollback and will be overwritten whenever a rollback occurs. But other modules are free to use it too, as long as no rollbacks are happening.
Truncate the in-memory database file image to nPage pages. This function does not actually modify the database file on disk. It just sets the internal state of the pager object so that the truncation will be done when the current transaction is committed. This function is only called right before committing a transaction. Once this function has been called, the transaction must either be rolled back or committed. It is not safe to call this function and then continue writing to the database.
Release a page reference. The sqlite3PagerUnref() and sqlite3PagerUnrefNotNull() may only be used if we know that the page being released is not the last page. The btree layer always holds page1 open until the end, so these first to routines can be used to release any page other than BtShared.pPage1. Use sqlite3PagerUnrefPageOne() to release page1. This latter routine checks the total number of outstanding pages and if the number of pages reaches zero it drops the database lock.
Return the VFS structure for the pager.
Return true if the underlying VFS for the given pager supports the primitives necessary for write-ahead logging.
Mark a data page as writeable. This routine must be called before making changes to a page. The caller must check the return value of this function and be careful not to change any page data unless this routine returns SQLITE_OK. The difference between this function and pager_write() is that this function also deals with the special case where 2 or more pages fit on a single disk sector. In this case all co-resident pages must have been written to the journal file before returning. If an error occurs, SQLITE_NOMEM or an IO error code is returned as appropriate. Otherwise, SQLITE_OK.
The main parser program. The first argument is a pointer to a structure obtained from "sqlite3ParserAlloc" which describes the current state of the parser. The second argument is the major token number. The third is the minor token. The fourth optional argument is whatever the user wants (and specified in the grammar) and is available for use by the action routines. Inputs: <ul> <li> A pointer to the parser (an opaque structure.) <li> The major token number. <li> The minor token number. <li> An option argument of a grammar-specified type. </ul> Outputs: None.
Add a new cleanup operation to a Parser. The cleanup should happen when the parser object is destroyed. But, beware: the cleanup might happen immediately. Use this mechanism for uncommon cleanups. There is a higher setup cost for this mechansim (an extra malloc), so it should not be used for common cleanups that happen on most calls. But for less common cleanups, we save a single NULL-pointer comparison in sqlite3ParserReset(), which reduces the total CPU cycle count. If a memory allocation error occurs, then the cleanup happens immediately. When either SQLITE_DEBUG or SQLITE_COVERAGE_TEST are defined, the pParse->earlyCleanup flag is set in that case. Calling code show verify that test cases exist for which this happens, to guard against possible use-after-free errors following an OOM. The preferred way to do this is to immediately follow the call to this routine with: testcase( pParse->earlyCleanup ); This routine returns a copy of its pPtr input (the third parameter) except if an early cleanup occurs, in which case it returns NULL. So another way to check for early cleanup is to check the return value. Or, stop using the pPtr parameter with this call and use only its return value thereafter. Something like this: pObj = sqlite3ParserAddCleanup(pParse, destructor, pObj);
Return the fallback token corresponding to canonical token iToken, or 0 if iToken has no fallback.
Clear all secondary memory allocations from the parser
Initialize a new parser that has already been allocated.
Free all memory allocations in the pParse object
This function is used to parse both URIs and non-URI filenames passed by the user to API functions sqlite3_open() or sqlite3_open_v2(), and for database URIs specified as part of ATTACH statements. The first argument to this function is the name of the VFS to use (or a NULL to signify the default VFS) if the URI does not contain a "vfs=xxx" query parameter. The second argument contains the URI (or non-URI filename) itself. When this function is called the *pFlags variable should contain the default flags to open the database handle with. The value stored in *pFlags may be updated before returning if the URI filename contains "cache=xxx" or "mode=xxx" query parameters. If successful, SQLITE_OK is returned. In this case *ppVfs is set to point to the VFS that should be used to open the database file. *pzFile is set to point to a buffer containing the name of the file to open. The value stored in *pzFile is a database name acceptable to sqlite3_uri_parameter() and is in the same format as names created using sqlite3_create_filename(). The caller must invoke sqlite3_free_filename() (not sqlite3_free()!) on the value returned in *pzFile to avoid a memory leak. If an error occurs, then an SQLite error code is returned and *pzErrMsg may be set to point to a buffer containing an English language error message. It is the responsibility of the caller to eventually release this buffer by calling sqlite3_free().
Return the global mutex used by this PCACHE implementation. The sqlite3_status() routine needs access to this mutex.
This function is called during initialization if a static buffer is supplied to use for the page-cache by passing the SQLITE_CONFIG_PAGECACHE verb to sqlite3_config(). Parameter pBuf points to an allocation large enough to contain 'n' buffers of 'sz' bytes each. This routine is called from sqlite3_initialize() and so it is guaranteed to be serialized already. There is no need for further mutexing.
Make every page in the cache clean.
Discard the contents of the cache.
Clear the PGHDR_NEED_SYNC flag from all dirty pages.
Clear the PGHDR_NEED_SYNC and PGHDR_WRITEABLE flag from all dirty pages.
Close a cache.
Return a list of all dirty pages in the cache, sorted by page number.
Drop a page from the cache. There must be exactly one reference to the page. This function deletes that reference, so after it returns the page pointed to by p is invalid.
Try to obtain a page from the cache. This routine returns a pointer to an sqlite3_pcache_page object if such an object is already in cache, or if a new one is created. This routine returns a NULL pointer if the object was not in cache and could not be created. The createFlags should be 0 to check for existing pages and should be 3 (not 1, but 3) to try to create a new page. If the createFlag is 0, then NULL is always returned if the page is not already in the cache. If createFlag is 1, then a new page is created only if that can be done without spilling dirty pages and without exceeding the cache size limit. The caller needs to invoke sqlite3PcacheFetchFinish() to properly initialize the sqlite3_pcache_page object and convert it into a PgHdr object. The sqlite3PcacheFetch() and sqlite3PcacheFetchFinish() routines are split this way for performance reasons. When separated they can both (usually) operate without having to push values to the stack on entry and pop them back off on exit, which saves a lot of pushing and popping.
This routine converts the sqlite3_pcache_page object returned by sqlite3PcacheFetch() into an initialized PgHdr object. This routine must be called after sqlite3PcacheFetch() in order to get a usable result.
If the sqlite3PcacheFetch() routine is unable to allocate a new page because no clean pages are available for reuse and the cache size limit has been reached, then this routine can be invoked to try harder to allocate a page. This routine might invoke the stress callback to spill dirty pages to the journal. It will then try to allocate the new page and will only fail to allocate a new page on an OOM error. This routine should be invoked only after sqlite3PcacheFetch() fails.
************************************************** General Interfaces ****** Initialize and shutdown the page cache subsystem. Neither of these functions are threadsafe.
Make sure the page is marked as clean. If it isn't clean already, make it so.
Make sure the page is marked as dirty. If it isn't dirty already, make it so.
Change the page number of page p to newPgno.
Create a new PCache object. Storage space to hold the object has already been allocated and is passed in as the p pointer. The caller discovers how much space needs to be allocated by calling sqlite3PcacheSize(). szExtra is some extra space allocated for each page. The first 8 bytes of the extra space will be zeroed as the page is allocated, but remaining content will be uninitialized. Though it is opaque to this module, the extra space really ends up being the MemPage structure in the pager.
Return the total number of pages in the cache.
Return the number of references to the page supplied as an argument.
Return the number of dirty pages currently in the cache, as a percentage of the configured cache size.
Increase the reference count of a supplied page by 1.
Return the total number of references to all pages held by the cache. This is not the total number of pages referenced, but the sum of the reference count for all pages.
Decrement the reference count on a page. If the page is clean and the reference count drops to 0, then it is made eligible for recycling.
This function is called to free superfluous dynamically allocated memory held by the pager system. Memory in use by any SQLite pager allocated by the current thread may be sqlite3_free()ed. nReq is the number of bytes of memory required. Once this much has been released, the function returns. The return value is the total number of bytes of memory released.
Set the suggested cache-size value.
This function is called during initialization (sqlite3_initialize()) to install the default pluggable cache module, assuming the user has not already provided an alternative.
Change the page size for PCache object. The caller must ensure that there are no outstanding page references when this function is called.
Set the suggested cache-spill value. Make no changes if if the argument is zero. Return the effective cache-spill size, which will be the larger of the szSpill and szCache.
Free up as much memory as possible from the page cache.
Return the size in bytes of a PCache object.
Drop every cache entry whose page number is greater than "pgno". The caller must ensure that there are no outstanding references to any pages other than page 1 with a page number greater than pgno. If there is a reference to page 1 and the pgno parameter passed to this function is 0, then the data area associated with page 1 is zeroed, but the page object is not dropped.
Allocate an Expr node which joins as many as two subtrees. One or both of the subtrees can be NULL. Return a pointer to the new Expr node. Or, if an OOM error occurs, set pParse->db->mallocFailed, free the subtrees and return NULL.
Add pSelect to the Expr.x.pSelect field. Or, if pExpr is NULL (due do a memory allocation failure) then delete the pSelect object.
Process a pragma statement. Pragmas are of this form: PRAGMA [schema.]id [= value] The identifier might also be a string. The value is a string, and identifier, or a number. If minusFlag is true, then the value is a number that was preceded by a minus sign. If the left side is "database.id" then pId1 is the database name and pId2 is the id. If the left side is just "id" then pId1 is the id and pId2 is any empty string.
Check to see if zTabName is really the name of a pragma. If it is, then register an eponymous virtual table for that pragma and return a pointer to the Module object for the new virtual table.
Return the PRIMARY KEY index of a table
func Xsqlite3Put4byte(tls *libc.TLS, p uintptr, v U32)
Return permyriadage progress indications for the two main stages of an RBU update.
Close the RBU handle.
Create an RBU VFS named zName that accesses the underlying file-system via existing VFS zParent. The new object is registered as a non-default VFS with SQLite before returning.
Return the database handle used by pRbu.
Deregister and destroy an RBU vfs created by an earlier call to sqlite3rbu_create_vfs().
Open and return a new RBU handle.
Return the total number of key-value operations (inserts, deletes or updates) that have been performed on the target database since the current RBU update was started.
Return the current state of the RBU vacuum or update operation.
Step the RBU object.
Configure the aggregate temp file size limit for this RBU handle.
Open a handle to begin or resume an RBU VACUUM operation.
Return TRUE if shadow tables should be read-only in the current context.
This routine is a no-op if the database schema is already initialized. Otherwise, the schema is loaded. An error code is returned.
Change the size of an existing memory allocation
Compare a floating point value to an integer. Return true if the two values are the same within the precision of the floating point value. This function assumes that i was obtained by assignment from r1. For some versions of GCC on 32-bit machines, if you do the more obvious comparison of "r1==(double)i" you sometimes get an answer of false even though the r1 and (double)i values are bit-for-bit the same.
All of the FuncDef structures in the aBuiltinFunc[] array above to the global function hash table. This occurs at start-time (as a consequence of calling sqlite3_initialize()). After this routine runs
This function registered all of the above C functions as SQL functions. This should be the only routine in this file with external linkage.
Re-register the built-in LIKE functions. The caseSensitive parameter determines whether or not the LIKE operator is case sensitive.
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.
Generate code for the REINDEX command. REINDEX -- 1 REINDEX <collation> -- 2 REINDEX ?<database>.?<tablename> -- 3 REINDEX ?<database>.?<indexname> -- 4 Form 1 causes all indices in all attached databases to be rebuilt. Form 2 rebuilds all indices in all databases that use the named collating function. Forms 3 and 4 rebuild the named index or all indices associated with the named table.
func Xsqlite3ReleaseTempRange(tls *libc.TLS, pParse uintptr, iReg int32, nReg int32)
Deallocate a register, making available for reuse for some other purpose.
Remove all nodes that are part of expression-list pEList from the rename list.
Remove all nodes that are part of expression pExpr from the rename list.
Remember that the parser tree element pPtr was created using the token pToken. In other words, construct a new RenameToken object and add it to the list of RenameToken objects currently being built up in pParse->pRename. The pPtr argument is returned so that this routine can be used with tail recursion in tokenExpr() routine, for a small performance improvement.
It is assumed that there is already a RenameToken object associated with parse tree element pFrom. This function remaps the associated token to parse tree element pTo.
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.
Rerun the compilation of a statement after a schema change. If the statement is successfully recompiled, return SQLITE_OK. Otherwise, if the statement cannot be recompiled because another connection has locked the sqlite3_schema table, return SQLITE_LOCKED. If any other error occurs, return SQLITE_SCHEMA.
Erase all schema information from all attached databases (including "main" and "temp") for a single database connection.
Reset the schema for the database at index iDb. Also reset the TEMP schema. The reset is deferred if db->nSchemaLock is not zero. Deferred resets may be run by calling with iDb<0.
Resolve all names for all expression in an expression list. This is just like sqlite3ResolveExprNames() except that it works for an expression list rather than a single expression.
This routine walks an expression tree and resolves references to table columns and result-set columns. At the same time, do error checking on function usage and set a flag if any aggregate functions are seen. To resolve table columns references we look for nodes (or subtrees) of the form X.Y.Z or Y.Z or just Z where X: The name of a database. Ex: "main" or "temp" or the symbolic name assigned to an ATTACH-ed database. Y: The name of a table in a FROM clause. Or in a trigger one of the special names "old" or "new". Z: The name of a column in table Y. The node at the root of the subtree is modified as follows: Expr.op Changed to TK_COLUMN Expr.pTab Points to the Table object for X.Y Expr.iColumn The column index in X.Y. -1 for the rowid. Expr.iTable The VDBE cursor number for X.Y To resolve result-set references, look for expression nodes of the form Z (with no X and Y prefix) where the Z matches the right-hand size of an AS clause in the result-set of a SELECT. The Z expression is replaced by a copy of the left-hand side of the result-set expression. Table-name and function resolution occurs on the substituted expression tree. For example, in: SELECT a+b AS x, c+d AS y FROM t1 ORDER BY x; The "x" term of the order by is replaced by "a+b" to render: SELECT a+b AS x, c+d AS y FROM t1 ORDER BY a+b; Function calls are checked to make sure that the function is defined and that the correct number of arguments are specified. If the function is an aggregate function, then the NC_HasAgg flag is set and the opcode is changed from TK_FUNCTION to TK_AGG_FUNCTION. If an expression contains aggregate functions then the EP_Agg property on the expression is set. An error message is left in pParse if anything is amiss. The number if errors is returned.
Check every term in the ORDER BY or GROUP BY clause pOrderBy of the SELECT statement pSelect. If any term is reference to a result set expression (as determined by the ExprList.a.u.x.iOrderByCol field) then convert that term into a copy of the corresponding result set column. If any errors are detected, add an error message to pParse and return non-zero. Return zero if no errors are seen.
If a prior call to sqlite3GenerateIndexKey() generated a jump-over label because it was a partial index, then this routine should be called to resolve that label.
Resolve all names in all expressions of a SELECT and in all decendents of the SELECT, including compounds off of p->pPrior, subqueries in expressions, and subqueries used as FROM clause terms. See sqlite3ResolveExprNames() for a description of the kinds of transformations that occur. All SELECT statements should have been expanded using sqlite3SelectExpand() prior to invoking this routine.
Resolve names in expressions that can only reference a single table or which cannot reference any tables at all. Examples: "type" flag ------------ (1) CHECK constraints NC_IsCheck (2) WHERE clauses on partial indices NC_PartIdx (3) Expressions in indexes on expressions NC_IdxExpr (4) Expression arguments to VACUUM INTO. 0 (5) GENERATED ALWAYS as expressions NC_GenCol In all cases except (4), the Expr.iTable value for Expr.op==TK_COLUMN nodes of the expression is set to -1 and the Expr.iColumn value is set to the column number. In case (4), TK_COLUMN nodes cause an error. Any errors cause an error message to be set in pParse.
Force the INT64 value currently stored as the result to be a MEM_IntReal value. See the SQLITE_TESTCTRL_RESULT_INTREAL test-control.
Given a SELECT statement, generate a Table structure that describes the result set of that SELECT.
Rollback all database files. If tripCode is not SQLITE_OK, then any write cursors are invalidated ("tripped" - as in "tripping a circuit breaker") and made to return tripCode if there are any further attempts to use that cursor. Read cursors remain open and valid but are "saved" in case the table pages are moved around.
This function is called by the VDBE to adjust the internal schema used by SQLite when the btree layer moves a table root page. The root-page of a table or index in database iDb has changed from iFrom to iTo. Ticket #1728: The symbol table might still contain information on tables and/or indices that are the process of being deleted. If you are unlucky, one of those deleted indices or tables might have the same rootpage number as the real table or index that is being moved. So we cannot stop searching after the first match because the first match might be for one of the deleted indices or tables and not the table/index that is actually being moved. We must continue looping until all tables and indices with rootpage==iFrom have been converted to have a rootpage of iTo in order to be certain that we got the right one.
Code an OP_Halt due to non-unique rowid.
Deallocate all chunks from a RowSet. This frees all memory that the RowSet has allocated over its lifetime. This routine is the destructor for the RowSet.
Deallocate all chunks from a RowSet. This frees all memory that the RowSet has allocated over its lifetime. This routine is the destructor for the RowSet.
Allocate a RowSet object. Return NULL if a memory allocation error occurs.
Insert a new value into a RowSet. The mallocFailed flag of the database connection is set if a memory allocation fails.
Extract the smallest element from the RowSet. Write the element into *pRowid. Return 1 on success. Return 0 if the RowSet is already empty. After this routine has been called, the sqlite3RowSetInsert() routine may not be called again. This routine may not be called after sqlite3RowSetTest() has been used. Older versions of RowSet allowed that, but as the capability was not used by the code generator, it was removed for code economy.
Check to see if element iRowid was inserted into the rowset as part of any insert batch prior to iBatch. Return 1 or 0. If this is the first test of a new batch and if there exist entries on pRowSet->pEntry, then sort those entries into the forest at pRowSet->pForest so that they can be tested.
Register the r-tree module with database handle db. This creates the virtual table module "rtree" and the debugging/analysis scalar function "rtreenode".
Run the parser on the given SQL string. The parser structure is passed in. An SQLITE_ status code is returned. If an error occurs then an and attempt is made to write an error message into memory obtained from sqlite3_malloc() and to make *pzErrMsg point to that error message.
This routine implements the OP_Vacuum opcode of the VDBE.
Check to make sure we have a valid db pointer. This test is not foolproof but it does provide some measure of protection against misuse of the interface such as passing in db pointers that are NULL or which have been previously closed. If this routine returns 1 it means that the db pointer is valid and 0 if it should not be dereferenced for any reason. The calling function should invoke SQLITE_MISUSE immediately. sqlite3SafetyCheckOk() requires that the db pointer be valid for use. sqlite3SafetyCheckSickOrOk() allows a db pointer that failed to open properly and is not fit for general use but which can be used as an argument to sqlite3_errmsg() or sqlite3_close().
This function is called by the parser when it parses a command to create, release or rollback an SQL savepoint.
Free all resources held by the schema structure. The void* argument points at a Schema struct. This function does not call sqlite3DbFree(db, ) on the pointer itself, it just cleans up subsidiary resources (i.e. the contents of the schema hash tables). The Schema.cache_size variable is not cleared.
Find and return the schema associated with a BTree. Create a new one if necessary.
Convert a schema pointer into the iDb index that indicates which database file in db->aDb[] the schema refers to. If the same database is attached more than once, the first attached database is returned.
Return a sanitized version of the sector-size of OS file pFile. The return value is guaranteed to lie between 32 and MAX_SECTOR_SIZE.
Generate code for the SELECT statement given in the p argument. The results are returned according to the SelectDest structure. See comments in sqliteInt.h for further information. This routine returns the number of errors. If any errors are encountered, then an appropriate error message is left in pParse->zErrMsg. This routine does NOT free the Select structure passed in. The calling function needs to do that.
Add type and collation information to a column list based on a SELECT statement. The column list presumably came from selectColumnNamesFromExprList(). The column list has only names, not types or collations. This routine goes through and adds the types and collations. This routine requires that all identifiers in the SELECT statement be resolved.
Delete the given Select structure and all of its substructures.
Initialize a SelectDest structure.
func Xsqlite3SelectDup(tls *libc.TLS, db uintptr, pDup uintptr, flags int32) uintptr
Return the maximum height of any expression tree referenced by the select statement passed as an argument.
Allocate a new Select structure and return a pointer to that structure.
Name of the connection operator, used for error messages.
If the SELECT passed as the second argument has an associated WITH clause, pop it from the stack stored as part of the Parse object. This function is used as the xSelectCallback2() callback by sqlite3SelectExpand() when walking a SELECT tree to resolve table names and other FROM clause elements.
This routine sets up a SELECT statement for processing. The following is accomplished: * VDBE Cursor numbers are assigned to all FROM-clause terms. * Ephemeral Table objects are created for all FROM-clause subqueries. * ON and USING clauses are shifted into WHERE statements * Wildcards "*" and "TABLE.*" in result sets are expanded. * Identifiers in expression are matched to tables. This routine acts recursively on all subqueries within the SELECT.
This is a SELECT-node callback for the expression walker that always "fails". By "fail" in this case, we mean set pWalker->eCode to zero and abort. This callback is used by multiple expression walkers.
No-op routine for the parse-tree walker for SELECT statements. subquery in the parser tree.
Error message for when two or more terms of a compound select have different size result sets.
Set the EP_FromJoin property on all terms of the given expression. And set the Expr.iRightJoinTable to iTable for every term in the expression. The EP_FromJoin property is used on terms of an expression to tell the LEFT OUTER JOIN processing logic that this term is part of the join restriction specified in the ON or USING clause and not a part of the more general WHERE clause. These terms are moved over to the WHERE clause during join processing but we need to remember that they originated in the ON or USING clause. The Expr.iRightJoinTable tells the WHERE clause processing that the expression depends on table iRightJoinTable even if that table is not explicitly mentioned in the expression. That information is needed for cases like this: SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.b AND t1.x=5 The where clause needs to defer the handling of the t1.x=5 term until after the t2 loop of the join. In that way, a NULL t2 row will be inserted whenever t1.x!=5. If we do not defer the handling of t1.x=5, it will be processed immediately after the t1 loop and rows with t1.x!=5 will never appear in the output, which is incorrect.
Free any prior content in *pz and replace it with a copy of zNew.
Change the text encoding for a database connection. This means that the pDfltColl must change as well.
Return true if zName is a shadow table name in the current database connection. zName is temporarily modified while this routine is running, but is restored to its original value prior to this routine returning.
Append a new table name to the given SrcList. Create a new SrcList if need be. A new entry is created in the SrcList even if pTable is NULL. A SrcList is returned, or NULL if there is an OOM error or if the SrcList grows to large. The returned SrcList might be the same as the SrcList that was input or it might be a new one. If an OOM error does occurs, then the prior value of pList that is input to this routine is automatically freed. If pDatabase is not null, it means that the table has an optional database name prefix. Like this: "database.table". The pDatabase points to the table name and the pTable points to the database name. The SrcList.a[].zName field is filled with the table name which might come from pTable (if pDatabase is NULL) or from pDatabase. SrcList.a[].zDatabase is filled with the database name from pTable, or with NULL if no database is specified. In other words, if call like this: sqlite3SrcListAppend(D,A,B,0); Then B is a table name and the database name is unspecified. If called like this: sqlite3SrcListAppend(D,A,B,C); Then C is the table name and B is the database name. If C is defined then so is B. In other words, we never have a case where: sqlite3SrcListAppend(D,A,0,C); Both pTable and pDatabase are assumed to be quoted. They are dequoted before being added to the SrcList.
This routine is called by the parser to add a new term to the end of a growing FROM clause. The "p" parameter is the part of the FROM clause that has already been constructed. "p" is NULL if this is the first term of the FROM clause. pTable and pDatabase are the name of the table and database named in the FROM clause term. pDatabase is NULL if the database name qualifier is missing - the usual case. If the term has an alias, then pAlias points to the alias token. If the term is a subquery, then pSubquery is the SELECT statement that the subquery encodes. The pTable and pDatabase parameters are NULL for subqueries. The pOn and pUsing parameters are the content of the ON and USING clauses. Return a new SrcList which encodes is the FROM with the new term added.
Append the contents of SrcList p2 to SrcList p1 and return the resulting SrcList. Or, if an error occurs, return NULL. In all cases, p1 and p2 are deleted by this function.
Assign VdbeCursor index numbers to all tables in a SrcList
Delete an entire SrcList including all its substructure.
If cursors, triggers, views and subqueries are all omitted from the build, then none of the following routines, except for sqlite3SelectDup(), can be called. sqlite3SelectDup() is sometimes called with a NULL argument.
Expand the space allocated for the given SrcList object by creating nExtra new slots beginning at iStart. iStart is zero based. New slots are zeroed. For example, suppose a SrcList initially contains two entries: A,B. To append 3 new entries onto the end, do this: sqlite3SrcListEnlarge(db, pSrclist, 3, 2); After the call above it would contain: A, B, nil, nil, nil. If the iStart argument had been 1 instead of 2, then the result would have been: A, nil, nil, nil, B. To prepend the new slots, the iStart value would be 0. The result then would be: nil, nil, nil, A, B. If a memory allocation fails or the SrcList becomes too large, leave the original SrcList unchanged, return NULL, and leave an error message in pParse.
Add the list of function arguments to the SrcList entry for a table-valued-function.
Add an INDEXED BY or NOT INDEXED clause to the most recently added element of the source-list passed as the second argument.
While a SrcList can in general represent multiple tables and subqueries (as in the FROM clause of a SELECT statement) in this case it contains the name of a single table, as one might find in an INSERT, DELETE, or UPDATE statement. Look up that table in the symbol table and return a pointer. Set an error message and return NULL if the table name is not found or if any other error occurs. The following fields are initialized appropriate in pSrc: pSrc->a[0].pTab Pointer to the Table object pSrc->a[0].pIndex Pointer to the INDEXED BY index, if there is one
When building up a FROM clause in the parser, the join operator is initially attached to the left operand. But the code generator expects the join operator to be on the right operand. This routine Shifts all join operators from left to right for an entire FROM clause. Example: Suppose the join is like this: A natural cross join B The operator is "natural cross join". The A and B operands are stored in p->a[0] and p->a[1], respectively. The parser initially stores the operator with A. This routine shifts that operator over to B.
Begin constructing a new table representation in memory. This is the first of several action routines that get called in response to a CREATE TABLE statement. In particular, this routine is called after seeing tokens "CREATE" and "TABLE" and the table name. The isTemp flag is true if the table should be stored in the auxiliary database file instead of in the main database file. This is normally the case when the "TEMP" or "TEMPORARY" keyword occurs in between CREATE and TABLE. The new table record is initialized and put in pParse->pNewTable. As more of the CREATE TABLE statement is parsed, additional action routines will be called to add more information to this record. At the end of the CREATE TABLE statement, the sqlite3EndTable() routine is called to complete the construction of the new table record.
Extract the iCol-th column from the nRec-byte record in pRec. Write the column value into *ppVal. If *ppVal is initially NULL then a new sqlite3_value object is allocated. If *ppVal is initially NULL then the caller is responsible for ensuring that the value written into *ppVal is eventually freed.
Unless it is NULL, the argument must be an UnpackedRecord object returned by an earlier call to sqlite3Stat4ProbeSetValue(). This call deletes the object.
This function is used to allocate and populate UnpackedRecord structures intended to be compared against sample index keys stored in the sqlite_stat4 table. A single call to this function populates zero or more fields of the record starting with field iVal (fields are numbered from left to right starting with 0). A single field is populated if: * (pExpr==0). In this case the value is assumed to be an SQL NULL, * The expression is a bound variable, and this is a reprepare, or * The sqlite3ValueFromExpr() function is able to extract a value from the expression (i.e. the expression is a literal value). Or, if pExpr is a TK_VECTOR, one field is populated for each of the vector components that match either of the two latter criteria listed above. Before any value is appended to the record, the affinity of the corresponding column within index pIdx is applied to it. Before this function returns, output parameter *pnExtract is set to the number of values appended to the record. When this function is called, *ppRec must either point to an object allocated by an earlier call to this function, or must be NULL. If it is NULL and a value can be successfully extracted, a new UnpackedRecord is allocated (and *ppRec set to point to it) before returning. Unless an error is encountered, SQLITE_OK is returned. It is not an error if a value cannot be extracted from pExpr. If an error does occur, an SQLite error code is returned.
Attempt to extract a value from expression pExpr using the methods as described for sqlite3Stat4ProbeSetValue() above. If successful, set *ppVal to point to a new value object and return SQLITE_OK. If no value can be extracted, but no other error occurs (e.g. OOM), return SQLITE_OK and set *ppVal to NULL. Or, if an error does occur, return an SQLite error code. The final value of *ppVal is undefined in this case.
Adjust the highwater mark if necessary. The caller must hold the appropriate mutex.
Add N to the value of a status record. The caller must hold the appropriate mutex. (Locking is checked by assert()). The StatusUp() routine can accept positive or negative values for N. The value of N is added to the current status value and the high-water mark is adjusted if necessary. The StatusDown() routine lowers the current value by N. The highwater mark is unchanged. N must be non-negative for StatusDown().
Return the current value of a status parameter. The caller must be holding the appropriate mutex.
Return the current time for a statement. If the current time is requested more than once within the same run of a single prepared statement, the exact same time is returned for each invocation regardless of the amount of time that elapses between invocations. In other words, the time returned is always the time of the first call.
Convert a storage column number into a table column number. The storage column number (0,1,2,....) is the index of the value as it appears in the record on disk. The true column number is the index (0,1,2,...) of the column in the CREATE TABLE statement. The storage column number is less than the table column number if and only there are VIRTUAL columns to the left. If SQLITE_OMIT_GENERATED_COLUMNS, this routine is a no-op macro.
Initialize a string accumulator. p: The accumulator to be initialized. db: Pointer to a database connection. May be NULL. Lookaside memory is used if not NULL. db->mallocFailed is set appropriately when not NULL. zBase: An initial buffer. May be NULL in which case the initial buffer is malloced. n: Size of zBase in bytes. If total space requirements never exceed n then no memory allocations ever occur. mx: Maximum number of bytes to accumulate. If mx==0 then no memory allocations will ever occur.
func Xsqlite3StrICmp(tls *libc.TLS, zLeft uintptr, zRight uintptr) int32
Compute an 8-bit hash on a string that is insensitive to case differences
Compute a string length that is limited to what can be stored in lower 30 bits of a 32-bit signed integer. The value returned will never be negative. Nor will it ever be greater than the actual length of the string. For very long strings (greater than 1GiB) the value returned might be less than the true string length.
Load the Parse object passed as the first argument with an error message of the form: "sub-select returns N columns - expected M"
Load the sqlite3.iSysErrno field if that is an appropriate thing to do based on the SQLite error code in rc.
Compute the affinity string for table pTab, if it has not already been computed. As an optimization, omit trailing SQLITE_AFF_BLOB affinities. If the affinity exists (if it is no entirely SQLITE_AFF_BLOB values) and if iReg>0 then code an OP_Affinity opcode that will set the affinities for register iReg and following. Or if affinities exists and iReg==0, then just set the P4 operand of the previous opcode (which should be an OP_MakeRecord) to the affinity string. A column affinity string has one character per column: Character Column affinity ------------------------------ 'A' BLOB 'B' TEXT 'C' NUMERIC 'D' INTEGER 'E' REAL
Return the affinity character for a single column of a table.
Convert an table column number into a index column number. That is, for the column iCol in the table (as defined by the CREATE TABLE statement) find the (first) offset of that column in index pIdx. Or return -1 if column iCol is not used in index pIdx.
Convert a table column number into a storage column number. The storage column number (0,1,2,....) is the index of the value as it appears in the record on disk. Or, if the input column is the N-th virtual column (zero-based) then the storage number is the number of non-virtual columns in the table plus N. The true column number is the index (0,1,2,...) of the column in the CREATE TABLE statement. If the input column is a VIRTUAL column, then it should not appear in storage. But the value sometimes is cached in registers that follow the range of registers used to construct storage. This avoids computing the same VIRTUAL column multiple times, and provides values for use by OP_Param opcodes in triggers. Hence, if the input column is a VIRTUAL table, put it after all the other columns. In the following, N means "normal column", S means STORED, and V means VIRTUAL. Suppose the CREATE TABLE has columns like this: CREATE TABLE ex(N,S,V,N,S,V,N,S,V); -- 0 1 2 3 4 5 6 7 8 Then the mapping from this function is as follows: INPUTS: 0 1 2 3 4 5 6 7 8 OUTPUTS: 0 1 6 2 3 7 4 5 8 So, in other words, this routine shifts all the virtual columns to the end. If SQLITE_OMIT_GENERATED_COLUMNS then there are no virtual columns and this routine is a no-op macro. If the pTab does not have any virtual columns, then this routine is no-op that always return iCol. If iCol is negative (indicating the ROWID column) then this routine return iCol.
func Xsqlite3TableLock(tls *libc.TLS, pParse uintptr, iDb int32, iTab Pgno, isWriteLock U8, zName uintptr)
This function returns true if main-memory should be used instead of a temporary file for transient pager files and statement journals. The value returned depends on the value of db->temp_store (runtime parameter) and the compile time value of SQLITE_TEMP_STORE. The following table describes the relationship between these two values and this functions return value. SQLITE_TEMP_STORE db->temp_store Location of temporary database ----------------- -------------- ------------------------------ 0 any file (return 0) 1 1 file (return 0) 1 2 memory (return 1) 1 0 file (return 0) 2 1 file (return 0) 2 2 memory (return 1) 2 0 memory (return 1) 3 any memory (return 1)
Create a new thread
Get the results of the thread
Generate a Token object from a string
Transfer all bindings from the first statement over to the second.
Triggers may access values stored in the old.* or new.* pseudo-table. This function returns a 32-bit bitmask indicating which columns of the old.* or new.* tables actually are used by triggers. This information may be used by the caller, for example, to avoid having to load the entire old.* record into memory when executing an UPDATE or DELETE command. Bit 0 of the returned mask is set if the left-most column of the table may be accessed using an [old|new].<col> reference. Bit 1 is set if the second leftmost column value is required, and so on. If there are more than 32 columns in the table, and at least one of the columns with an index greater than 32 may be accessed, 0xffffffff is returned. It is not possible to determine if the old.rowid or new.rowid column is accessed by triggers. The caller must always assume that it is. Parameter isNew must be either 1 or 0. If it is 0, then the mask returned applies to the old.* table. If 1, the new.* table. Parameter tr_tm must be a mask with one or both of the TRIGGER_BEFORE and TRIGGER_AFTER bits set. Values accessed by BEFORE triggers are only included in the returned mask if the TRIGGER_BEFORE bit is set in the tr_tm parameter. Similarly, values accessed by AFTER triggers are only included in the returned mask if the TRIGGER_AFTER bit is set in tr_tm.
Construct a trigger step that implements a DELETE statement and return a pointer to that trigger step. The parser calls this routine when it sees a DELETE statement inside the body of a CREATE TRIGGER.
Build a trigger step out of an INSERT statement. Return a pointer to the new trigger step. The parser calls this routine when it sees an INSERT inside the body of a trigger.
Given table pTab, return a list of all the triggers attached to the table. The list is connected by Trigger.pNext pointers. All of the triggers on pTab that are in the same database as pTab are already attached to pTab->pTrigger. But there might be additional triggers on pTab in the TEMP schema. This routine prepends all TEMP triggers on pTab to the beginning of the pTab->pTrigger list and returns the combined list. To state it another way: This routine returns a list of all triggers that fire off of pTab. The list will include any TEMP triggers on pTab as well as the triggers lised in pTab->pTrigger.
Turn a SELECT statement (that the pSelect parameter points to) into a trigger step. Return a pointer to a TriggerStep structure. The parser calls this routine when it finds a SELECT statement in body of a TRIGGER.
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.
Convert the pStep->zTarget string into a SrcList and return a pointer to that SrcList. This routine adds a specific database name, if needed, to the target when forming the SrcList. This prevents a trigger in one database from referring to a target in another database. An exception is when the trigger is in TEMP in which case it can refer to any other database it wants.
Construct a trigger step that implements an UPDATE statement and return a pointer to that trigger step. The parser calls this routine when it sees an UPDATE statement inside the body of a CREATE TRIGGER.
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.
Code an OP_Halt due to UNIQUE or PRIMARY KEY constraint violation.
For the index called zIdxName which is found in the database iDb, unlike that index from its Table then remove the index from the index hash table and free all memory structures associated with the index.
Unlink the given table from the hash tables and the delete the table structure with all its indices and foreign keys.
Remove a trigger from the hash tables of the sqlite* pointer.
Process an UPDATE statement. UPDATE OR IGNORE tbl SET a=b, c=d FROM tbl2... WHERE e<5 AND f NOT NULL; \_______/ \_/ \______/ \_____/ \________________/ onError | pChanges | pWhere \_______________________/ pTabList
Analyze the ON CONFLICT clause described by pUpsert. Resolve all symbols in the conflict-target. Return SQLITE_OK if everything works, or an error code is something is wrong.
Generate bytecode that does an UPDATE as part of an upsert. If pIdx is NULL, then the UNIQUE constraint that failed was the IPK. In this case parameter iCur is a cursor open on the table b-tree that currently points to the conflicting table row. Otherwise, if pIdx is not NULL, then pIdx is the constraint that failed and iCur is a cursor points to the conflicting row.
Duplicate an Upsert object.
Create a new Upsert object.
Return true if pUpsert is the last ON CONFLICT clause with a conflict target, or if pUpsert is followed by another ON CONFLICT clause that targets the INTEGER PRIMARY KEY.
Given the list of ON CONFLICT clauses described by pUpsert, and a particular index pIdx, return a pointer to the particular ON CONFLICT clause that applies to the index. Or, if the index is not subject to any ON CONFLICT clause, return NULL.
zIn is a UTF-16 encoded unicode string at least nChar characters long. Return the number of bytes in the first nChar unicode characters in pZ. nChar must be non-negative.
Convert a UTF-16 string in the native encoding into a UTF-8 string. Memory to hold the UTF-8 string is obtained from sqlite3_malloc and must be freed by the calling function. NULL is returned if there is an allocation error.
pZ is a UTF-8 encoded unicode string. If nByte is less than zero, return the number of unicode characters in pZ up to (but not including) the first 0x00 byte. If nByte is not less than zero, return the number of unicode characters in the first nByte of pZ (or up to the first 0x00, whichever comes first).
Translate a single UTF-8 character. Return the unicode value. During translation, assume that the byte that zTerm points is a 0x00. Write a pointer to the next unread byte back into *pzNext. Notes On Invalid UTF-8: * This routine never allows a 7-bit character (0x00 through 0x7f) to be encoded as a multi-byte character. Any multi-byte character that attempts to encode a value between 0x00 and 0x7f is rendered as 0xfffd. * This routine never allows a UTF16 surrogate value to be encoded. If a multi-byte character attempts to encode a value between 0xd800 and 0xe000 then it is rendered as 0xfffd. * Bytes in the range of 0x80 through 0xbf which occur as the first byte of a character are interpreted as single-byte characters and rendered as themselves even though they are technically invalid characters. * This routine accepts over-length UTF8 encodings for unicode values 0x80 and greater. It does not change over-length encodings to 0xfffd as some systems recommend.
The VACUUM command is used to clean up the database, collapse free space, etc. It is modelled after the VACUUM command in PostgreSQL. The VACUUM command works as follows: (1) Create a new transient database file (2) Copy all content from the database being vacuumed into the new transient database file (3) Copy content from the transient database back into the original database. The transient database requires temporary disk space approximately equal to the size of the original database. The copy operation of step (3) requires additional temporary disk space approximately equal to the size of the original database for the rollback journal. Hence, temporary disk space that is approximately 2x the size of the original database is required. Every page of the database is written approximately 3 times: Once for step (2) and twice for step (3). Two writes per page are required in step (3) because the original database content must be written into the rollback journal prior to overwriting the database with the vacuumed content. Only 1x temporary space and only 1x writes would be required if the copy of step (3) were replaced by deleting the original database and renaming the transient database as the original. But that will not work if other processes are attached to the original database. And a power loss in between deleting the original and renaming the transient would cause the database file to appear to be deleted following reboot.
Exported version of applyAffinity(). This one works on sqlite3_value*, not the internal Mem* type.
func Xsqlite3ValueBytes(tls *libc.TLS, pVal uintptr, enc U8) int32
Free an sqlite3_value object
Create a new sqlite3_value object, containing the value of pExpr. This only works for very simple expressions that consist of one constant token (i.e. "5", "5.1", "'a string'"). If the expression can be converted directly into a value, then the value is allocated and a pointer written to *ppVal. The caller is responsible for deallocating the value by passing it to sqlite3ValueFree() later on. If the expression cannot be converted to a value, then *ppVal is set to NULL.
Create a new sqlite3_value object.
Change the string value of an sqlite3_value object
This function is only available internally, it is not part of the external API. It works in a similar way to sqlite3_value_text(), except the data returned is in the encoding specified by the second parameter, which must be one of SQLITE_UTF16BE, SQLITE_UTF16LE or SQLITE_UTF8. (2006-02-16:) The enc value can be or-ed with SQLITE_UTF16_ALIGNED. If that is the case, then the result must be aligned on an even byte boundary.
Return the number of bytes that will be needed to store the given 64-bit integer.
Add an OP_Function or OP_PureFunc opcode. The eCallCtx argument is information (typically taken from Expr.op2) that describes the calling context of the function. 0 means a general function call. NC_IsCheck means called by a check constraint, NC_IdxExpr means called as part of an index expression. NC_PartIdx means in the WHERE clause of a partial index. NC_GenCol means called while computing a generated column value. 0 is the usual case.
func Xsqlite3VdbeAddOp3(tls *libc.TLS, p uintptr, op int32, p1 int32, p2 int32, p3 int32) int32
Add an opcode that includes the p4 value as a pointer.
Add an opcode that includes the p4 value with a P4_INT64 or P4_REAL type.
Add an opcode that includes the p4 value as an integer.
Add a whole list of operations to the operation stack. Return a pointer to the first operation inserted. Non-zero P2 arguments to jump instructions are automatically adjusted so that the jump target is relative to the first operation inserted.
Add an OP_ParseSchema opcode. This routine is broken out from sqlite3VdbeAddOp4() since it needs to also needs to mark all btrees as having been used. The zWhere string must have been obtained from sqlite3_malloc(). This routine will take ownership of the allocated memory.
This routine is used to allocate sufficient space for an UnpackedRecord structure large enough to be used with sqlite3VdbeRecordUnpack() if the first argument is a pointer to KeyInfo structure pKeyInfo. The space is either allocated using sqlite3DbMallocRaw() or from within the unaligned buffer passed via the second and third arguments (presumably stack space). If the former, then *ppFree is set to a pointer that should be eventually freed by the caller using sqlite3DbFree(). Or, if the allocation comes from the pSpace/szSpace buffer, *ppFree is set to NULL before returning. If an OOM error occurs, NULL is returned.
Change the P4 operand of the most recently coded instruction to the value defined by the arguments. This is a high-speed version of sqlite3VdbeChangeP4(). The P4 operand must not have been previously defined. And the new P4 must not be P4_INT32. Use sqlite3VdbeChangeP4() in either of those cases.
Return 1 if pMem represents true, and return 0 if pMem represents false. Return the value ifNull if pMem is NULL.
If pMem is an object with a valid string representation, this routine ensures the internal encoding for the string representation is 'desiredEnc', one of SQLITE_UTF8, SQLITE_UTF16LE or SQLITE_UTF16BE. If pMem is not a string object, or the encoding of the string representation is already stored using the requested encoding, then this routine is a no-op. SQLITE_OK is returned if the conversion is successful (or not required). SQLITE_NOMEM may be returned if a malloc() fails during conversion between formats.
Change the value of the opcode, or P1, P2, P3, or P5 operands for a specific instruction.
func Xsqlite3VdbeChangeP1(tls *libc.TLS, p uintptr, addr int32, val int32)
func Xsqlite3VdbeChangeP2(tls *libc.TLS, p uintptr, addr int32, val int32)
func Xsqlite3VdbeChangeP3(tls *libc.TLS, p uintptr, addr int32, val int32)
func Xsqlite3VdbeChangeP4(tls *libc.TLS, p uintptr, addr int32, zP4 uintptr, n int32)
Change the opcode at addr into OP_Noop
This function is 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 deferred foreign key constraint violations, return SQLITE_ERROR. Otherwise, SQLITE_OK. If there are outstanding FK violations and this function returns SQLITE_ERROR, set the result of the VM to SQLITE_CONSTRAINT_FOREIGNKEY and write an error message to it. Then return SQLITE_ERROR.
Free all memory associated with the Vdbe passed as the second argument, except for object itself, which is preserved. The difference between this function and sqlite3VdbeDelete() is that VdbeDelete() also unlinks the Vdbe from the list of VMs associated with the database connection and frees the object itself.
Set a flag in the vdbe to update the change counter when it is finalised or reset.
Create a new virtual database engine.
Return the address of the next instruction to be inserted.
Make sure the cursor p is ready to read or write the row to which it was last positioned. Return an error code if an OOM fault or I/O error prevents us from positioning the cursor to its correct position. If a MoveTo operation is pending on the given cursor, then do that MoveTo now. If no move is pending, check to see if the row has been deleted out from under the cursor and if it has, mark the row as a NULL row. If the cursor is already pointing to the correct row and that row has not been deleted out from under the cursor, then this routine is a no-op.
Check to ensure that the cursor is valid. Restore the cursor if need be. Return any I/O error from the restore operation.
Return the database associated with the Vdbe.
Delete an entire VDBE.
If parameter iOp is less than zero, then invoke the destructor for all auxiliary data pointers currently cached by the VM passed as the first argument. Or, if iOp is greater than or equal to zero, then the destructor is only invoked for those auxiliary data pointers created by the user function invoked by the OP_Function opcode at instruction iOp of VM pVdbe, and only then if: * the associated function parameter is the 32nd or later (counting from left to right), or * the corresponding bit in argument mask is clear (where the first function parameter corresponds to bit 0 etc.).
If the last opcode is "op" and it is not a jump destination, then remove it. Return true if and only if an opcode was removed.
Compute a string that describes the P4 parameter for an opcode. Use zTemp for any required temporary buffer space.
Insert the end of a co-routine
If SQLite is compiled to support shared-cache mode and to be threadsafe, this routine obtains the mutex associated with each BtShared structure that may be accessed by the VM passed as an argument. In doing so it also sets the BtShared.db member of each of the BtShared structures, ensuring that the correct busy-handler callback is invoked if required. If SQLite is not threadsafe but does support shared-cache mode, then sqlite3BtreeEnter() is invoked to set the BtShared.db variables of all of BtShared structures accessible via the database handle associated with the VM. If SQLite is not threadsafe and does not support shared-cache mode, this function is a no-op. The p->btreeMask field is a bitmask of all btrees that the prepared statement p will ever use. Let N be the number of bits in p->btreeMask corresponding to btrees that use shared cache. Then the runtime of this routine is N*N. But as N is rarely more than 1, this should not be a problem.
Change the error string stored in Vdbe.zErrMsg
Execute as much of a VDBE program as we can. This is the core of sqlite3_step().
This function returns a pointer to a nul-terminated string in memory obtained from sqlite3DbMalloc(). If sqlite3.nVdbeExec is 1, then the string contains a copy of zRawSql but with host parameters expanded to their current bindings. Or, if sqlite3.nVdbeExec is greater than 1, then the returned string holds a copy of zRawSql with "-- " prepended to each line of text. If the SQLITE_TRACE_SIZE_LIMIT macro is defined to an integer, then then long strings and blobs are truncated to that many bytes. This can be used to prevent unreasonably large trace strings when dealing with large (multi-megabyte) strings and blobs. The calling function is responsible for making sure the memory returned is eventually freed. ALGORITHM: Scan the input string looking for host parameters in any of these forms: ?, ?N, $A, @A, :A. Take care to avoid text within string literals, quoted identifier names, and comments. For text forms, the host parameter index is found by scanning the prepared statement for the corresponding OP_Variable opcode. Once the host parameter index is known, locate the value in p->aVar[]. Then render the value as a literal in place of the host parameter name.
Add a new OP_Explain opcode. If the bPush flag is true, then make this opcode the parent for subsequent Explains until sqlite3VdbeExplainPop() is called.
Return the address of the current EXPLAIN QUERY PLAN baseline. 0 means "none".
Pop the EXPLAIN QUERY PLAN stack one level.
Clean up and delete a VDBE after execution. Return an integer which is the result code. Write any error message text into *pzErrMsg.
Return a pointer to an sqlite3VdbeRecordCompare() compatible function suitable for comparing serialized records to the unpacked record passed as the only argument.
The cursor "p" has a pending seek operation that has not yet been carried out. Seek the cursor now. If an error occurs, return the appropriate error code.
Delete a VdbeFrame object and its contents. VdbeFrame objects are allocated by the OP_Program opcode in sqlite3VdbeExec().
This is a destructor on a Mem object (which is really an sqlite3_value) that deletes the Frame object that is attached to it as a blob. This routine does not delete the Frame right away. It merely adds the frame to a list of frames to be deleted when the Vdbe halts.
Copy the values stored in the VdbeFrame structure to its Vdbe. This is used, for example, when a trigger sub-program is halted to restore control to the main program.
Close a VDBE cursor and release all the resources that cursor happens to hold.
Return a pointer to an sqlite3_value structure containing the value bound parameter iVar of VM v. Except, if the value is an SQL NULL, return 0 instead. Unless it is NULL, apply affinity aff (one of the SQLITE_AFF_* constants) to the value before returning it. The returned value must be freed by the caller using sqlite3ValueFree().
Return the opcode for a given address. If the address is -1, then return the most recently inserted opcode. If a memory allocation error has occurred prior to the calling of this routine, then a pointer to a dummy VdbeOp will be returned. That opcode is readable but not writable, though it is cast to a writable value. The return of a dummy opcode allows the call to continue functioning after an OOM fault without having to check to see if the return from this routine is a valid pointer. But because the dummy.opcode is 0, dummy will never be written to. This is verified by code inspection and by running with Valgrind.
Generate code for an unconditional jump to instruction iDest
This routine is called the when a VDBE tries to halt. If the VDBE has made changes and is in autocommit mode, then commit those changes. If a rollback is needed, then do the rollback. This routine is the only way to move the state of a VM from SQLITE_MAGIC_RUN to SQLITE_MAGIC_HALT. It is harmless to call this on a VM that is in the SQLITE_MAGIC_HALT state. Return an error code. If the commit could not complete because of lock contention, return SQLITE_BUSY. If SQLITE_BUSY is returned, it means the close did not happen and needs to be repeated.
Return true if the given Vdbe has any SubPrograms.
Compare the key of the index entry that cursor pC is pointing to against the key string in pUnpacked. Write into *pRes a number that is negative, zero, or positive if pC is less than, equal to, or greater than pUnpacked. Return SQLITE_OK on success. pUnpacked is either created without a rowid or is truncated so that it omits the rowid at the end. The rowid at the end of the index entry is ignored as well. Hence, this routine only compares the prefixes of the keys prior to the final rowid, not the entire key.
pCur points at an index entry created using the OP_MakeRecord opcode. Read the rowid (the last field in the record) and store it in *rowid. Return SQLITE_OK if everything works, or an error code otherwise. pCur might be pointing to text obtained from a corrupt database file. So the content cannot be trusted. Do appropriate checks on the content.
The MEM structure is already a MEM_Real. Try to also make it a MEM_Int if we can.
Change the P2 operand of instruction addr so that it points to the address of the next instruction to be coded.
Change the P2 operand of the jump instruction at addr so that the jump lands on the next opcode. Or if the jump instruction was the previous opcode (and is thus a no-op) then simply back up the next instruction counter by one slot so that the jump is overwritten by the next inserted opcode. This routine is an optimization of sqlite3VdbeJumpHere() that strives to omit useless byte-code like this: 7 Once 0 8 0 8 ...
Link the SubProgram object passed as the second argument into the linked list at Vdbe.pSubProgram. This list is used to delete all sub-program objects when the VM is no longer required.
Give a listing of the program in the virtual machine. The interface is the same as sqlite3VdbeExec(). But instead of running the code, it invokes the callback once for each instruction. This feature is used to implement "EXPLAIN". When p->explain==1, each instruction is listed. When p->explain==2, only OP_Explain instructions are listed and these are shown in a different format. p->explain==2 is used to implement EXPLAIN QUERY PLAN. 2018-04-24: In p->explain==2 mode, the OP_Init opcodes of triggers are also shown, so that the boundaries between the main program and each trigger are clear. When p->explain==1, first the main program is listed, then each of the trigger subprograms are listed one by one.
Generate code to cause the string zStr to be loaded into register iDest
Create a new symbolic label for an instruction that has yet to be coded. The symbolic label is really just a negative number. The label can be used as the P2 value of an operation. Later, when the label is resolved to a specific address, the VDBE will scan through its operation list and change all values of P2 which match the label into the resolved address. The VDBE knows that a P2 value is a label because labels are always negative and P2 values are suppose to be non-negative. Hence, a negative P2 value is a label that has yet to be resolved. (Later:) This is only true for opcodes that have the OPFLG_JUMP property. Variable usage notes: Parse.aLabel[x] Stores the address that the x-th label resolves into. For testing (SQLITE_DEBUG), unresolved labels stores -1, but that is not required. Parse.nLabelAlloc Number of slots allocated to Parse.aLabel[] Parse.nLabel The *negative* of the number of labels that have been issued. The negative is stored because that gives a performance improvement over storing the equivalent positive value.
Prepare a virtual machine for execution for the first time after creating the virtual machine. This involves things such as allocating registers and initializing the program counter. After the VDBE has be prepped, it can be executed by one or more calls to sqlite3VdbeExec(). This function may be called exactly once on each virtual machine. After this routine is called the VM has been "packaged" and is ready to run. After this routine is called, further calls to sqlite3VdbeAddOp() functions are prohibited. This routine disconnects the Vdbe from the Parse object that helped generate it so that the the Vdbe becomes an independent entity and the Parse object can be destroyed. Use the sqlite3VdbeRewind() procedure to restore a virtual machine back to its initial state after it has been run.
Memory cell pAccum contains the context of an aggregate function. This routine calls the xValue method for that function and stores the results in memory cell pMem. SQLITE_ERROR is returned if xValue() reports an error. SQLITE_OK otherwise.
Cast the datatype of the value in pMem according to the affinity "aff". Casting is different from applying affinity in that a cast is forced. In other words, the value is converted into the desired affinity even if that results in loss of data. This routine is used (for example) to implement the SQL "cast()" operator.
Change the pMem->zMalloc allocation to be at least szNew bytes. If pMem->zMalloc already meets or exceeds the requested size, this routine is a no-op. Any prior string or blob content in the pMem object may be discarded. The pMem->xDel destructor is called, if it exists. Though MEM_Str and MEM_Blob values may be discarded, MEM_Int, MEM_Real, MEM_IntReal, and MEM_Null values are preserved. Return SQLITE_OK on success or an error code (probably SQLITE_NOMEM) if unable to complete the resizing.
Make a full copy of pFrom into pTo. Prior contents of pTo are freed before the copy is made.
If the given Mem* has a zero-filled tail, turn it into an ordinary blob stored in dynamically allocated space.
Memory cell pMem contains the context of an aggregate function. This routine calls the finalize method for that function. The result of the aggregate is stored back into pMem. Return SQLITE_ERROR if the finalizer reports an error. SQLITE_OK otherwise.
Move data out of a btree key or data field and into a Mem structure. The data is payload from the entry that pCur is currently pointing to. offset and amt determine what portion of the data or key to retrieve. The result is written into the pMem element. The pMem object must have been initialized. This routine will use pMem->zMalloc to hold the content from the btree, if possible. New pMem->zMalloc space will be allocated if necessary. The calling routine is responsible for making sure that the pMem object is eventually destroyed. If this routine fails for any reason (malloc returns NULL or unable to read from the disk) then the pMem is left in an inconsistent state.
Make sure pMem->z points to a writable allocation of at least n bytes. If the bPreserve argument is true, then copy of the content of pMem->z into the new allocation. pMem must be either a string or blob if bPreserve is true. If bPreserve is false, any prior content in pMem->z is discarded.
This routine checks for a byte-order mark at the beginning of the UTF-16 string stored in *pMem. If one is present, it is removed and the encoding of the Mem adjusted. This routine does not do any byte-swapping, it just sets Mem.enc appropriately. The allocation (static, dynamic etc.) and encoding of the Mem may be changed by this function.
Initialize bulk memory to be a consistent Mem object. The minimum amount of initialization feasible is performed.
Convert pMem to type integer. Invalidate any prior representations.
Change pMem so that its MEM_Str or MEM_Blob value is stored in MEM.zMalloc, where it can be safely written. Return SQLITE_OK on success or SQLITE_NOMEM if malloc fails.
Transfer the contents of pFrom to pTo. Any existing value in pTo is freed. If pFrom contains ephemeral data, a copy is made. pFrom contains an SQL NULL when this routine returns.
Make sure the given Mem is \u0000 terminated.
Convert pMem so that it has type MEM_Real or MEM_Int. Invalidate any prior representations. Every effort is made to force the conversion, even if the input is a string that does not look completely like a number. Convert as much of the string as we can and ignore the rest.
Convert pMem so that it is of type MEM_Real. Invalidate any prior representations.
Release any memory resources held by the Mem. Both the memory that is free by Mem.xDel and the Mem.zMalloc allocation are freed. Use this routine prior to clean up prior to abandoning a Mem, or to reset a Mem back to its minimum memory utilization. Use sqlite3VdbeMemSetNull() to release just the Mem.xDel space prior to inserting new content into the Mem.
Delete any previous value and set the value stored in *pMem to val, manifest type REAL.
Delete any previous value and set the value stored in *pMem to val, manifest type INTEGER.
Delete any previous value and set the value stored in *pMem to NULL. This routine calls the Mem.xDel destructor to dispose of values that require the destructor. But it preserves the Mem.zMalloc memory allocation. To free all resources, use sqlite3VdbeMemRelease(), which both calls this routine to invoke the destructor and deallocates Mem.zMalloc. Use this routine to reset the Mem prior to insert a new value. Use sqlite3VdbeMemRelease() to complete erase the Mem prior to abandoning it.
Set the value stored in *pMem should already be a NULL. Also store a pointer to go with it.
Delete any previous value and set the value of pMem to be an empty boolean index. Return SQLITE_OK on success and SQLITE_NOMEM if a memory allocation error occurs.
Change the value of a Mem to be a string or a BLOB. The memory management strategy depends on the value of the xDel parameter. If the value passed is SQLITE_TRANSIENT, then the string is copied into a (possibly existing) buffer managed by the Mem structure. Otherwise, any existing buffer is freed and the pointer copied. If the string is too large (if it exceeds the SQLITE_LIMIT_LENGTH size limit) then no memory allocation occurs. If the string can be stored without allocating memory, then it is. If a memory allocation is required to store the string, then value of pMem is unchanged. In either case, SQLITE_TOOBIG is returned.
Delete any previous value and set the value to be a BLOB of length n containing all zeros.
func Xsqlite3VdbeMemShallowCopy(tls *libc.TLS, pTo uintptr, pFrom uintptr, srcType int32)
Add MEM_Str to the set of representations for the given Mem. This routine is only called if pMem is a number of some kind, not a NULL or a BLOB. Existing representations MEM_Int, MEM_Real, or MEM_IntReal are invalidated if bForce is true but are retained if bForce is false. A MEM_Null value will never be passed to this function. This function is used for converting values to text for returning to the user (i.e. via sqlite3_value_text()), or for ensuring that values to be used as btree keys are strings. In the former case a NULL pointer is returned the user and the latter is an internal programming error.
Return true if the Mem object contains a TEXT or BLOB that is too large - whose size exceeds SQLITE_MAX_LENGTH.
This routine transforms the internal text encoding used by pMem to desiredEnc. It is an error if the string is already of the desired encoding, or if *pMem does not contain a string value.
Generate code that initializes multiple registers to string or integer constants. The registers begin with iDest and increase consecutively. One register is initialized for each characgter in zTypes[]. For each "s" character in zTypes[], the register is a string if the argument is not NULL, or OP_Null if the value is a null pointer. For each "i" character in zTypes[], the register is initialized to an integer. If the input string does not end with "X" then an OP_ResultRow instruction is generated for the values inserted.
Locate the next opcode to be displayed in EXPLAIN or EXPLAIN QUERY PLAN output. Return SQLITE_ROW on success. Return SQLITE_DONE if there are no more opcodes to be displayed.
func Xsqlite3VdbeOneByteSerialTypeLen(tls *libc.TLS, serial_type U8) U8
Given a wildcard parameter name, return the index of the variable with that name. If there is no variable with the given name, return 0.
Return the Parse object that owns a Vdbe object.
Return the SQLITE_PREPARE flags for a Vdbe.
Invoke the pre-update hook. If this is an UPDATE or DELETE pre-update call, then cursor passed as the second argument should point to the row about to be update or deleted. If the application calls sqlite3_preupdate_old(), the required value will be read from the row the cursor points to.
func Xsqlite3VdbeRecordCompare(tls *libc.TLS, nKey1 int32, pKey1 uintptr, pPKey2 uintptr) int32
This function compares the two table rows or index records specified by {nKey1, pKey1} and pPKey2. It returns a negative, zero or positive integer if key1 is less than, equal to or greater than key2. The {nKey1, pKey1} key must be a blob created by the OP_MakeRecord opcode of the VDBE. The pPKey2 key must be a parsed key such as obtained from sqlite3VdbeParseRecord. If argument bSkip is non-zero, it is assumed that the caller has already determined that the first fields of the keys are equal. Key1 and Key2 do not have to contain the same number of fields. If all fields that appear in both keys are equal, then pPKey2->default_rc is returned. If database corruption is discovered, set pPKey2->errCode to SQLITE_CORRUPT and return 0. If an OOM error is encountered, pPKey2->errCode is set to SQLITE_NOMEM and, if it is not NULL, the malloc-failed flag set on database handle (pPKey2->pKeyInfo->db).
Given the nKey-byte encoding of a record in pKey[], populate the UnpackedRecord structure indicated by the fourth argument with the contents of the decoded record.
Clean up a VDBE after execution but do not delete the VDBE just yet. Write any error messages into *pzErrMsg. Return the result code. After this routine is run, the VDBE should be ready to be executed again. To look at it another way, this routine resets the state of the virtual machine from VDBE_MAGIC_RUN or VDBE_MAGIC_HALT back to VDBE_MAGIC_INIT.
Each VDBE holds the result of the most recent sqlite3_step() call in p->rc. This routine sets that result back to SQLITE_OK.
Mark the VDBE as one that can only be run multiple times.
Rewind the VDBE back to the beginning in preparation for running it.
Mark the VDBE as one that can only be run one time.
func Xsqlite3VdbeSerialGet(tls *libc.TLS, buf uintptr, serial_type U32, pMem uintptr) U32
Write the serialized data blob for the value stored in pMem into buf. It is assumed that the caller has allocated sufficient space. Return the number of bytes written. nBuf is the amount of space left in buf[]. The caller is responsible for allocating enough space to buf[] to hold the entire field, exclusive of the pMem->u.nZero bytes for a MEM_Zero value. Return the number of bytes actually written into buf[]. The number of bytes in the zero-filled tail is included in the return value only if those bytes were zeroed in buf[].
Return the length of the data corresponding to the supplied serial-type.
This routine sets the value to be returned by subsequent calls to sqlite3_changes() on the database handle 'db'.
Set the name of the idx'th column to be returned by the SQL statement. zName must be a pointer to a nul terminated string. This call must be made after a call to sqlite3VdbeSetNumCols(). The final parameter, xDel, must be one of SQLITE_DYNAMIC, SQLITE_STATIC or SQLITE_TRANSIENT. If it is SQLITE_DYNAMIC, then the buffer pointed to by zName will be freed by sqlite3DbFree() when the vdbe is destroyed.
Set the number of result columns that will be returned by this SQL statement. This is now set at compile time, rather than during execution of the vdbe program so that sqlite3_column_count() can be called on an SQL statement before sqlite3_step().
Set the P4 on the most recently added opcode to the KeyInfo for the index given.
Remember the SQL string for a prepared statement.
Configure SQL variable iVar so that binding a new value to it signals to sqlite3_reoptimize() that re-preparing the statement may result in a better query plan.
Free any cursor components allocated by sqlite3VdbeSorterXXX routines.
Compare the key in memory cell pVal with the key that the sorter cursor passed as the first argument currently points to. For the purposes of the comparison, ignore the rowid field at the end of each record. If the sorter cursor key contains any NULL values, consider it to be less than pVal. Even if pVal also contains NULL values. If an error occurs, return an SQLite error code (i.e. SQLITE_NOMEM). Otherwise, set *pRes to a negative, zero or positive value if the key in pVal is smaller than, equal to or larger than the current sorter key. This routine forms the core of the OP_SorterCompare opcode, which in turn is used to verify uniqueness when constructing a UNIQUE INDEX.
Initialize the temporary index cursor just opened as a sorter cursor. Usually, the sorter module uses the value of (pCsr->pKeyInfo->nKeyField) to determine the number of fields that should be compared from the records being sorted. However, if the value passed as argument nField is non-zero and the sorter is able to guarantee a stable sort, nField is used instead. This is used when sorting records for a CREATE INDEX statement. In this case, keys are always delivered to the sorter in order of the primary key, which happens to be make up the final part of the records being sorted. So if the sort is stable, there is never any reason to compare PK fields and they can be ignored for a small performance boost. The sorter can guarantee a stable sort when running in single-threaded mode, but not in multi-threaded mode. SQLITE_OK is returned if successful, or an SQLite error code otherwise.
Advance to the next element in the sorter. Return value: SQLITE_OK success SQLITE_DONE end of data otherwise some kind of error.
Reset a sorting cursor back to its original empty state.
Once the sorter has been populated by calls to sqlite3VdbeSorterWrite, this function is called to prepare for iterating through the records in sorted order.
Copy the current sorter key into the memory cell pOut.
Add a record to the sorter.
Swap all content between two VDBE structures.
This function returns a pointer to the array of opcodes associated with the Vdbe passed as the first argument. It is the callers responsibility to arrange for the returned array to be eventually freed using the vdbeFreeOpArray() function. Before returning, *pnOp is set to the number of entries in the returned array. Also, *pnMaxArg is set to the larger of its current value and the number of entries in the Vdbe.apArg[] array required to execute the returned program.
Copy the error code and error message belonging to the VDBE passed as the first argument to its database handle (so that they will be returned by calls to sqlite3_errcode() and sqlite3_errmsg()). This function does not clear the VDBE error code or message, just copies them to the database handle.
Declare to the Vdbe that the BTree object at db->aDb[i] is used. The prepared statements need to know in advance the complete set of attached databases that will be use. A mask of these databases is maintained in p->btreeMask. The p->lockMask value is the subset of p->btreeMask of databases that will require a lock.
Expression pExpr is a vector that has been used in a context where it is not permitted. If pExpr is a sub-select vector, this routine loads the Parse object with a message of the form: "sub-select returns N columns - expected 1" Or, if it is a regular scalar vector: "row value misused"
Return a pointer to a subexpression of pVector that is the i-th column of the vector (numbered starting with 0). The caller must ensure that i is within range. If pVector is really a scalar (and "scalar" here includes subqueries that return a single column!) then return pVector unmodified. pVector retains ownership of the returned subexpression. If the vector is a (SELECT ...) then the expression returned is just the expression for the i-th term of the result set, and may not be ready for evaluation because the table cursor has not yet been positioned.
The Table structure pTable is really a VIEW. Fill in the names of the columns of the view in the pTable structure. Return the number of errors. If an error is seen leave an error message in pParse->zErrMsg.
Add a new name/number pair to a VList. This might require that the VList object be reallocated, so return the new VList. If an OOM error occurs, the original VList returned and the db->mallocFailed flag is set. A VList is really just an array of integers. To destroy a VList, simply pass it to sqlite3DbFree(). The first integer is the number of integers allocated for the whole VList. The second integer is the number of integers actually used. Each name/number pair is encoded by subsequent groups of 3 or more integers. Each name/number pair starts with two integers which are the numeric value for the pair and the size of the name/number pair, respectively. The text name overlays one or more following integers. The text name is always zero-terminated. Conceptually: struct VList { int nAlloc; // Number of allocated slots int nUsed; // Number of used slots struct VListEntry { int iValue; // Value for this entry int nSlot; // Slots used by this entry // ... variable name goes here } a[0]; } During code generation, pointers to the variable names within the VList are taken. When that happens, nAlloc is set to zero as an indication that the VList may never again be enlarged, since the accompanying realloc() would invalidate the pointers.
Return the number of the variable named zName, if it is in VList. or return 0 if there is no such variable.
Return a pointer to the name of a variable in the given VList that has the value iVal. Or return a NULL if there is no such variable in the list
Print into memory obtained from sqliteMalloc(). Use the internal %-conversion extensions.
The parser calls this routine for each token after the first token in an argument to the module name in a CREATE VIRTUAL TABLE statement.
The parser calls this routine when it sees the first token of an argument to the module name in a CREATE VIRTUAL TABLE statement.
If the virtual table pVtab supports the transaction interface (xBegin/xRollback/xCommit and optionally xSync) and a transaction is not currently open, invoke the xBegin method now. If the xBegin call is successful, place the sqlite3_vtab pointer in the sqlite3.aVTrans array.
The parser calls this routine when it first sees a CREATE VIRTUAL TABLE statement. The module name has been parsed, but the optional list of parameters that follow the module name are still pending.
This function is invoked by the parser to call the xConnect() method of the virtual table pTab. If an error occurs, an error code is returned and an error left in pParse. This call is a no-op if table pTab is not a virtual table.
This function is invoked by the vdbe to call the xCreate method of the virtual table named zTab in database iDb. If an error occurs, *pzErr is set to point to an English language description of the error and an SQLITE_XXX error code is returned. In this case the caller must call sqlite3DbFree(db, ) on *pzErr.
This function is invoked by the vdbe to call the xDestroy method of the virtual table named zTab in database iDb. This occurs when a DROP TABLE is mentioned. This call is a no-op if zTab is not a virtual table.
Clear any and all virtual-table information from the Table record. This routine is called, for example, just before deleting the Table record. Since it is a virtual-table, the Table structure contains a pointer to the head of a linked list of VTable structures. Each VTable structure is associated with a single sqlite3* user of the schema. The reference count of the VTable structure associated with database connection db is decremented immediately (which may lead to the structure being xDisconnected and free). Any other VTable structures in the list are moved to the sqlite3.pDisconnect list of the associated database connection.
Invoke the xCommit method of all virtual tables in the sqlite3.aVTrans array. Then clear the array itself.
Construct and install a Module object for a virtual table. When this routine is called, it is guaranteed that all appropriate locks are held and the module is not already part of the connection. If there already exists a module with zName, replace it with the new one. If pModule==0, then delete the module zName if it exists.
Table *p is a virtual table. This function removes the VTable object for table *p associated with database connection db from the linked list in p->pVTab. It also decrements the VTable ref count. This is used when closing database connection db to free all of its VTable objects without disturbing the rest of the Schema object (which may be being used by other shared-cache connections).
Erase the eponymous virtual table instance associated with virtual table module pMod, if it exists.
Check to see if virtual table module pMod can be have an eponymous virtual table instance. If it can, create one if one does not already exist. Return non-zero if the eponymous virtual table instance exists when this routine returns, and return zero if it does not exist. An eponymous virtual table instance is one that is named after its module, and more importantly, does not require a CREATE VIRTUAL TABLE statement in order to come into existance. Eponymous virtual table instances always exist. They cannot be DROP-ed. Any virtual table module for which xConnect and xCreate are the same method can have an eponymous virtual table instance.
The parser calls this routine after the CREATE VIRTUAL TABLE statement has been completely parsed.
Transfer error message text from an sqlite3_vtab.zErrMsg (text stored in memory obtained from sqlite3_malloc) into a Vdbe.zErrMsg (text stored in memory obtained from sqlite3DbMalloc).
Lock the virtual table so that it cannot be disconnected. Locks nest. Every lock should have a corresponding unlock. If an unlock is omitted, resources leaks will occur. If a disconnect is attempted while a virtual table is locked, the disconnect is deferred until all locks have been removed.
Make sure virtual table pTab is contained in the pParse->apVirtualLock[] array so that an OP_VBegin will get generated for it. Add pTab to the array if it is missing. If pTab is already in the array, this routine is a no-op.
Decrement the reference count on a Module object. Destroy the module when the reference count reaches zero.
The first parameter (pDef) is a function implementation. The second parameter (pExpr) is the first argument to this function. If pExpr is a column in a virtual table, then let the virtual table implementation have an opportunity to overload the function. This routine is used to allow virtual table implementations to overload MATCH, LIKE, GLOB, and REGEXP operators. Return either the pDef argument (indicating no change) or a new FuncDef structure that is marked as ephemeral using the SQLITE_FUNC_EPHEM flag.
Invoke the xRollback method of all virtual tables in the sqlite3.aVTrans array. Then clear the array itself.
Invoke either the xSavepoint, xRollbackTo or xRelease method of all virtual tables that currently have an open transaction. Pass iSavepoint as the second argument to the virtual table method invoked. If op is SAVEPOINT_BEGIN, the xSavepoint method is invoked. If it is SAVEPOINT_ROLLBACK, the xRollbackTo method. Otherwise, if op is SAVEPOINT_RELEASE, then the xRelease method of each virtual table with an open transaction is invoked. If any virtual table method returns an error code other than SQLITE_OK, processing is abandoned and the error returned to the caller of this function immediately. If all calls to virtual table methods are successful, SQLITE_OK is returned.
Invoke the xSync method of all virtual tables in the sqlite3.aVTrans array. Return the error code for the first error that occurs, or SQLITE_OK if all xSync operations are successful. If an error message is available, leave it in p->zErrMsg.
Decrement the ref-count on a virtual table object. When the ref-count reaches zero, call the xDisconnect() method to delete the object.
Disconnect all the virtual table objects in the sqlite3.pDisconnect list. This function may only be called when the mutexes associated with all shared b-tree databases opened using connection db are held by the caller. This is done to protect the sqlite3.pDisconnect list. The sqlite3.pDisconnect list is accessed only as follows: 1) By this function. In this case, all BtShared mutexes and the mutex associated with the database handle itself must be held. 2) By function vtabDisconnectAll(), when it adds a VTable entry to the sqlite3.pDisconnect list. In this case either the BtShared mutex associated with the database the virtual table is stored in is held or, if the virtual table is stored in a non-sharable database, then the database handle mutex is held. As a result, a sqlite3.pDisconnect cannot be accessed simultaneously by multiple threads. It is thread-safe.
Begin a read transaction on the database. This routine used to be called sqlite3OpenSnapshot() and with good reason: it takes a snapshot of the state of the WAL and wal-index for the current instant in time. The current thread will continue to use this snapshot. Other threads might append new content to the WAL and wal-index but that extra content is ignored by the current thread. If the database contents have changes since the previous read transaction, then *pChanged is set to 1 before returning. The Pager layer will use this to know that its cache is stale and needs to be flushed.
This function starts a write transaction on the WAL. A read transaction must have already been started by a prior call to sqlite3WalBeginReadTransaction(). If another thread or process has written into the database since the read transaction was started, then it is not possible for this thread to write as doing so would cause a fork. So this routine returns SQLITE_BUSY in that case and no write transaction is started. There can only be a single writer active at a time.
Return the value to pass to a sqlite3_wal_hook callback, the number of frames in the WAL at the point of the last commit since sqlite3WalCallback() was called. If no commits have occurred since the last call, then return 0.
This routine is called to implement sqlite3_wal_checkpoint() and related interfaces. Obtain a CHECKPOINT lock and then backfill as much information as we can from WAL into the database. If parameter xBusy is not NULL, it is a pointer to a busy-handler callback. In this case this function runs a blocking checkpoint.
Close a connection to a log file.
Return the size of the database in pages (or zero, if unknown).
The sqlite3_wal_hook() callback registered by sqlite3_wal_autocheckpoint(). Invoke sqlite3_wal_checkpoint if the number of frames in the log file is greater than sqlite3.pWalArg cast to an integer (the value configured by wal_autocheckpoint()).
Finish with a read transaction. All this does is release the read-lock.
End a write transaction. The commit has already been done. This routine merely releases the lock.
This function is called to change the WAL subsystem into or out of locking_mode=EXCLUSIVE. If op is zero, then attempt to change from locking_mode=EXCLUSIVE into locking_mode=NORMAL. This means that we must acquire a lock on the pWal->readLock byte. If the WAL is already in locking_mode=NORMAL or if the acquisition of the lock fails, then return 0. If the transition out of exclusive-mode is successful, return 1. This operation must occur while the pager is still holding the exclusive lock on the main database file. If op is one, then change from locking_mode=NORMAL into locking_mode=EXCLUSIVE. This means that the pWal->readLock must be released. Return 1 if the transition is made and 0 if the WAL is already in exclusive-locking mode - meaning that this routine is a no-op. The pager must already hold the exclusive lock on the main database file before invoking this operation. If op is negative, then do a dry-run of the op==1 case but do not actually change anything. The pager uses this to see if it should acquire the database exclusive lock prior to invoking the op==1 case.
Return the sqlite3_file object for the WAL file
Search the wal file for page pgno. If found, set *piRead to the frame that contains the page. Otherwise, if pgno is not in the wal file, set *piRead to zero. Return SQLITE_OK if successful, or an error code if an error occurs. If an error does occur, the final value of *piRead is undefined.
Write a set of frames to the log. The caller must hold the write-lock on the log file (obtained using sqlite3WalBeginWriteTransaction()).
Return true if the argument is non-NULL and the WAL module is using heap-memory for the wal-index. Otherwise, if the argument is NULL or the WAL module is using shared-memory, return false.
func Xsqlite3WalkerDepthDecrease(tls *libc.TLS, pWalker uintptr, pSelect uintptr)
Increase the walkerDepth when entering a subquery, and descrease when leaving the subquery.
func Xsqlite3WalkExpr(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32
Call sqlite3WalkExpr() for every expression in list p or until an abort request is seen.
Call sqlite3WalkExpr() for every expression in Select statement p. Invoke sqlite3WalkSelect() for subqueries in the FROM clause and on the compound select chain, p->pPrior. If it is not NULL, the xSelectCallback() callback is invoked before the walk of the expressions and FROM clause. The xSelectCallback2() method is invoked following the walk of the expressions and FROM clause, but only if both xSelectCallback and xSelectCallback2 are both non-NULL and if the expressions and FROM clause both return WRC_Continue; Return WRC_Continue under normal conditions. Return WRC_Abort if there is an abort request. If the Walker does not have an xSelectCallback() then this routine is a no-op returning WRC_Continue.
Walk all expressions associated with SELECT statement p. Do not invoke the SELECT callback on p, but do (of course) invoke any expr callbacks and SELECT callbacks that come from subqueries. Return WRC_Abort or WRC_Continue.
Walk the parse trees associated with all subqueries in the FROM clause of SELECT statement p. Do not invoke the select callback on p, but do invoke it on each FROM clause subquery and on any subqueries further down in the tree. Return WRC_Abort or WRC_Continue;
This is a no-op callback for Walker->xSelectCallback2. If this callback is set, then the Select->pWinDefn list is traversed.
Change the size to which the WAL file is trucated on each reset.
Open a connection to the WAL file zWalName. The database file must already be opened on connection pDbFd. The buffer that zWalName points to must remain valid for the lifetime of the returned Wal* handle. A SHARED lock should be held on the database file when this function is called. The purpose of this SHARED lock is to prevent any other client from unlinking the WAL or wal-index file. If another process were to do this just after this client opened one of these files, the system would be badly broken. If the log file is successfully opened, SQLITE_OK is returned and *ppWal is set to point to a new WAL handle. If an error occurs, an SQLite error code is returned and *ppWal is left unmodified.
Read the contents of frame iRead from the wal file into buffer pOut (which is nOut bytes in size). Return SQLITE_OK if successful, or an error code otherwise.
Argument aWalData must point to an array of WAL_SAVEPOINT_NDATA u32 values. This function populates the array with values required to "rollback" the write position of the WAL handle back to the current point in the event of a savepoint rollback (via WalSavepointUndo()).
Move the write position of the WAL back to the point identified by the values in the aWalData[] array. aWalData must point to an array of WAL_SAVEPOINT_NDATA u32 values that has been previously populated by a call to WalSavepoint().
The caller currently has a read transaction open on the database. This function takes a SHARED lock on the CHECKPOINTER slot and then checks if the snapshot passed as the second argument is still available. If so, SQLITE_OK is returned. If the snapshot is not available, SQLITE_ERROR is returned. Or, if the CHECKPOINTER lock cannot be obtained, SQLITE_BUSY. If any error occurs (any value other than SQLITE_OK is returned), the CHECKPOINTER lock is released before returning.
Create a snapshot object. The content of a snapshot is opaque to every other subsystem, so the WAL module can put whatever it needs in the object.
Try to open on pSnapshot when the next read-transaction starts
Attempt to reduce the value of the WalCkptInfo.nBackfillAttempted variable so that older snapshots can be accessed. To do this, loop through all wal frames from nBackfillAttempted to (nBackfill+1), comparing their content to the corresponding page with the database file, if any. Set nBackfillAttempted to the frame number of the first frame for which the wal file content matches the db file. This is only really safe if the file-system is such that any page writes made by earlier checkpointers were atomic operations, which is not always true. It is also possible that nBackfillAttempted may be left set to a value larger than expected, if a wal frame contains content that duplicate of an earlier version of the same page. SQLITE_OK is returned if successful, or an SQLite error code if an error occurs. It is not an error if nBackfillAttempted cannot be decreased at all.
Release a lock obtained by an earlier successful call to sqlite3WalSnapshotCheck().
If any data has been written (but not committed) to the log file, this function moves the write-pointer back to the start of the transaction. Additionally, the callback function is invoked for each frame written to the WAL since the start of the transaction. If the callback returns other than SQLITE_OK, it is not invoked again and the error code is returned to the caller. Otherwise, if the callback function does not return an error, this function returns SQLITE_OK.
Generate the beginning of the loop used for WHERE clause processing. The return value is a pointer to an opaque structure that contains information needed to terminate the loop. Later, the calling routine should invoke sqlite3WhereEnd() with the return value of this function in order to complete the WHERE clause processing. If an error occurs, this routine returns NULL. The basic idea is to do a nested loop, one loop for each table in the FROM clause of a select. (INSERT and UPDATE statements are the same as a SELECT with only a single table in the FROM clause.) For example, if the SQL is this: SELECT * FROM t1, t2, t3 WHERE ...; Then the code generated is conceptually like the following: foreach row1 in t1 do \ Code generated foreach row2 in t2 do |-- by sqlite3WhereBegin() foreach row3 in t3 do / ... end \ Code generated end |-- by sqlite3WhereEnd() end / Note that the loops might not be nested in the order in which they appear in the FROM clause if a different order is better able to make use of indices. Note also that when the IN operator appears in the WHERE clause, it might result in additional nested loops for scanning through all values on the right-hand side of the IN. There are Btree cursors associated with each table. t1 uses cursor number pTabList->a[0].iCursor. t2 uses the cursor pTabList->a[1].iCursor. And so forth. This routine generates code to open those VDBE cursors and sqlite3WhereEnd() generates the code to close them. The code that sqlite3WhereBegin() generates leaves the cursors named in pTabList pointing at their appropriate entries. The [...] code can use OP_Column and OP_Rowid opcodes on these cursors to extract data from the various tables of the loop. If the WHERE clause is empty, the foreach loops must each scan their entire tables. Thus a three-way join is an O(N^3) operation. But if the tables have indices and there are terms in the WHERE clause that refer to those indices, a complete table scan can be avoided and the code will run much faster. Most of the work of this routine is checking to see if there are indices that can be used to speed up the loop. Terms of the WHERE clause are also used to limit which rows actually make it to the "..." in the middle of the loop. After each "foreach", terms of the WHERE clause that use only terms in that loop and outer loops are evaluated and if false a jump is made around all subsequent inner loops (or around the "..." if the test occurs within the inner- most loop) OUTER JOINS An outer join of tables t1 and t2 is conceptally coded as follows: foreach row1 in t1 do flag = 0 foreach row2 in t2 do start: ... flag = 1 end if flag==0 then move the row2 cursor to a null row goto start fi end ORDER BY CLAUSE PROCESSING pOrderBy is a pointer to the ORDER BY clause (or the GROUP BY clause if the WHERE_GROUPBY flag is set in wctrlFlags) of a SELECT statement if there is one. If there is no ORDER BY clause or if this routine is called from an UPDATE or DELETE statement, then pOrderBy is NULL. The iIdxCur parameter is the cursor number of an index. If WHERE_OR_SUBCLAUSE is set, iIdxCur is the cursor number of an index to use for OR clause processing. The WHERE clause should use this specific cursor. If WHERE_ONEPASS_DESIRED is set, then iIdxCur is the first cursor in an array of cursors for all indices. iIdxCur should be used to compute the appropriate cursor depending on which index is used.
Return the VDBE address or label to jump to in order to break out of a WHERE loop.
Deallocate a WhereClause structure. The WhereClause structure itself is not freed. This routine is the inverse of sqlite3WhereClauseInit().
Initialize a preallocated WhereClause structure.
Generate code for the start of the iLevel-th loop in the WHERE clause implementation described by pWInfo.
Return the VDBE address or label to jump to in order to continue immediately with the next row of a WHERE clause.
Generate the end of the WHERE loop. See comments on sqlite3WhereBegin() for additional information.
This function is a no-op unless currently processing an EXPLAIN QUERY PLAN command, or if either SQLITE_DEBUG or SQLITE_ENABLE_STMT_SCANSTATUS was defined at compile-time. If it is not a no-op, a single OP_Explain opcode is added to the output to describe the table scan strategy in pLevel. If an OP_Explain opcode is added to the VM, its address is returned. Otherwise, if no OP_Explain is coded, zero is returned.
Call exprAnalyze on all terms in a WHERE clause. Note that exprAnalyze() might add new virtual terms onto the end of the WHERE clause. We do not want to analyze these new virtual terms, so start analyzing at the end and work forward so that the added virtual terms are never processed.
These routines walk (recursively) an expression tree and generate a bitmask indicating which tables are used in that expression tree.
Search for a term in the WHERE clause that is of the form "X <op> <expr>" where X is a reference to the iColumn of table iCur or of index pIdx if pIdx!=0 and <op> is one of the WO_xx operator codes specified by the op parameter. Return a pointer to the term. Return 0 if not found. If pIdx!=0 then it must be one of the indexes of table iCur. Search for terms matching the iColumn-th column of pIdx rather than the iColumn-th column of table iCur. The term returned might by Y=<expr> if there is another constraint in the WHERE clause that specifies that X=Y. Any such constraints will be identified by the WO_EQUIV bit in the pTerm->eOperator field. The aiCur[]/iaColumn[] arrays hold X and all its equivalents. There are 11 slots in aiCur[]/aiColumn[] so that means we can look for X plus up to 10 other equivalent values. Hence a search for X will return <expr> if X=A1 and A1=A2 and A2=A3 and ... and A9=A10 and A10=<expr>. If there are multiple terms in the WHERE clause of the form "X <op> <expr>" then try for the one with no dependencies on <expr> - in other words where <expr> is a constant expression of some kind. Only return entries of the form "X <op> Y" where Y is a column in another table if no terms of the form "X <op> <const-expr>" exist. If no terms with a constant RHS exist, try to return a term that does not use WO_EQUIV.
Return the bitmask for the given cursor number. Return 0 if iCursor is not in the set.
Return one of the WHERE_DISTINCT_xxxxx values to indicate how this WHERE clause returns outputs for DISTINCT processing.
Return the number of ORDER BY terms that are satisfied by the WHERE clause. A return of 0 means that the output must be completely sorted. A return equal to the number of ORDER BY terms means that no sorting is needed at all. A return that is positive but less than the number of ORDER BY terms means that block sorting is required.
If the WHERE_GROUPBY flag is set in the mask passed to sqlite3WhereBegin(), the planner assumes that the specified pOrderBy list is actually a GROUP BY clause - and so any order that groups rows as required satisfies the request. Normally, in this case it is not possible for the caller to determine whether or not the rows are really being delivered in sorted order, or just in some other order that provides the required grouping. However, if the WHERE_SORTBYGROUP flag is also passed to sqlite3WhereBegin(), then this function may be called on the returned WhereInfo object. It returns true if the rows really will be sorted in the specified order, or false otherwise. For example, assuming: CREATE INDEX i1 ON t1(x, Y); then SELECT * FROM t1 GROUP BY x,y ORDER BY x,y; -- IsSorted()==1 SELECT * FROM t1 GROUP BY y,x ORDER BY y,x; -- IsSorted()==0
While generating code for the min/max optimization, after handling the aggregate-step call to min() or max(), check to see if any additional looping is required. If the output order is such that we are certain that the correct answer has already been found, then code an OP_Goto to by pass subsequent processing. Any extra OP_Goto that is coded here is an optimization. The correct answer should be obtained regardless. This OP_Goto just makes the answer appear faster.
Return ONEPASS_OFF (0) if an UPDATE or DELETE statement is unable to operate directly on the rowids returned by a WHERE clause. Return ONEPASS_SINGLE (1) if the statement can operation directly because only a single row is to be changed. Return ONEPASS_MULTI (2) if the one-pass optimization can be used on multiple If the ONEPASS optimization is used (if this routine returns true) then also write the indices of open cursors used by ONEPASS into aiCur[0] and aiCur[1]. iaCur[0] gets the cursor of the data table and iaCur[1] gets the cursor used by an auxiliary index. Either value may be -1, indicating that cursor is not used. Any cursors returned will have been opened for writing. aiCur[0] and aiCur[1] both get -1 if the where-clause logic is unable to use the ONEPASS optimization.
In the ORDER BY LIMIT optimization, if the inner-most loop is known to emit rows in increasing order, and if the last row emitted by the inner-most loop did not fit within the sorter, then we can skip all subsequent rows for the current iteration of the inner loop (because they will not fit in the sorter either) and continue with the second inner loop - the loop immediately outside the inner-most. When a row does not fit in the sorter (because the sorter already holds LIMIT+OFFSET rows that are smaller), then a jump is made to the label returned by this function. If the ORDER BY LIMIT optimization applies, the jump destination should be the continuation for the second-inner-most loop. If the ORDER BY LIMIT optimization does not apply, then the jump destination should be the continuation for the inner-most loop. It is always safe for this routine to return the continuation of the inner-most loop, in the sense that a correct answer will result. Returning the continuation the second inner loop is an optimization that might make the code run a little faster, but should not change the final answer.
Return the estimated number of output rows from a WHERE clause
This routine identifies subexpressions in the WHERE clause where each subexpression is separated by the AND operator or some other operator specified in the op parameter. The WhereClause structure is filled with pointers to subexpressions. For example: WHERE a=='hello' AND coalesce(b,11)<10 AND (c+12!=d OR c==22) \________/ \_______________/ \________________/ slot[0] slot[1] slot[2] The original WHERE clause in pExpr is unaltered. All this routine does is make slot[] entries point to substructure within pExpr. In the previous sentence and in the diagram, "slot[]" refers to the WhereClause.a[] array. The slot[] array grows as needed to contain all terms of the WHERE clause.
For table-valued-functions, transform the function arguments into new WHERE clause terms. Each function argument translates into an equality constraint against a HIDDEN column in the table.
Return TRUE if the WHERE loop uses the OP_DeferredSeek opcode to move the data cursor to the row selected by the index cursor.
Allocate and return a new Window object describing a Window Definition.
Attach PARTITION and ORDER BY clauses pPartition and pOrderBy to window pWin. Also, if parameter pBase is not NULL, set pWin->zBase to the equivalent nul-terminated string.
Attach window object pWin to expression p.
Window *pWin has just been created from a WINDOW clause. Tokne 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.
This is called by code in select.c before it calls sqlite3WhereBegin() to begin iterating through the sub-query results. It is used to allocate and initialize registers and cursors used by sqlite3WindowCodeStep().
sqlite3WhereBegin() has already been called for the SELECT statement passed as the second argument when this function is invoked. It generates code to populate the Window.regResult register for each window function and invoke the sub-routine at instruction addrGosub once for each row. sqlite3WhereEnd() is always called before returning. This function handles several different types of window frames, which require slightly different processing. The following pseudo code is used to implement window frames of the form: ROWS BETWEEN <expr1> PRECEDING AND <expr2> FOLLOWING Other window frame types use variants of the following: ... loop started by sqlite3WhereBegin() ... if( new partition ){ Gosub flush } Insert new row into eph table. if( first row of partition ){ // Rewind three cursors, all open on the eph table. Rewind(csrEnd); Rewind(csrStart); Rewind(csrCurrent); regEnd = <expr2> // FOLLOWING expression regStart = <expr1> // PRECEDING expression }else{ // First time this branch is taken, the eph table contains two // rows. The first row in the partition, which all three cursors // currently point to, and the following row. AGGSTEP if( (regEnd--)<=0 ){ RETURN_ROW if( (regStart--)<=0 ){ AGGINVERSE } } } } flush: AGGSTEP while( 1 ){ RETURN ROW if( csrCurrent is EOF ) break; if( (regStart--)<=0 ){ AggInverse(csrStart) Next(csrStart) } } The pseudo-code above uses the following shorthand: AGGSTEP: invoke the aggregate xStep() function for each window function with arguments read from the current row of cursor csrEnd, then step cursor csrEnd forward one row (i.e. sqlite3BtreeNext()). RETURN_ROW: return a row to the caller based on the contents of the current row of csrCurrent and the current state of all aggregates. Then step cursor csrCurrent forward one row. AGGINVERSE: invoke the aggregate xInverse() function for each window functions with arguments read from the current row of cursor csrStart. Then step csrStart forward one row. There are two other ROWS window frames that are handled significantly differently from the above - "BETWEEN <expr> PRECEDING AND <expr> PRECEDING" and "BETWEEN <expr> FOLLOWING AND <expr> FOLLOWING". These are special cases because they change the order in which the three cursors (csrStart, csrCurrent and csrEnd) iterate through the ephemeral table. Cases that use UNBOUNDED or CURRENT ROW are much simpler variations on one of these three. ROWS BETWEEN <expr1> PRECEDING AND <expr2> PRECEDING ... loop started by sqlite3WhereBegin() ... if( new partition ){ Gosub flush } Insert new row into eph table. if( first row of partition ){ Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) regEnd = <expr2> regStart = <expr1> }else{ if( (regEnd--)<=0 ){ AGGSTEP } RETURN_ROW if( (regStart--)<=0 ){ AGGINVERSE } } } flush: if( (regEnd--)<=0 ){ AGGSTEP } RETURN_ROW ROWS BETWEEN <expr1> FOLLOWING AND <expr2> FOLLOWING ... loop started by sqlite3WhereBegin() ... if( new partition ){ Gosub flush } Insert new row into eph table. if( first row of partition ){ Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) regEnd = <expr2> regStart = regEnd - <expr1> }else{ AGGSTEP if( (regEnd--)<=0 ){ RETURN_ROW } if( (regStart--)<=0 ){ AGGINVERSE } } } flush: AGGSTEP while( 1 ){ if( (regEnd--)<=0 ){ RETURN_ROW if( eof ) break; } if( (regStart--)<=0 ){ AGGINVERSE if( eof ) break } } while( !eof csrCurrent ){ RETURN_ROW } For the most part, the patterns above are adapted to support UNBOUNDED by assuming that it is equivalent to "infinity PRECEDING/FOLLOWING" and CURRENT ROW by assuming that it is equivilent to "0 PRECEDING/FOLLOWING". This is optimized of course - branches that will never be taken and conditions that are always true are omitted from the VM code. The only exceptional case is: ROWS BETWEEN <expr1> FOLLOWING AND UNBOUNDED FOLLOWING ... loop started by sqlite3WhereBegin() ... if( new partition ){ Gosub flush } Insert new row into eph table. if( first row of partition ){ Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) regStart = <expr1> }else{ AGGSTEP } } flush: AGGSTEP while( 1 ){ if( (regStart--)<=0 ){ AGGINVERSE if( eof ) break } RETURN_ROW } while( !eof csrCurrent ){ RETURN_ROW } Also requiring special handling are the cases: ROWS BETWEEN <expr1> PRECEDING AND <expr2> PRECEDING ROWS BETWEEN <expr1> FOLLOWING AND <expr2> FOLLOWING when (expr1 < expr2). This is detected at runtime, not by this function. To handle this case, the pseudo-code programs depicted above are modified slightly to be: ... loop started by sqlite3WhereBegin() ... if( new partition ){ Gosub flush } Insert new row into eph table. if( first row of partition ){ Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) regEnd = <expr2> regStart = <expr1> if( regEnd < regStart ){ RETURN_ROW delete eph table contents continue } ... The new "continue" statement in the above jumps to the next iteration of the outer loop - the one started by sqlite3WhereBegin(). The various GROUPS cases are implemented using the same patterns as ROWS. The VM code is modified slightly so that: 1. The else branch in the main loop is only taken if the row just added to the ephemeral table is the start of a new group. In other words, it becomes: ... loop started by sqlite3WhereBegin() ... if( new partition ){ Gosub flush } Insert new row into eph table. if( first row of partition ){ Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) regEnd = <expr2> regStart = <expr1> }else if( new group ){ ... } } 2. Instead of processing a single row, each RETURN_ROW, AGGSTEP or AGGINVERSE step processes the current row of the relevant cursor and all subsequent rows belonging to the same group. RANGE window frames are a little different again. As for GROUPS, the main loop runs once per group only. And RETURN_ROW, AGGSTEP and AGGINVERSE deal in groups instead of rows. As for ROWS and GROUPS, there are three basic cases: RANGE BETWEEN <expr1> PRECEDING AND <expr2> FOLLOWING ... loop started by sqlite3WhereBegin() ... if( new partition ){ Gosub flush } Insert new row into eph table. if( first row of partition ){ Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) regEnd = <expr2> regStart = <expr1> }else{ AGGSTEP while( (csrCurrent.key + regEnd) < csrEnd.key ){ RETURN_ROW while( csrStart.key + regStart) < csrCurrent.key ){ AGGINVERSE } } } } flush: AGGSTEP while( 1 ){ RETURN ROW if( csrCurrent is EOF ) break; while( csrStart.key + regStart) < csrCurrent.key ){ AGGINVERSE } } } In the above notation, "csr.key" means the current value of the ORDER BY expression (there is only ever 1 for a RANGE that uses an <expr> FOLLOWING or <expr PRECEDING) read from cursor csr. RANGE BETWEEN <expr1> PRECEDING AND <expr2> PRECEDING ... loop started by sqlite3WhereBegin() ... if( new partition ){ Gosub flush } Insert new row into eph table. if( first row of partition ){ Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) regEnd = <expr2> regStart = <expr1> }else{ while( (csrEnd.key + regEnd) <= csrCurrent.key ){ AGGSTEP } while( (csrStart.key + regStart) < csrCurrent.key ){ AGGINVERSE } RETURN_ROW } } flush: while( (csrEnd.key + regEnd) <= csrCurrent.key ){ AGGSTEP } while( (csrStart.key + regStart) < csrCurrent.key ){ AGGINVERSE } RETURN_ROW RANGE BETWEEN <expr1> FOLLOWING AND <expr2> FOLLOWING ... loop started by sqlite3WhereBegin() ... if( new partition ){ Gosub flush } Insert new row into eph table. if( first row of partition ){ Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) regEnd = <expr2> regStart = <expr1> }else{ AGGSTEP while( (csrCurrent.key + regEnd) < csrEnd.key ){ while( (csrCurrent.key + regStart) > csrStart.key ){ AGGINVERSE } RETURN_ROW } } } flush: AGGSTEP while( 1 ){ while( (csrCurrent.key + regStart) > csrStart.key ){ AGGINVERSE if( eof ) break "while( 1 )" loop. } RETURN_ROW } while( !eof csrCurrent ){ RETURN_ROW } The text above leaves out many details. Refer to the code and comments below for a more complete picture.
Return 0 if the two window objects are identical, 1 if they are different, or 2 if it cannot be determined if the objects are identical or not. Identical window objects can be processed in a single scan.
Free the Window object passed as the second argument.
Allocate and return a duplicate of the Window object indicated by the third argument. Set the Window.pOwner field of the new object to pOwner.
Register those built-in window functions that are not also aggregates.
Free the linked list of Window objects starting at the second argument.
Return a copy of the linked list of Window objects passed as the second argument.
If the SELECT statement passed as the second argument does not invoke any SQL window functions, this function is a no-op. Otherwise, it rewrites the SELECT statement so that window function xStep functions are invoked in the correct order as described under "SELECT REWRITING" at the top of this file.
Unlink the Window object from the Select to which it is attached, if it is attached.
This function is called immediately after resolving the function name for a window function within a SELECT statement. Argument pList is a linked list of WINDOW definitions for the current SELECT statement. Argument pFunc is the function definition just resolved and pWin is the Window object representing the associated OVER clause. This function updates the contents of pWin as follows: * If the OVER clause refered to a named window (as in "max(x) OVER win"), search list pList for a matching WINDOW definition, and update pWin accordingly. If no such WINDOW clause can be found, leave an error in pParse. * If the function is a built-in window function that requires the window to be coerced (see "BUILT-IN WINDOW FUNCTIONS" at the top of this file), pWin is updated here.
This routine is invoked once per CTE by the parser while parsing a WITH clause. The CTE described by teh third argument is added to the WITH clause of the second argument. If the second argument is NULL, then a new WITH argument is created.
Free the contents of the With object passed as the second argument.
Create and return a deep copy of the object passed as the second argument. If an OOM condition is encountered, NULL is returned and the db->mallocFailed flag set.
The code generator maintains a stack of active WITH clauses with the inner-most WITH clause being at the top of the stack. This routine pushes the WITH clause passed as the second argument onto the top of the stack. If argument bFree is true, then this WITH clause will never be popped from the stack but should instead be freed along with the Parse object. In other cases, when bFree==0, the With object will be freed along with the SELECT statement with which it is associated. This routine returns a copy of pWith. Or, if bFree is true and the pWith object is destroyed immediately due to an OOM condition, then this routine return NULL. If bFree is true, do not continue to use the pWith pointer after calling this routine, Instead, use only the return value.
True if PRAGMA writable_schema is ON
Package-Level Variables (total 252, in which 16 are exported)
var CAPI map[string]struct{}
If the following global variable points to a string which is the name of a directory, then that directory will be used to store all database files specified with a relative pathname. See also the "PRAGMA data_store_directory" SQL command.
If the following global variable points to a string which is the name of a directory, then that directory will be used to store temporary files. See also the "PRAGMA temp_store_directory" SQL command.
CAPI3REF: Run-Time Library Version Numbers KEYWORDS: sqlite3_version sqlite3_sourceid These interfaces provide the same information as the [SQLITE_VERSION], [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros but are associated with the library instead of the header file. ^(Cautious programmers might include assert() statements in their application to verify that values returned by these interfaces match the macros in the header, and thus ensure that the application is compiled with matching library and header files. assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER ); assert( strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,80)==0 ); assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 ); ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION] macro. ^The sqlite3_libversion() function returns a pointer to the to the sqlite3_version[] string constant. The sqlite3_libversion() function is provided for use in DLLs since DLL users usually do not have direct access to string constants within the DLL. ^The sqlite3_libversion_number() function returns an integer equal to [SQLITE_VERSION_NUMBER]. ^(The sqlite3_sourceid() function returns a pointer to a string constant whose value is the same as the [SQLITE_SOURCE_ID] C preprocessor macro. Except if SQLite is built using an edited copy of [the amalgamation], then the last four characters of the hash might be different from [SQLITE_SOURCE_ID].)^ See also: [sqlite_version()] and [sqlite_source_id()].
var Xsqlite3aEQb uintptr // sqlite3.c:20881:36
var Xsqlite3aGTb uintptr // sqlite3.c:20882:36
var Xsqlite3aLTb uintptr // sqlite3.c:20880:36
Hash table for global functions - functions common to all database connections. After initialization, this table is read-only.
The following singleton contains the global configuration for the SQLite library.
The following 256 byte lookup table is used to support SQLites built-in equivalents to the following standard library functions: isspace() 0x01 isalpha() 0x02 isdigit() 0x04 isalnum() 0x06 isxdigit() 0x08 toupper() 0x20 SQLite identifier character 0x40 Quote character 0x80 Bit 0x20 is set if the mapped character requires translation to upper case. i.e. if the character is a lower-case ASCII character. If x is a lower-case ASCII character, then its upper-case equivalent is (x - 0x20). Therefore toupper() can be implemented as: (x & ~(map[x]&0x20)) The equivalent of tolower() is implemented using the sqlite3UpperToLower[] array. tolower() is used more often than toupper() by SQLite. Bit 0x40 is set if the character is non-alphanumeric and can be used in an SQLite identifier. Identifiers are alphanumerics, "_", "$", and any non-ASCII UTF character. Hence the test for whether or not a character is part of an identifier is 0x46.
#include "opcodes.h" Properties of opcodes. The OPFLG_INITIALIZER macro is created by mkopcodeh.awk during compilation. Data is obtained from the comments following the "case OP_xxxx:" statements in the vdbe.c file.
The value of the "pending" byte must be 0x40000000 (1 byte past the 1-gibabyte boundary) in a compatible database. SQLite never uses the database page that contains the pending byte. It never attempts to read or write that page. The pending byte page is set aside for use by the VFS layers as space for managing file locks. During testing, it is often desirable to move the pending byte to a different position in the file. This allows code that has to deal with the pending byte to run on files that are much smaller than 1 GiB. The sqlite3_test_control() interface can be used to move the pending byte. IMPORTANT: Changing the pending byte to any value other than 0x40000000 results in an incompatible database file format! Changing the pending byte during operation will result in undefined and incorrect behavior.
Tracing flags set by SQLITE_TESTCTRL_TRACEFLAGS.
Name of the default collating sequence
An array to map all upper-case characters into their corresponding lower-case character. SQLite only considers US-ASCII (or EBCDIC) characters. We do not handle case conversions for the UTF character set since the tables involved are nearly as big or bigger than SQLite itself.
var Xsqlite3WhereTrace U32 // sqlite3.c:21129:20
Package-Level Constants (total 3852, all are exported)
const A_GETCAR = 9
const A_GETCLASS = 22
const A_GETCOND = 37
const A_GETCTLMODE = 41
const A_GETCWD = 8
const A_GETEXPAFTER = 43
const A_GETFSIZE = 27
const A_GETKAUDIT = 29
const A_GETKMASK = 4
const A_GETPINFO = 24
const A_GETPINFO_ADDR = 28
const A_GETPOLICY = 33
const A_GETQCTRL = 35
const A_GETSFLAGS = 39
const A_GETSINFO_ADDR = 32
const A_GETSTAT = 12
const A_OLDGETCOND = 20
const A_OLDGETPOLICY = 2
const A_OLDGETQCTRL = 6
const A_OLDSETCOND = 21
const A_OLDSETPOLICY = 3
const A_OLDSETQCTRL = 7
const A_SENDTRIGGER = 31
const A_SETCLASS = 23
const A_SETCOND = 38
const A_SETCTLMODE = 42
const A_SETEXPAFTER = 44
const A_SETFSIZE = 26
const A_SETKAUDIT = 30
const A_SETKMASK = 5
const A_SETPMASK = 25
const A_SETPOLICY = 34
const A_SETQCTRL = 36
const A_SETSFLAGS = 40
const A_SETSMASK = 15
const A_SETSTAT = 13
const A_SETUMASK = 14
const ACCESSPERMS = 511
const ACCESSX_MAX_TABLESIZE = 16384
const ALLPERMS = 4095
const ALT_SCHEMA_TABLE = "sqlite_schema"
const ALT_TEMP_SCHEMA_TABLE = "sqlite_temp_schema"
const AQ_BUFSZ = 32767
const AQ_HIWATER = 100
const AQ_LOWATER = 10
const AQ_MAXBUFSZ = 1048576
const AQ_MAXHIGH = 10000
const ARG_MAX = 262144
const AT_EACCESS = 16
const AT_FDCWD = -2
const AT_FDONLY = 1024
const AT_REALDEV = 512
const AT_REMOVEDIR = 128
const ATTR_BULK_REQUIRED = 2147483649
const ATTR_CMN_ACCESSMASK = 131072
const ATTR_CMN_ACCTIME = 4096
const ATTR_CMN_ADDEDTIME = 268435456
const ATTR_CMN_BKUPTIME = 8192
const ATTR_CMN_CHGTIME = 2048
const ATTR_CMN_CRTIME = 512
const ATTR_CMN_DATA_PROTECT_FLAGS = 1073741824
const ATTR_CMN_DEVID = 2
const ATTR_CMN_DOCUMENT_ID = 1048576
const ATTR_CMN_ERROR = 536870912
const ATTR_CMN_FILEID = 33554432
const ATTR_CMN_FLAGS = 262144
const ATTR_CMN_FNDRINFO = 16384
const ATTR_CMN_FSID = 4
const ATTR_CMN_FULLPATH = 134217728
const ATTR_CMN_GEN_COUNT = 524288
const ATTR_CMN_GRPID = 65536
const ATTR_CMN_GRPUUID = 16777216
const ATTR_CMN_MODTIME = 1024
const ATTR_CMN_NAME = 1
const ATTR_CMN_NAMEDATTRCOUNT = 524288
const ATTR_CMN_NAMEDATTRLIST = 1048576
const ATTR_CMN_OBJID = 32
const ATTR_CMN_OBJTAG = 16
const ATTR_CMN_OBJTYPE = 8
const ATTR_CMN_OWNERID = 32768
const ATTR_CMN_PARENTID = 67108864
const ATTR_CMN_PAROBJID = 128
const ATTR_CMN_RETURNED_ATTRS = 2147483648
const ATTR_CMN_SCRIPT = 256
const ATTR_CMN_SETMASK = 1372061440
const ATTR_CMN_USERACCESS = 2097152
const ATTR_CMN_UUID = 8388608
const ATTR_CMN_VALIDMASK = 4294967295
const ATTR_CMN_VOLSETMASK = 26368
const ATTR_CMNEXT_CLONEID = 256
const ATTR_CMNEXT_LINKID = 16
const ATTR_CMNEXT_VALIDMASK = 1020
const ATTR_DIR_SETMASK = 0
const ATTR_DIR_VALIDMASK = 63
const ATTR_FILE_DATAEXTENTS = 2048
const ATTR_FILE_DEVTYPE = 32
const ATTR_FILE_FILETYPE = 64
const ATTR_FILE_FORKCOUNT = 128
const ATTR_FILE_FORKLIST = 256
const ATTR_FILE_RSRCEXTENTS = 16384
const ATTR_FILE_RSRCLENGTH = 4096
const ATTR_FILE_SETMASK = 32
const ATTR_FILE_VALIDMASK = 14335
const ATTR_FORK_RESERVED = 4294967295
const ATTR_MAX_BUFFER = 8192
const ATTR_VOL_ATTRIBUTES = 1073741824
const ATTR_VOL_CAPABILITIES = 131072
const ATTR_VOL_DIRCOUNT = 1024
const ATTR_VOL_ENCODINGSUSED = 65536
const ATTR_VOL_FILECOUNT = 512
const ATTR_VOL_FSTYPE = 1
const ATTR_VOL_INFO = 2147483648
const ATTR_VOL_MAXOBJCOUNT = 2048
const ATTR_VOL_MOUNTEDDEVICE = 32768
const ATTR_VOL_MOUNTFLAGS = 16384
const ATTR_VOL_MOUNTPOINT = 4096
const ATTR_VOL_NAME = 8192
const ATTR_VOL_OBJCOUNT = 256
const ATTR_VOL_QUOTA_SIZE = 268435456
const ATTR_VOL_RESERVED_SIZE = 536870912
const ATTR_VOL_SETMASK = 2147491840
const ATTR_VOL_SIZE = 4
const ATTR_VOL_UUID = 262144
const ATTR_VOL_VALIDMASK = 4027056127
const AU_ASSIGN_ASID = -1
const AU_CLASS_MASK_RESERVED = 268435456
const AU_DEFAUDITSID = 0
const AU_FS_MINFREE = 20
const AU_IPv4 = 4
const AU_IPv6 = 16
const AUC_AUDITING = 1
const AUC_DISABLED = -1
const AUC_NOAUDIT = 2
const AUC_UNSET = 0
const AUDIT_AHLT = 2
const AUDIT_ARGE = 8
const AUDIT_ARGV = 4
const AUDIT_CNT = 1
const AUDIT_GROUP = 128
const AUDIT_PATH = 512
const AUDIT_PERZONE = 8192
const AUDIT_PUBLIC = 2048
const AUDIT_RECORD_MAGIC = 2190085915
const AUDIT_SCNT = 1024
const AUDIT_SEQ = 16
const AUDIT_TRAIL = 256
const AUDIT_USER = 64
const AUDIT_WINDATA = 32
const AUDIT_ZONENAME = 4096
const AUDITDEV_FILENAME = "audit"
const BBatch = 0
const BC_BASE_MAX = 99
const BC_DIM_MAX = 2048
const BC_SCALE_MAX = 99
const BC_STRING_MAX = 1000
const BIG_ENDIAN = 4321
const BITVEC_SZ = 512
const BITVEC_SZELEM = 8
const BLKDEV_IOSIZE = 2048
const BSD = 199506
const BSD4_3 = 1
const BSD4_4 = 1
const BTALLOC_ANY = 0
const BTALLOC_EXACT = 1
const BTALLOC_LE = 2
const BTCF_AtLast = 8
const BTCF_Incrblob = 16
const BTCF_Multiple = 32
const BTCF_Pinned = 64
const BTCF_ValidNKey = 2
const BTCF_ValidOvfl = 4
const BTCF_WriteFlag = 1
const BTCURSOR_MAX_DEPTH = 20
const BTREE_APPEND = 8
const BTREE_AUXDELETE = 4
const BTREE_BLOBKEY = 2
const BTREE_BULKLOAD = 1
const BTREE_DATA_VERSION = 15
const BTREE_FORDELETE = 8
const BTREE_HINT_RANGE = 0
const BTREE_INTKEY = 1
const BTREE_MEMORY = 2
const BTREE_PREFORMAT = 128
const BTREE_SEEK_EQ = 2
const BTREE_SINGLE = 4
const BTREE_UNORDERED = 8
const BTREE_WRCSR = 4
const BTS_EXCLUSIVE = 64
const BTS_FAST_SECURE = 12
const BTS_NO_WAL = 32
const BTS_OVERWRITE = 8
const BTS_PENDING = 128
const BTS_READ_ONLY = 1
const BUFSIZ = 1024
const BUS_ADRALN = 1
const BUS_ADRERR = 2
const BUS_NOOP = 0
const BUS_OBJERR = 3
const BYTE_ORDER = 1234
const BYTE_SIZE = 8
const CACHE_STALE = 0
const CBLOCK = 64
const CBQSIZE = 8
const CC_AND = 24
const CC_BANG = 15
const CC_BOM = 30
const CC_COMMA = 23
const CC_DIGIT = 3
const CC_DOLLAR = 4
const CC_DOT = 26
const CC_EQ = 14
const CC_GT = 13
const CC_ID = 27
const CC_ILLEGAL = 28
const CC_KYWD = 2
const CC_KYWD0 = 1
const CC_LP = 17
const CC_LT = 12
const CC_MINUS = 11
const CC_NUL = 29
const CC_PERCENT = 22
const CC_PIPE = 10
const CC_PLUS = 20
const CC_QUOTE = 8
const CC_QUOTE2 = 9
const CC_RP = 18
const CC_SEMI = 19
const CC_SLASH = 16
const CC_SPACE = 7
const CC_STAR = 21
const CC_TILDA = 25
const CC_VARALPHA = 5
const CC_VARNUM = 6
const CC_X = 0
const CHAR_BIT = 8
const CHAR_MAX = 127
const CHAR_MIN = -128
const CHARCLASS_NAME_MAX = 14
const CHILD_MAX = 266
const CKCNSTRNT_COLUMN = 1
const CKCNSTRNT_ROWID = 2
const CLBYTES = 4096
const CLD_CONTINUED = 6
const CLD_DUMPED = 3
const CLD_EXITED = 1
const CLD_KILLED = 2
const CLD_NOOP = 0
const CLD_STOPPED = 5
const CLD_TRAPPED = 4
const CLK_TCK = 100
const CLOCKS_PER_SEC = 1000000
const CLOFF = 4095
const CLOFSET = 4095
const CLSHIFT = 12
const CLSIZE = 1
const CLSIZELOG2 = 0
const CMASK = 18
const COLFLAG_BUSY = 256
const COLFLAG_GENERATED = 96
const COLFLAG_HASTYPE = 4
const COLFLAG_HIDDEN = 2
const COLFLAG_NOINSERT = 98
const COLFLAG_NOTAVAIL = 128
const COLFLAG_PRIMKEY = 1
const COLFLAG_SORTERREF = 16
const COLFLAG_STORED = 64
const COLFLAG_UNIQUE = 8
const COLFLAG_VIRTUAL = 32
const COLL_WEIGHTS_MAX = 2
const COLNAME_COLUMN = 4
const COLNAME_DATABASE = 2
const COLNAME_DECLTYPE = 1
const COLNAME_N = 5
const COLNAME_NAME = 0
const COLNAME_TABLE = 3
const CPF_IGNORE_MODE = 2
const CPF_MASK = 3
const CPF_OVERWRITE = 1
const CPUMON_MAKE_FATAL = 4096
const CRF_MAC_ENFORCE = 2
const CRF_NOMEMBERD = 1
const CROUND = 63
const CURSOR_FAULT = 4
const CURSOR_INVALID = 1
const CURSOR_SKIPNEXT = 2
const CURSOR_VALID = 0
const CURTYPE_BTREE = 0
const CURTYPE_PSEUDO = 3
const CURTYPE_SORTER = 1
const CURTYPE_VTAB = 2
const DB_ResetWanted = 8
const DB_SchemaLoaded = 1
const DB_UnresetViews = 2
const DBFLAG_Vacuum = 4
const DEFFILEMODE = 438
const DEV_BSHIFT = 9
const DEV_BSIZE = 512
const DFLT_SCHEMA_TABLE = "sqlite_master"
const DFLT_TEMP_SCHEMA_TABLE = "sqlite_temp_master"
const DIRECT_MODE = 0
const DOMAIN = 1
const DOTLOCK_SUFFIX = ".lock"
const DST_AUST = 2
const DST_CAN = 6
const DST_EET = 5
const DST_MET = 4
const DST_NONE = 0
const DST_USA = 1
const DST_WET = 3
const E2BIG = 7
const EACCES = 13
const EADDRINUSE = 48
const EADDRNOTAVAIL = 49
const EAFNOSUPPORT = 47
const EAGAIN = 35
const EALREADY = 37
const EAUTH = 80
const EBADARCH = 86
const EBADEXEC = 85
const EBADF = 9
const EBADMACHO = 88
const EBADMSG = 94
const EBADRPC = 72
const EBUSY = 16
const ECANCELED = 89
const ECHILD = 10
const ECONNABORTED = 53
const ECONNREFUSED = 61
const ECONNRESET = 54
const EDEADLK = 11
const EDESTADDRREQ = 39
const EDEVERR = 83
const EDOM = 33
const EDQUOT = 69
const EEXIST = 17
const EF_IS_PURGEABLE = 8
const EF_IS_SPARSE = 16
const EF_IS_SYNC_ROOT = 4
const EF_NO_XATTRS = 2
const EFAULT = 14
const EFBIG = 27
const EFTYPE = 79
const EHOSTDOWN = 64
const EHOSTUNREACH = 65
const EIDRM = 90
const EILSEQ = 92
const EINPROGRESS = 36
const EINTR = 4
const EINVAL = 22
const EIO = 5
const EISCONN = 56
const EISDIR = 21
const ELAST = 106
const ELOOP = 62
const EMFILE = 24
const EMSGSIZE = 40
const EMULTIHOP = 95
const ENAME_NAME = 0
const ENAME_SPAN = 1
const ENAME_TAB = 2
const ENAMETOOLONG = 63
const ENEEDAUTH = 81
const ENETDOWN = 50
const ENETRESET = 52
const ENETUNREACH = 51
const ENFILE = 23
const ENOATTR = 93
const ENOBUFS = 55
const ENODATA = 96
const ENODEV = 19
const ENOENT = 2
const ENOEXEC = 8
const ENOLCK = 77
const ENOMEM = 12
const ENOMSG = 91
const ENOPOLICY = 103
const ENOPROTOOPT = 42
const ENOSPC = 28
const ENOSR = 98
const ENOSTR = 99
const ENOSYS = 78
const ENOTBLK = 15
const ENOTCONN = 57
const ENOTDIR = 20
const ENOTEMPTY = 66
const ENOTRECOVERABLE = 104
const ENOTSOCK = 38
const ENOTSUP = 45
const ENOTTY = 25
const ENXIO = 6
const EOF = -1
const EOPNOTSUPP = 102
const EOVERFLOW = 84
const EOWNERDEAD = 105
const EP_Agg = 16
const EP_CanBeNull = 1048576
const EP_Collate = 256
const EP_Commuted = 512
const EP_ConstFunc = 524288
const EP_DblQuoted = 64
const EP_Distinct = 2
const EP_FixedCol = 8
const EP_FromDDL = 1073741824
const EP_FromJoin = 1
const EP_HasFunc = 4
const EP_IfNullRow = 131072
const EP_Immutable = 2
const EP_InfixFunc = 128
const EP_IntValue = 1024
const EP_IsFalse = 536870912
const EP_IsTrue = 268435456
const EP_Leaf = 8388608
const EP_MemToken = 65536
const EP_NoReduce = 1
const EP_Propagate = 2097412
const EP_Quoted = 67108864
const EP_Reduced = 8192
const EP_Skip = 4096
const EP_Static = 134217728
const EP_Subquery = 2097152
const EP_Subrtn = 33554432
const EP_TokenOnly = 16384
const EP_Unlikely = 262144
const EP_VarSelect = 32
const EP_Win = 32768
const EP_WinFunc = 16777216
const EP_xIsSelect = 2048
const EPERM = 1
const EPFNOSUPPORT = 46
const EPIPE = 32
const EPROCLIM = 67
const EPROCUNAVAIL = 76
const EPROGMISMATCH = 75
const EPROGUNAVAIL = 74
const EPROTO = 100
const EPROTONOSUPPORT = 43
const EPROTOTYPE = 41
const EPWROFF = 82
const EQFULL = 106
const EQUIV_CLASS_MAX = 2
const ERANGE = 34
const EREMOTE = 71
const EROFS = 30
const ERPCMISMATCH = 73
const ESHLIBVERS = 87
const ESHUTDOWN = 58
const ESOCKTNOSUPPORT = 44
const ESPIPE = 29
const ESRCH = 3
const ESTALE = 70
const EtBUFSIZE = 70
const EtCHARX = 8
const EtDECIMAL = 16
const EtDYNSTRING = 6
const EtEXP = 2
const EtFLOAT = 1
const EtGENERIC = 3
const ETIME = 101
const ETIMEDOUT = 60
const EtINVALID = 17
const ETOOMANYREFS = 59
const EtORDINAL = 15
const EtPERCENT = 7
const EtPOINTER = 13
const EtRADIX = 0
const EtSIZE = 4
const EtSQLESCAPE = 9
const EtSQLESCAPE2 = 10
const EtSQLESCAPE3 = 14
const EtSRCITEM = 12
const EtSTRING = 5
const EtTOKEN = 11
const ETXTBSY = 26
const EUSERS = 68
const EWOULDBLOCK = 35
const EXCLUSIVE_LOCK = 4
const EXDEV = 18
const EXIT_FAILURE = 1
const EXIT_SUCCESS = 0
const EXPR_NEST_MAX = 32
const EXPRDUP_REDUCE = 1
const F_ADDFILESIGS = 61
const F_ADDSIGS = 59
const F_ALLOCATEALL = 4
const F_ALLOCATECONTIG = 2
const F_BARRIERFSYNC = 85
const F_CHECK_LV = 98
const F_CHKCLEAN = 41
const F_DUPFD = 0
const F_DUPFD_CLOEXEC = 67
const F_FINDSIGS = 78
const F_FLUSH_DATA = 40
const F_FREEZE_FS = 53
const F_FULLFSYNC = 51
const F_GETCODEDIR = 72
const F_GETFD = 1
const F_GETFL = 3
const F_GETLK = 7
const F_GETLKPID = 66
const F_GETNOSIGPIPE = 74
const F_GETOWN = 5
const F_GETPATH = 50
const F_GETPATH_MTMINFO = 71
const F_GLOBAL_NOCACHE = 55
const F_LOCK = 1
const F_LOG2PHYS = 49
const F_LOG2PHYS_EXT = 65
const F_NOCACHE = 48
const F_NODIRECT = 62
const F_OK = 0
const F_PATHPKG_CHECK = 52
const F_PEOFPOSMODE = 3
const F_PREALLOCATE = 42
const F_PUNCHHOLE = 99
const F_RDADVISE = 44
const F_RDAHEAD = 45
const F_RDLCK = 1
const F_SETBACKINGSTORE = 70
const F_SETFD = 2
const F_SETFL = 4
const F_SETLK = 8
const F_SETLKW = 9
const F_SETLKWTIMEOUT = 10
const F_SETNOSIGPIPE = 73
const F_SETOWN = 6
const F_SETSIZE = 43
const F_SINGLE_WRITER = 76
const F_SPECULATIVE_READ = 101
const F_TEST = 3
const F_THAW_FS = 54
const F_TLOCK = 2
const F_TRANSCODEKEY = 75
const F_TRIM_ACTIVE_FILE = 100
const F_ULOCK = 0
const F_UNLCK = 2
const F_VOLPOSMODE = 4
const F_WRLCK = 3
const False = 0
const FALSE = 0
const FAPPEND = 8
const FASYNC = 64
const FCNTL_FS_SPECIFIC_BASE = 65536
const FD_CLOEXEC = 1
const FD_SETSIZE = 1024
const FFDSYNC = 4194304
const FFSYNC = 128
const FILENAME_MAX = 1024
const FILESEC_ACL = 5
XXX these are private to the implementation
const FILESEC_GROUP = 2
const FILESEC_GRPUUID = 6
const FILESEC_MODE = 4
const FILESEC_OWNER = 1
const FILESEC_UUID = 3
const FLAG_SIGNED = 1
const FLAG_STRING = 4
const FNDELAY = 4
const FNONBLOCK = 4
const FOPEN_MAX = 20
const FP_CHOP = 3
const FP_ILOGB0 = -2147483648
const FP_ILOGBNAN = -2147483648
const FP_INFINITE = 2
const FP_NAN = 1
const FP_NORMAL = 4
const FP_PREC_24B = 0
const FP_PREC_53B = 2
const FP_PREC_64B = 3
const FP_QNAN = 1
const FP_RND_DOWN = 1
const FP_RND_NEAR = 0
const FP_RND_UP = 2
const FP_SNAN = 1
const FP_STATE_BYTES = 512
const FP_SUBNORMAL = 5
const FP_SUPERNORMAL = 6
const FP_ZERO = 3
const FPE_FLTDIV = 1
const FPE_FLTINV = 5
const FPE_FLTOVF = 2
const FPE_FLTRES = 4
const FPE_FLTSUB = 6
const FPE_FLTUND = 3
const FPE_INTDIV = 7
const FPE_INTOVF = 8
const FPE_NOOP = 0
const FREAD = 1
const FSCALE = 2048
const FSHIFT = 11
const FSOPT_NOFOLLOW = 1
const FST_EOF = -1
const FTS5_AND = 2
const FTS5_BI_MATCH = 1
const FTS5_BI_ORDER_DESC = 128
const FTS5_BI_ORDER_RANK = 32
const FTS5_BI_RANK = 2
const FTS5_BI_ROWID_EQ = 4
const FTS5_BI_ROWID_GE = 16
const FTS5_BI_ROWID_LE = 8
const FTS5_CARET = 12
const FTS5_COLON = 5
const FTS5_COMMA = 13
const FTS5_CORRUPT = 267
const FTS5_DATA_DLI_B = 1
const FTS5_DATA_ID_B = 16
const FTS5_DATA_PADDING = 20
const FTS5_DATA_PAGE_B = 31
const FTS5_DEFAULT_HASHSIZE = 1048576
const FTS5_DEFAULT_RANK = "bm25"
const FTS5_DETAIL_FULL = 0
const FTS5_DETAIL_NONE = 1
const FTS5_EOF = 0
const FTS5_LCP = 7
const FTS5_LP = 10
const FTS5_MAIN_PREFIX = 48
const FTS5_MAX_PAGE_SIZE = 65536
const FTS5_MAX_SEGMENT = 2000
const FTS5_MAX_TOKEN_SIZE = 32768
const FTS5_MERGE_NLIST = 16
const FTS5_MINUS = 6
const FTS5_NOT = 3
const FTS5_OPT_WORK_UNIT = 1000
const FTS5_OR = 1
const FTS5_PATTERN_GLOB = 66
const FTS5_PATTERN_LIKE = 65
const FTS5_PLAN_MATCH = 1
const FTS5_PLAN_ROWID = 6
const FTS5_PLAN_SCAN = 5
const FTS5_PLAN_SOURCE = 2
const FTS5_PLUS = 14
const FTS5_RANK_NAME = "rank"
const FTS5_RCP = 8
const FTS5_ROWID_NAME = "rowid"
const FTS5_RP = 11
const FTS5_STAR = 15
const FTS5_STMT_LOOKUP = 2
const FTS5_STMT_SCAN = 10
const FTS5_STRING = 9
const FTS5_TERM = 4
const FTS5_VOCAB_COL = 0
const FTS5_VOCAB_COL_SCHEMA = "term, col, doc, cnt"
const FTS5_VOCAB_INST_SCHEMA = "term, doc, col, offset"
const FTS5_VOCAB_ROW = 1
const FTS5_VOCAB_ROW_SCHEMA = "term, doc, cnt"
const FTS5_WORK_UNIT = 64
const FTS5CSR_EOF = 1
const FTS5CSR_FREE_ZRANK = 16
const Fts5YY_ACTTAB_COUNT = 105
const Fts5YY_MAX_REDUCE = 110
const Fts5YY_MAX_SHIFT = 34
const Fts5YY_MIN_REDUCE = 83
const Fts5YY_NO_ACTION = 82
const Fts5YY_REDUCE_MAX = 67
const Fts5YY_REDUCE_MIN = -17
const Fts5YY_SHIFT_COUNT = 34
const Fts5YY_SHIFT_MAX = 93
const Fts5YY_SHIFT_MIN = 0
const Fts5YYNFTS5TOKEN = 16
const Fts5YYNOCODE = 27
const Fts5YYNRULE = 28
const Fts5YYNSTATE = 35
const Fts5YYSTACKDEPTH = 100
const FULLY_WITHIN = 2
const FWRITE = 2
const GCC_VERSION = 11001000
const GEOPOLY_PI = 3.14159
const GID_MAX = 2147483647
const HASHSIZE = 97
const HASHTABLE_HASH_1 = 383
const HASHTABLE_NPAGE = 4096
const HASHTABLE_NSLOT = 8192
const HAVE_FCHOWN = 1
const HAVE_FULLFSYNC = 1
const HAVE_GETHOSTUUID = 1
const HAVE_LSTAT = 1
const HAVE_MREMAP = 0
const HAVE_PREAD = 1
const HAVE_PWRITE = 1
const HAVE_USLEEP = 1
const HUGE = 0
const I386_LPGBYTES = 2097152
const I386_LPGMASK = 2097151
const I386_LPGSHIFT = 21
const I386_PGBYTES = 4096
const I386_PGSHIFT = 12
const ILL_BADSTK = 8
const ILL_COPROC = 7
const ILL_ILLADR = 5
const ILL_ILLOPC = 1
const ILL_ILLOPN = 4
const ILL_ILLTRP = 2
const ILL_NOOP = 0
const ILL_PRVOPC = 3
const ILL_PRVREG = 6
const IN_INDEX_EPH = 2
const IN_INDEX_LOOP = 4
const IN_INDEX_NOOP = 5
const IN_INDEX_NOOP_OK = 1
const IN_INDEX_ROWID = 1
const INCRINIT_NORMAL = 0
const INCRINIT_ROOT = 2
const INCRINIT_TASK = 1
const INLINEFUNC_iif = 5
const INT16_MAX = 32767
const INT16_MIN = -32768
const INT32_MAX = 2147483647
const INT32_MIN = -2147483648
const INT64_MAX = 9223372036854775807
const INT64_MIN = -9223372036854775808
const INT8_MAX = 127
const INT8_MIN = -128
const INT_FAST16_MAX = 32767
const INT_FAST16_MIN = -32768
const INT_FAST32_MAX = 2147483647
const INT_FAST32_MIN = -2147483648
const INT_FAST64_MAX = 9223372036854775807
const INT_FAST64_MIN = -9223372036854775808
const INT_FAST8_MAX = 127
const INT_FAST8_MIN = -128
const INT_LEAST16_MAX = 32767
const INT_LEAST16_MIN = -32768
const INT_LEAST32_MAX = 2147483647
const INT_LEAST32_MIN = -2147483648
const INT_LEAST64_MAX = 9223372036854775807
const INT_LEAST64_MIN = -9223372036854775808
const INT_LEAST8_MAX = 127
const INT_LEAST8_MIN = -128
const INT_MAX = 2147483647
const INT_MIN = -2147483648
const INTERFACE = 1
const INTMAX_MAX = 9223372036854775807
const INTMAX_MIN = -9223372036854775808
const INTPTR_MAX = 9223372036854775807
const INTPTR_MIN = -9223372036854775808
const IOCPARM_MASK = 8191
const IOCPARM_MAX = 8192
const IOPOL_DEFAULT = 0
const IOPOL_IMPORTANT = 1
const IOPOL_NORMAL = 1
const IOPOL_PASSIVE = 2
const IOPOL_STANDARD = 5
const IOPOL_THROTTLE = 3
const IOPOL_TYPE_DISK = 0
const IOPOL_UTILITY = 4
const IOV_MAX = 1024
const IsStat4 = 1
const ITIMER_PROF = 2
const ITIMER_REAL = 0
const ITIMER_VIRTUAL = 1
const JEACH_ATOM = 3
const JEACH_FULLKEY = 6
const JEACH_ID = 4
const JEACH_JSON = 8
const JEACH_KEY = 0
const JEACH_PARENT = 5
const JEACH_PATH = 7
const JEACH_ROOT = 9
const JEACH_TYPE = 2
const JEACH_VALUE = 1
const JNODE_APPEND = 32
const JNODE_ESCAPE = 2
const JNODE_LABEL = 64
const JNODE_PATCH = 16
const JNODE_RAW = 1
const JNODE_REMOVE = 4
const JNODE_REPLACE = 8
const JSON_ARRAY = 6
const JSON_CACHE_ID = -429938
const JSON_CACHE_SZ = 4
const JSON_FALSE = 2
const JSON_INT = 3
const JSON_MAX_DEPTH = 2000
const JSON_NULL = 0
const JSON_OBJECT = 7
const JSON_REAL = 4
const JSON_STRING = 5
const JSON_SUBTYPE = 74
const JSON_TRUE = 1
const JT_CROSS = 2
const JT_ERROR = 64
const JT_INNER = 1
const JT_LEFT = 8
const JT_NATURAL = 4
const JT_OUTER = 32
const JT_RIGHT = 16
Reasons for exception for a guarded mach port
Reasons for exception for a guarded mach port
Reasons for exception for a guarded mach port
Reasons for exception for a guarded mach port
Reasons for exception for a guarded mach port
start of [optionally] non-fatal guards
Reasons for exception for a guarded mach port
Reasons for exception for a guarded mach port
Reasons for exception for a guarded mach port
Reasons for exception for a guarded mach port
Reasons for exception for a guarded mach port
Reasons for exception for a guarded mach port
Reasons for exception for a guarded mach port
Reasons for exception for a guarded mach port
Reasons for exception for a guarded mach port
Reasons for exception for a guarded mach port
Reasons for exception for a guarded mach port
Reasons for exception for a guarded mach port
Reasons for exception for a guarded mach port
Reasons for exception for a guarded mach port
const L_ctermid = 1024
const L_INCR = 1
const L_SET = 0
const L_tmpnam = 1024
const L_XTND = 2
const LINE_MAX = 2048
const LITTLE_ENDIAN = 1234
const LLONG_MAX = 9223372036854775807
const LLONG_MIN = -9223372036854775808
const LOCATE_NOERR = 2
const LOCATE_VIEW = 1
const LOCK_EX = 2
const LOCK_NB = 4
const LOCK_SH = 1
const LOCK_UN = 8
const LONG_BIT = 64
const LONG_LONG_MAX = 9223372036854775807
const LONG_LONG_MIN = -9223372036854775808
const LONG_MAX = 9223372036854775807
const LONG_MIN = -9223372036854775808
const LOOKASIDE_SMALL = 128
const M10d_Any = 1
const M10d_No = 2
const M10d_Yes = 0
const M16KCLBYTES = 16384
const M16KCLSHIFT = 14
const M_1_PI = 0.31831
const M_2_PI = 0.63662
const M_2_SQRTPI = 1.12838
const M_E = 2.71828
const M_LN10 = 2.30259
const M_LN2 = 0.693147
const M_LOG10E = 0.434294
const M_LOG2E = 1.4427
const M_PI = 3.14159
const M_PI_2 = 1.5708
const M_PI_4 = 0.785398
const M_SQRT1_2 = 0.707107
const M_SQRT2 = 1.41421
const MACH_PORT_NULL = 0
const MACH_PORT_QLIMIT_MAX = 1024
const MACH_PORT_TYPE_DNREQUEST = 2147483648
const MACH_PORT_TYPE_SPREQUEST = 1073741824
const MADV_CAN_REUSE = 9
const MADV_DONTNEED = 4
const MADV_FREE = 5
const MADV_FREE_REUSE = 8
const MADV_NORMAL = 0
const MADV_PAGEOUT = 10
const MADV_RANDOM = 1
const MADV_SEQUENTIAL = 2
const MADV_WILLNEED = 3
const MAP_32BIT = 32768
const MAP_ANON = 4096
const MAP_ANONYMOUS = 4096
const MAP_COPY = 2
const MAP_FILE = 0
const MAP_FIXED = 16
const MAP_HASSEMAPHORE = 512
const MAP_JIT = 2048
const MAP_NOCACHE = 1024
const MAP_NOEXTEND = 256
const MAP_NORESERVE = 64
const MAP_PRIVATE = 2
const MAP_RENAME = 32
const MAP_RESERVED0080 = 128
const MAP_RESILIENT_MEDIA = 16384
const MAP_SHARED = 1
const MATH_ERREXCEPT = 2
const MATH_ERRNO = 1
const MAX_AUDIT_RECORD_SIZE = 32767
const MAX_AUDIT_RECORDS = 20
const MAX_CANON = 1024
const MAX_INPUT = 1024
const MAX_PATHNAME = 512
const MAX_SECTOR_SIZE = 65536
const MAXALLOCSAVE = 8192
const MAXAUDITDATA = 32767
const MAXBSIZE = 1048576
const MAXCOMLEN = 16
const MAXDOMNAMELEN = 256
const MAXFLOAT = 3.40282e+38
const MAXFRAG = 8
const MAXHOSTNAMELEN = 256
const MAXINTERP = 64
const MAXLOGNAME = 255
const MAXPATHLEN = 1024
const MAXPHYS = 131072
const MAXPHYSIO = 131072
const MAXPHYSIO_WIRED = 16777216
const MAXPRI = 127
const MAXUPRC = 266
const MB_LEN_MAX = 6
const MBIGCLBYTES = 4096
const MBIGCLSHIFT = 12
const MCL_CURRENT = 1
const MCL_FUTURE = 2
const MCLBYTES = 2048
const MCLOFSET = 2047
const MCLSHIFT = 11
const MEM_AffMask = 63
const MEM_Agg = 8192
const MEM_Blob = 16
const MEM_Cleared = 256
const MEM_Dyn = 1024
const MEM_Ephem = 4096
const MEM_FromBind = 64
const MEM_Int = 4
const MEM_IntReal = 32
const MEM_Null = 1
const MEM_Real = 8
const MEM_Static = 2048
const MEM_Str = 2
const MEM_Subtype = 32768
const MEM_Term = 512
const MEM_TypeMask = 49599
const MEM_Undefined = 128
const MEM_Zero = 16384
const MEMTYPE_HEAP = 1
const MEMTYPE_PCACHE = 4
const MFSNAMELEN = 15
const MFSTYPENAMELEN = 16
const MIN_AUDIT_FILE_SIZE = 524288
const MINBUCKET = 4
const MINCORE_ANONYMOUS = 128
const MINCORE_COPIED = 64
const MINCORE_INCORE = 1
const MINCORE_MODIFIED = 4
const MINCORE_PAGED_OUT = 32
const MINSIGSTKSZ = 32768
const MNAMELEN = 1024
const MNT_ASYNC = 64
const MNT_AUTOMOUNTED = 4194304
const MNT_CMDFLAGS = 983040
const MNT_CPROTECT = 128
const MNT_DEFWRITE = 33554432
const MNT_DONTBROWSE = 1048576
const MNT_DOVOLFS = 32768
const MNT_DWAIT = 4
const MNT_EXPORTED = 256
const MNT_FORCE = 524288
const MNT_IGNORE_OWNERSHIP = 2097152
const MNT_JOURNALED = 8388608
const MNT_LOCAL = 4096
const MNT_MULTILABEL = 67108864
const MNT_NOATIME = 268435456
const MNT_NOBLOCK = 131072
const MNT_NODEV = 16
const MNT_NOEXEC = 4
const MNT_NOSUID = 8
const MNT_NOUSERXATTR = 16777216
const MNT_NOWAIT = 2
const MNT_QUARANTINE = 1024
const MNT_QUOTA = 8192
const MNT_RDONLY = 1
const MNT_RELOAD = 262144
const MNT_REMOVABLE = 512
const MNT_ROOTFS = 16384
const MNT_SNAPSHOT = 1073741824
const MNT_STRICTATIME = 2147483648
const MNT_SYNCHRONOUS = 2
const MNT_UNION = 32
const MNT_UNKNOWNPERMISSIONS = 2097152
const MNT_UPDATE = 65536
const MNT_VISFLAGMASK = 3622893567
const MNT_WAIT = 1
const MPG_FLAGS_STRICT_REPLY_INVALID_REPLY_PORT = 144115188075855872
const MPG_FLAGS_STRICT_REPLY_INVALID_VOUCHER = 288230376151711744
const MPG_FLAGS_STRICT_REPLY_MASK = 18374686479671623680
const MPG_FLAGS_STRICT_REPLY_MISMATCHED_PERSONA = 1152921504606846976
const MPG_FLAGS_STRICT_REPLY_NO_BANK_ATTR = 576460752303423488
const MPG_STRICT = 1
const MPO_DENAP_RECEIVER = 64
const MPO_QLIMIT = 2
const MPO_STRICT = 32
const MPO_TEMPOWNER = 4
const MS_ASYNC = 1
const MS_DEACTIVATE = 8
const MS_INVALIDATE = 2
const MS_KILLPAGES = 4
const MS_SYNC = 16
const MSIZE = 256
const MSIZESHIFT = 8
const MSVC_VERSION = 0
const N_OR_COST = 3
const N_SORT_BUCKET = 32
const N_STATEMENT = 8
const NAME_MAX = 255
const NB = 3
const NBBY = 8
const NBPG = 4096
const NC_AllowAgg = 1
const NC_AllowWin = 16384
const NC_Complex = 8192
const NC_FromDDL = 262144
const NC_GenCol = 8
const NC_HasAgg = 16
const NC_HasWin = 32768
const NC_IdxExpr = 32
const NC_InAggFunc = 131072
const NC_IsCheck = 4
const NC_IsDDL = 65536
const NC_MinMaxAgg = 4096
const NC_NoSelect = 524288
const NC_PartIdx = 2
const NC_SelfRef = 46
const NC_UAggInfo = 256
const NC_UBaseReg = 1024
const NC_UEList = 128
const NC_UUpsert = 512
const NC_VarSelect = 64
const NCARGS = 262144
const NDEBUG = 1
const NeXTBSD = 1995064
const NeXTBSD4_0 = 0
const NFS_MAX_FH_SIZE = 128
const NFSV2_MAX_FH_SIZE = 32
const NFSV3_MAX_FH_SIZE = 64
const NFSV4_MAX_FH_SIZE = 128
const NGROUPS = 16
const NGROUPS_MAX = 16
const NL_ARGMAX = 9
const NL_LANGMAX = 14
const NL_MSGMAX = 32767
const NL_NMAX = 1
const NL_SETMAX = 255
const NL_TEXTMAX = 2048
const NMBCLUSTERS = 512
const NN = 1
const NO_LOCK = 0
const NOFILE = 256
const NOGROUP = 65535
const NOT_WITHIN = 0
const NSIG = 32
const NZERO = 20
const O_ACCMODE = 3
const O_ALERT = 536870912
const O_APPEND = 8
const O_ASYNC = 64
const O_BINARY = 0
const O_CLOEXEC = 16777216
const O_CREAT = 512
const O_DIRECTORY = 1048576
const O_DSYNC = 4194304
const O_EVTONLY = 32768
const O_EXCL = 2048
const O_EXLOCK = 32
const O_FSYNC = 128
const O_LARGEFILE = 0
const O_NDELAY = 4
const O_NOCTTY = 131072
const O_NOFOLLOW = 256
const O_NONBLOCK = 4
const O_POPUP = 2147483648
const O_RDONLY = 0
const O_RDWR = 2
const O_SHLOCK = 16
const O_SYNC = 128
const O_TRUNC = 1024
const O_WRONLY = 1
const OE_Abort = 2
const OE_Cascade = 10
const OE_Default = 11
const OE_Fail = 3
const OE_Ignore = 4
const OE_None = 0
const OE_Replace = 5
const OE_Restrict = 7
const OE_Rollback = 1
const OE_SetDflt = 9
const OE_SetNull = 8
const OE_Update = 6
const OFF_MAX = 9223372036854775807
const OFF_MIN = -9223372036854775808
const OMIT_TEMPDB = 0
const ONEPASS_MULTI = 2
const ONEPASS_OFF = 0
const ONEPASS_SINGLE = 1
const OP_Abortable = 179
const OP_Add = 106
const OP_AddImm = 83
const OP_Affinity = 92
const OP_AggFinal = 161
const OP_AggInverse = 157
const OP_AggStep = 158
const OP_AggStep1 = 159
const OP_AggValue = 160
const OP_And = 44
const OP_AutoCommit = 1
const OP_BitAnd = 102
const OP_BitNot = 113
const OP_BitOr = 103
const OP_Blob = 74
const OP_Cast = 85
const OP_Checkpoint = 6
const OP_ChngCntRow = 80
const OP_Clear = 141
const OP_Close = 118
const OP_CollSeq = 82
const OP_Column = 91
const OP_ColumnsUsed = 119
const OP_Compare = 87
const OP_Concat = 111
const OP_Copy = 77
const OP_Count = 94
const OP_CreateBtree = 143
const OP_CursorHint = 175
const OP_CursorLock = 163
const OP_CursorUnlock = 164
const OP_DecrJumpZero = 59
const OP_DeferredSeek = 137
const OP_Delete = 126
const OP_Destroy = 140
const OP_Divide = 109
const OP_DropIndex = 148
const OP_DropTable = 147
const OP_DropTrigger = 149
const OP_ElseEq = 58
const OP_EndCoroutine = 66
const OP_Eq = 53
const OP_Expire = 162
const OP_Explain = 178
const OP_FinishSeek = 139
const OP_FkCounter = 154
const OP_FkIfZero = 47
const OP_Found = 30
const OP_Function = 64
const OP_Ge = 57
const OP_Gosub = 12
const OP_Goto = 11
const OP_Gt = 54
const OP_Halt = 68
const OP_HaltIfNull = 67
const OP_IdxDelete = 136
const OP_IdxGE = 41
const OP_IdxGT = 39
const OP_IdxInsert = 134
const OP_IdxLE = 38
const OP_IdxLT = 40
const OP_IdxRowid = 138
const OP_If = 18
const OP_IfNoHope = 27
const OP_IfNot = 20
const OP_IfNotOpen = 26
const OP_IfNotZero = 49
const OP_IfNullRow = 21
const OP_IfPos = 48
const OP_IfSmaller = 34
const OP_IncrVacuum = 60
const OP_Init = 62
const OP_InitCoroutine = 13
const OP_Insert = 124
const OP_Int64 = 70
const OP_IntCopy = 79
const OP_Integer = 69
const OP_IntegrityCk = 150
const OP_IsNull = 50
const OP_IsTrue = 88
const OP_JournalMode = 7
const OP_Jump = 16
const OP_Last = 33
const OP_Le = 55
const OP_LoadAnalysis = 146
const OP_Lt = 56
const OP_MakeRecord = 93
const OP_MaxPgcnt = 173
const OP_MemMax = 155
const OP_Move = 76
const OP_Multiply = 108
const OP_MustBeInt = 15
const OP_Ne = 52
const OP_NewRowid = 123
const OP_Next = 5
const OP_NoConflict = 28
const OP_Noop = 177
const OP_Not = 19
const OP_NotExists = 32
const OP_NotFound = 29
const OP_NotNull = 51
const OP_Null = 72
const OP_NullRow = 132
const OP_Offset = 90
const OP_OffsetLimit = 156
const OP_Once = 17
const OP_OpenAutoindex = 101
const OP_OpenDup = 100
const OP_OpenEphemeral = 112
const OP_OpenPseudo = 117
const OP_OpenRead = 98
const OP_OpenWrite = 99
const OP_Or = 43
const OP_Pagecount = 172
const OP_Param = 153
const OP_ParseSchema = 145
const OP_Permutation = 86
const OP_Prev = 4
const OP_Program = 46
const OP_PureFunc = 63
const OP_ReadCookie = 95
const OP_Real = 152
const OP_RealAffinity = 84
const OP_ReleaseReg = 176
const OP_Remainder = 110
const OP_ReopenIdx = 97
const OP_ResetCount = 127
const OP_ResetSorter = 142
const OP_ResultRow = 81
const OP_Return = 65
const OP_Rewind = 37
const OP_RowCell = 125
const OP_RowData = 130
const OP_Rowid = 131
const OP_RowSetAdd = 151
const OP_RowSetRead = 42
const OP_RowSetTest = 45
const OP_Savepoint = 0
const OP_SCopy = 78
const OP_SeekEnd = 133
const OP_SeekGE = 24
const OP_SeekGT = 25
const OP_SeekHit = 121
const OP_SeekLE = 23
const OP_SeekLT = 22
const OP_SeekRowid = 31
const OP_SeekScan = 120
const OP_Sequence = 122
const OP_SequenceTest = 115
const OP_SetCookie = 96
const OP_ShiftLeft = 104
const OP_ShiftRight = 105
const OP_SoftNull = 73
const OP_Sort = 36
const OP_SorterCompare = 128
const OP_SorterData = 129
const OP_SorterInsert = 135
const OP_SorterNext = 3
const OP_SorterOpen = 114
const OP_SorterSort = 35
const OP_SqlExec = 144
const OP_String = 71
const OP_String8 = 116
const OP_Subtract = 107
const OP_TableLock = 165
const OP_Trace = 174
const OP_Transaction = 2
const OP_Vacuum = 8
const OP_Variable = 75
const OP_VBegin = 166
const OP_VColumn = 170
const OP_VCreate = 167
const OP_VDestroy = 168
const OP_VFilter = 9
const OP_VNext = 61
const OP_VOpen = 169
const OP_VRename = 171
const OP_VUpdate = 10
const OP_Yield = 14
const OP_ZeroOrNull = 89
const OPEN_MAX = 10240
const OPFLAG_APPEND = 8
const OPFLAG_AUXDELETE = 4
const OPFLAG_BULKCSR = 1
const OPFLAG_EPHEM = 1
const OPFLAG_FORDELETE = 8
const OPFLAG_ISNOOP = 64
const OPFLAG_ISUPDATE = 4
const OPFLAG_LASTROWID = 32
const OPFLAG_LENGTHARG = 64
const OPFLAG_NCHANGE = 1
const OPFLAG_NOCHNG = 1
const OPFLAG_NOCHNG_MAGIC = 109
const OPFLAG_P2ISREG = 16
const OPFLAG_PERMUTE = 1
const OPFLAG_PREFORMAT = 128
const OPFLAG_SEEKEQ = 2
const OPFLAG_TYPEOFARG = 128
const OPFLG_IN1 = 2
const OPFLG_IN2 = 4
const OPFLG_IN3 = 8
const OPFLG_JUMP = 1
const OPFLG_OUT2 = 16
const OPFLG_OUT3 = 32
const OS_FALLTHROUGH = 0
const OS_NOESCAPE = 0
const OS_OVERLOADABLE = 0
const OS_VXWORKS = 0
const OVERFLOW = 3
const P4_ADVANCE = -5
const P4_COLLSEQ = -2
const P4_DYNAMIC = -7
const P4_DYNBLOB = -17
const P4_EXPR = -10
const P4_FREE_IF_LE = -7
const P4_FUNCCTX = -16
const P4_FUNCDEF = -8
const P4_INT32 = -3
const P4_INT64 = -14
const P4_INTARRAY = -15
const P4_KEYINFO = -9
const P4_MEM = -11
const P4_NOTUSED = 0
const P4_REAL = -13
const P4_STATIC = -1
const P4_SUBPROGRAM = -4
const P4_TABLE = -6
const P4_TRANSIENT = 0
const P4_VTAB = -12
const P5_ConstraintFK = 4
[XSI] The type idtype_t shall be defined as an enumeration type whose possible values shall include at least P_ALL, P_PID, and P_PGID.
[XSI] The type idtype_t shall be defined as an enumeration type whose possible values shall include at least P_ALL, P_PID, and P_PGID.
[XSI] The type idtype_t shall be defined as an enumeration type whose possible values shall include at least P_ALL, P_PID, and P_PGID.
const P_tmpdir = "/var/tmp/"
const PAGE_MASK = 4095
const PAGE_MAX_MASK = 4095
const PAGE_MAX_SHIFT = 12
const PAGE_MAX_SIZE = 4096
const PAGE_MIN_MASK = 4095
const PAGE_MIN_SHIFT = 12
const PAGE_MIN_SIZE = 4096
const PAGE_SHIFT = 12
const PAGE_SIZE = 4096
const PAGER_CACHESPILL = 32
const PAGER_ERROR = 6
const PAGER_FLAGS_MASK = 56
const PAGER_FULLFSYNC = 8
const PAGER_MEMORY = 2
const PAGER_OPEN = 0
const PAGER_READER = 1
const PAGER_STAT_HIT = 0
const PAGER_STAT_MISS = 1
const PAGER_STAT_SPILL = 3
const PAGER_STAT_WRITE = 2
const PARSE_MODE_UNMAP = 3
const PARTLY_WITHIN = 1
const PASS_MAX = 128
const PATH_MAX = 1024
const PCATCH = 256
const PDP_ENDIAN = 3412
const PDROP = 1024
const PENDING_LOCK = 3
const PGHDR_CLEAN = 1
const PGHDR_DIRTY = 2
const PGHDR_DONT_WRITE = 16
const PGHDR_MMAP = 32
const PGHDR_NEED_SYNC = 8
const PGHDR_WAL_APPEND = 64
const PGHDR_WRITEABLE = 4
const PGOFSET = 4095
const PGSHIFT = 12
const PINOD = 8
const PIPE_BUF = 512
const PLOCK = 36
const PLOSS = 6
const POLL_ERR = 4
const POLL_HUP = 6
const POLL_IN = 1
const POLL_MSG = 3
const POLL_OUT = 2
const POLL_PRI = 5
const PPAUSE = 40
const PPPDISC = 5
const PragFlg_ReadOnly = 8
const PragFlg_Result0 = 16
const PragFlg_Result1 = 32
const PragFlg_SchemaOpt = 64
const PragFlg_SchemaReq = 128
const PragTyp_ENCODING = 14
const PragTyp_FLAG = 4
const PragTyp_INDEX_INFO = 20
const PragTyp_INDEX_LIST = 21
const PragTyp_MMAP_SIZE = 28
const PragTyp_OPTIMIZE = 30
const PragTyp_PAGE_COUNT = 27
const PragTyp_PAGE_SIZE = 31
const PragTyp_STATS = 44
const PragTyp_TABLE_INFO = 37
const PragTyp_TEMP_STORE = 38
const PragTyp_THREADS = 40
const PRIBIO = 16
const PRIMASK = 255
const PRIO_DARWIN_BG = 4096
const PRIO_DARWIN_NONUI = 4097
const PRIO_MAX = 20
const PRIO_MIN = -20
const PRIO_PGRP = 1
const PRIO_PROCESS = 0
const PRIO_USER = 2
const PROT_EXEC = 4
const PROT_NONE = 0
const PROT_READ = 1
const PROT_WRITE = 2
const PROXY_HEADERLEN = 1
const PROXY_HOSTIDLEN = 16
const PROXY_MAXCONCHLEN = 1041
const PROXY_PATHINDEX = 17
const PSOCK = 24
const PSPIN = 2048
const PSWP = 0
const PTF_INTKEY = 1
const PTF_LEAF = 8
const PTF_LEAFDATA = 4
const PTF_ZERODATA = 2
const PTHREAD_KEYS_MAX = 512
const PTHREAD_STACK_MIN = 8192
const PTRDIFF_MAX = 9223372036854775807
const PTRDIFF_MIN = -9223372036854775808
const PTRMAP_BTREE = 5
const PTRMAP_FREEPAGE = 2
const PTRMAP_OVERFLOW1 = 3
const PTRMAP_OVERFLOW2 = 4
const PTRMAP_ROOTPAGE = 1
const PTTYBLOCK = 512
const PUSER = 50
const PVFS = 20
const PVM = 4
const PWAIT = 32
const PZERO = 22
const QUAD_MAX = 9223372036854775807
const QUAD_MIN = -9223372036854775808
const R_OK = 4
const RAND_MAX = 2147483647
const RBU_CREATE_STATE = "CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)"
const RBU_DELETE = 2
const RBU_IDX_DELETE = 4
const RBU_IDX_INSERT = 5
const RBU_INSERT = 1
const RBU_PK_EXTERNAL = 3
const RBU_PK_IPK = 2
const RBU_PK_NONE = 1
const RBU_PK_NOTABLE = 0
const RBU_PK_VTAB = 5
const RBU_REPLACE = 3
const RBU_STAGE_CKPT = 4
const RBU_STAGE_DONE = 5
const RBU_STAGE_MOVE = 2
const RBU_STAGE_OAL = 1
const RBU_STATE_CKPT = 6
const RBU_STATE_DATATBL = 10
const RBU_STATE_IDX = 3
const RBU_STATE_OALSZ = 8
const RBU_STATE_ROW = 4
const RBU_STATE_STAGE = 1
const RBU_STATE_TBL = 2
const RBU_UPDATE = 6
const RE_DUP_MAX = 255
const READ_LOCK = 1
const READMARK_NOT_USED = 4294967295
const RENAME_EXCL = 4
const RENAME_SECLUDE = 1
const RENAME_SWAP = 2
const RESERVED_LOCK = 2
const RETURNING_TRIGGER_NAME = "sqlite_returning"
const RLIM_NLIMITS = 9
const RLIMIT_AS = 5
const RLIMIT_CORE = 4
const RLIMIT_CPU = 0
const RLIMIT_DATA = 2
const RLIMIT_FSIZE = 1
const RLIMIT_MEMLOCK = 6
const RLIMIT_NOFILE = 8
const RLIMIT_NPROC = 7
const RLIMIT_RSS = 5
const RLIMIT_STACK = 3
const RNDAWAY = 0
const RNDTOWARDS = 0
const ROWSET_NEXT = 2
const ROWSET_SORTED = 1
const RSIZE_MAX = 9223372036854775807
const RTLD_FIRST = 256
const RTLD_GLOBAL = 8
const RTLD_LAZY = 1
const RTLD_LOCAL = 4
const RTLD_NODELETE = 128
const RTLD_NOLOAD = 16
const RTLD_NOW = 2
const RTREE_CACHE_SZ = 5
const RTREE_DEFAULT_ROWEST = 1048576
const RTREE_EQ = 65
const RTREE_FALSE = 64
const RTREE_GE = 68
const RTREE_GT = 69
const RTREE_LE = 66
const RTREE_LT = 67
const RTREE_MATCH = 70
const RTREE_MAX_DEPTH = 40
const RTREE_MAXCELLS = 51
const RTREE_MIN_ROWEST = 100
const RTREE_QUERY = 71
const RTREE_TRUE = 63
const RTREE_ZERO = 0
const RUSAGE_CHILDREN = -1
const RUSAGE_INFO_V0 = 0
const RUSAGE_INFO_V1 = 1
const RUSAGE_INFO_V2 = 2
const RUSAGE_INFO_V3 = 3
const RUSAGE_INFO_V4 = 4
const RUSAGE_SELF = 0
const S_BLKSIZE = 512
const S_IEXEC = 64
const S_IFBLK = 24576
const S_IFCHR = 8192
const S_IFDIR = 16384
const S_IFIFO = 4096
const S_IFLNK = 40960
const S_IFMT = 61440
const S_IFREG = 32768
const S_IFSOCK = 49152
const S_IFWHT = 57344
const S_IREAD = 256
const S_IRGRP = 32
const S_IROTH = 4
const S_IRUSR = 256
const S_IRWXG = 56
const S_IRWXO = 7
const S_IRWXU = 448
const S_ISGID = 1024
const S_ISTXT = 512
const S_ISUID = 2048
const S_ISVTX = 512
const S_IWGRP = 16
const S_IWOTH = 2
const S_IWRITE = 128
const S_IWUSR = 128
const S_IXGRP = 8
const S_IXOTH = 1
const S_IXUSR = 64
const SA_64REGSET = 512
const SA_NOCLDSTOP = 8
const SA_NOCLDWAIT = 32
const SA_NODEFER = 16
const SA_ONSTACK = 1
const SA_RESETHAND = 4
const SA_RESTART = 2
const SA_SIGINFO = 64
const SA_USERSPACE_MASK = 127
const SA_USERTRAMP = 256
const SAVEPOINT_BEGIN = 0
const SCHAR_MAX = 127
const SCHAR_MIN = -128
const SCHEMA_ROOT = 1
const SEEK_CUR = 1
const SEEK_DATA = 4
const SEEK_END = 2
const SEEK_HOLE = 3
const SEEK_SET = 0
const SEGV_ACCERR = 2
const SEGV_MAPERR = 1
const SEGV_NOOP = 0
const SF_Aggregate = 8
const SF_All = 2
const SF_APPEND = 262144
const SF_ARCHIVED = 65536
const SF_ComplexResult = 262144
const SF_Compound = 256
const SF_Converted = 65536
const SF_CopyCte = 67108864
const SF_DATALESS = 1073741824
const SF_Distinct = 1
const SF_Expanded = 64
const SF_FixedLimit = 16384
const SF_HasAgg = 16
const SF_HasTypeInfo = 128
const SF_IMMUTABLE = 131072
const SF_IncludeHidden = 131072
const SF_MaybeConvert = 32768
const SF_MinMaxAgg = 4096
const SF_MultiPart = 33554432
const SF_MultiValue = 1024
const SF_NestedFrom = 2048
const SF_NoopOrderBy = 4194304
const SF_PushDown = 16777216
const SF_Recursive = 8192
const SF_Resolved = 4
const SF_RESTRICTED = 524288
const SF_SETTABLE = 1073676288
const SF_SUPPORTED = 10420224
const SF_SYNTHETIC = 3221225472
const SF_UpdateFrom = 8388608
const SF_UsesEphemeral = 32
const SF_Values = 512
const SF_View = 2097152
const SF_WhereBegin = 524288
const SF_WinRewrite = 1048576
const SHARED_LOCK = 1
const SHARED_SIZE = 510
const SHRT_MAX = 32767
const SHRT_MIN = -32768
const SI_ASYNCIO = 65540
const SI_MESGQ = 65541
const SI_QUEUE = 65538
const SI_TIMER = 65539
const SI_USER = 65537
const SIG_ATOMIC_MAX = 2147483647
const SIG_ATOMIC_MIN = -2147483648
const SIG_BLOCK = 1
const SIG_SETMASK = 3
const SIG_UNBLOCK = 2
const SIGABRT = 6
const SIGALRM = 14
const SIGBUS = 10
const SIGCHLD = 20
const SIGCONT = 19
const SIGEMT = 7
const SIGEV_NONE = 0
const SIGEV_SIGNAL = 1
const SIGEV_THREAD = 3
const SIGFPE = 8
const SIGHUP = 1
const SIGILL = 4
const SIGINFO = 29
const SIGINT = 2
const SIGIO = 23
const SIGIOT = 6
const SIGKILL = 9
const SIGPIPE = 13
const SIGPROF = 27
const SIGQUIT = 3
const SIGSEGV = 11
const SIGSTKSZ = 131072
const SIGSTOP = 17
const SIGSYS = 12
const SIGTERM = 15
const SIGTRAP = 5
const SIGTSTP = 18
const SIGTTIN = 21
const SIGTTOU = 22
const SIGURG = 16
const SIGUSR1 = 30
const SIGUSR2 = 31
const SIGVTALRM = 26
const SIGWINCH = 28
const SIGXCPU = 24
const SIGXFSZ = 25
const SING = 2
const SIZE_MAX = 18446744073709551615
const SIZE_T_MAX = 18446744073709551615
const SLIPDISC = 4
const SLOT_2_0 = 2080895
const SLOT_4_2_0 = 4028612735
const SORTER_TYPE_TEXT = 2
const SPILLFLAG_NOSYNC = 4
const SPILLFLAG_OFF = 1
const SQLITE3_H = 0
const SQLITE3_TEXT = 3
const SQLITE3EXT_H = 0
const SQLITE_ABORT = 4
const SQLITE_AFF_BLOB = 65
const SQLITE_AFF_INTEGER = 68
const SQLITE_AFF_MASK = 71
const SQLITE_AFF_NONE = 64
const SQLITE_AFF_NUMERIC = 67
const SQLITE_AFF_REAL = 69
const SQLITE_AFF_TEXT = 66
const SQLITE_AllOpts = 4294967295
const SQLITE_ALTER_TABLE = 26
const SQLITE_ANALYZE = 28
const SQLITE_ANY = 5
const SQLITE_API = 0
const SQLITE_APICALL = 0
const SQLITE_ASCII = 1
const SQLITE_ATTACH = 24
const SQLITE_AUTH = 23
const SQLITE_AUTH_USER = 279
const SQLITE_AutoIndex = 32768
const SQLITE_BIG_DBL = 0
const SQLITE_BIGENDIAN = 0
const SQLITE_BLOB = 4
const SQLITE_BTREE_H = 0
const SQLITE_BUSY = 5
const SQLITE_BUSY_TIMEOUT = 773
const SQLITE_BYTEORDER = 1234
const SQLITE_CacheSpill = 32
const SQLITE_CALLBACK = 0
const SQLITE_CANTOPEN = 14
const SQLITE_CDECL = 0
const SQLITE_CellSizeCk = 2097152
const SQLITE_CONFIG_LOG = 16
const SQLITE_CONFIG_URI = 17
const SQLITE_CONSTRAINT = 19
const SQLITE_COPY = 0
const SQLITE_CORE = 1
const SQLITE_CORRUPT = 11
const SQLITE_CORRUPT_VTAB = 267
const SQLITE_CountOfView = 512
const SQLITE_CursorHints = 1024
const SQLITE_DBCONFIG_MAX = 1017
const SQLITE_DEFAULT_SORTERREF_SIZE = 2147483647
const SQLITE_Defensive = 268435456
const SQLITE_DeferFKs = 524288
const SQLITE_DELETE = 9
const SQLITE_DENY = 1
const SQLITE_DETACH = 25
const SQLITE_DETERMINISTIC = 2048
const SQLITE_DIRECTONLY = 524288
const SQLITE_DistinctOpt = 16
const SQLITE_DONE = 101
const SQLITE_DQS = 3
const SQLITE_DqsDDL = 536870912
const SQLITE_DqsDML = 1073741824
const SQLITE_DROP_INDEX = 10
const SQLITE_DROP_TABLE = 11
const SQLITE_DROP_VIEW = 17
const SQLITE_DROP_VTABLE = 30
const SQLITE_ECEL_DUP = 1
const SQLITE_ECEL_REF = 4
const SQLITE_EMPTY = 16
const SQLITE_EnableQPSG = 8388608
const SQLITE_EnableTrigger = 262144
const SQLITE_EnableView = 2147483648
const SQLITE_ERROR = 1
const SQLITE_ERROR_RETRY = 513
const SQLITE_FAIL = 3
const SQLITE_FCNTL_DB_UNCHANGED = 3389603744
const SQLITE_FCNTL_PDB = 30
const SQLITE_FCNTL_RBU = 26
const SQLITE_FCNTL_RBUCNT = 5149216
const SQLITE_FCNTL_SYNC = 21
const SQLITE_FCNTL_TRACE = 19
const SQLITE_FILE_HEADER = "SQLite format 3"
const SQLITE_FLOAT = 2
const SQLITE_ForeignKeys = 16384
const SQLITE_FORMAT = 24
const SQLITE_FP_PRECISION_LIMIT = 100000000
const SQLITE_FRAME_MAGIC = 2275391262
const SQLITE_Fts3Tokenizer = 4194304
const SQLITE_FULL = 13
const SQLITE_FullFSync = 8
const SQLITE_FUNC_CASE = 8
const SQLITE_FUNC_CONSTANT = 2048
const SQLITE_FUNC_COUNT = 256
const SQLITE_FUNC_DIRECT = 524288
const SQLITE_FUNC_EPHEM = 16
const SQLITE_FUNC_INLINE = 4194304
const SQLITE_FUNC_INTERNAL = 262144
const SQLITE_FUNC_LENGTH = 64
const SQLITE_FUNC_LIKE = 4
const SQLITE_FUNC_MINMAX = 4096
const SQLITE_FUNC_OFFSET = 32768
const SQLITE_FUNC_SLOCHNG = 8192
const SQLITE_FUNC_SUBTYPE = 1048576
const SQLITE_FUNC_TEST = 16384
const SQLITE_FUNC_TYPEOF = 128
const SQLITE_FUNC_UNLIKELY = 1024
const SQLITE_FUNC_UNSAFE = 2097152
const SQLITE_FUNC_WINDOW = 65536
const SQLITE_FUNCTION = 31
const SQLITE_HASH_H = 0
const SQLITE_IGNORE = 2
const SQLITE_IgnoreChecks = 512
const SQLITE_INNOCUOUS = 2097152
const SQLITE_INSERT = 18
const SQLITE_INTEGER = 1
const SQLITE_INTERNAL = 2
const SQLITE_INTERRUPT = 9
const SQLITE_IOERR = 10
const SQLITE_IOERR_ACCESS = 3338
const SQLITE_IOERR_AUTH = 7178
const SQLITE_IOERR_BLOCKED = 2826
const SQLITE_IOERR_CLOSE = 4106
const SQLITE_IOERR_CONVPATH = 6666
const SQLITE_IOERR_DATA = 8202
const SQLITE_IOERR_DELETE = 2570
const SQLITE_IOERR_FSTAT = 1802
const SQLITE_IOERR_FSYNC = 1034
const SQLITE_IOERR_LOCK = 3850
const SQLITE_IOERR_MMAP = 6154
const SQLITE_IOERR_NOMEM = 3082
const SQLITE_IOERR_RDLOCK = 2314
const SQLITE_IOERR_READ = 266
const SQLITE_IOERR_SEEK = 5642
const SQLITE_IOERR_SHMLOCK = 5130
const SQLITE_IOERR_SHMMAP = 5386
const SQLITE_IOERR_SHMOPEN = 4618
const SQLITE_IOERR_SHMSIZE = 4874
const SQLITE_IOERR_TRUNCATE = 1546
const SQLITE_IOERR_UNLOCK = 2058
const SQLITE_IOERR_VNODE = 6922
const SQLITE_IOERR_WRITE = 778
const SQLITE_JUMPIFNULL = 16
const SQLITE_LegacyAlter = 67108864
const SQLITE_LoadExtension = 65536
const SQLITE_LoadExtFunc = 131072
const SQLITE_LOCK_NONE = 0
const SQLITE_LOCKED = 6
const SQLITE_LOCKED_VTAB = 518
const SQLITE_MAGIC_BUSY = 4030429446
const SQLITE_MAGIC_CLOSED = 2671521075
const SQLITE_MAGIC_ERROR = 3040180528
const SQLITE_MAGIC_OPEN = 2687084183
const SQLITE_MAGIC_SICK = 1266094736
const SQLITE_MAGIC_ZOMBIE = 1691352191
const SQLITE_MATCH = 0
const SQLITE_MAX_COLUMN = 2000
const SQLITE_MAX_DB = 12
const SQLITE_MAX_EXPR_DEPTH = 1000
const SQLITE_MAX_LENGTH = 1000000000
const SQLITE_MAX_MMAP_SIZE = 2147418112
const SQLITE_MAX_PAGE_COUNT = 1073741823
const SQLITE_MAX_PAGE_SIZE = 65536
const SQLITE_MAX_PATHLEN = 1024
const SQLITE_MAX_PMASZ = 536870912
const SQLITE_MAX_SQL_LENGTH = 1000000000
const SQLITE_MAX_SRCLIST = 200
const SQLITE_MAX_VDBE_OP = 250000000
const SQLITE_MEMDB_DEFAULT_MAXSIZE = 1073741824
const SQLITE_MinMaxOpt = 65536
const SQLITE_MISMATCH = 20
const SQLITE_MISUSE = 21
const SQLITE_MSVC_H = 0
const SQLITE_N_KEYWORD = 147
const SQLITE_N_LIMIT = 12
const SQLITE_NO_TSAN = 0
const SQLITE_NoCkptOnClose = 2048
const SQLITE_NOLFS = 22
const SQLITE_NOMATCH = 1
const SQLITE_NOMEM = 7
const SQLITE_NoSchemaError = 134217728
const SQLITE_NOTADB = 26
const SQLITE_NOTFOUND = 12
const SQLITE_NOTICE = 27
const SQLITE_NOTNULL = 144
const SQLITE_NTUNE = 6
const SQLITE_NULL = 5
const SQLITE_NullCallback = 256
const SQLITE_NULLEQ = 128
const SQLITE_OK = 0
const SQLITE_OmitNoopJoin = 256
const SQLITE_OPEN_FULLMUTEX = 65536
const SQLITE_OPEN_MAIN_DB = 256
const SQLITE_OPEN_MEMORY = 128
const SQLITE_OPEN_NOFOLLOW = 16777216
const SQLITE_OPEN_NOMUTEX = 32768
const SQLITE_OPEN_PRIVATECACHE = 262144
const SQLITE_OPEN_SHAREDCACHE = 131072
const SQLITE_OPEN_TEMP_DB = 512
const SQLITE_OPEN_URI = 64
const SQLITE_OPEN_WAL = 524288
const SQLITE_OS_UNIX = 1
const SQLITE_OS_WIN = 0
const SQLITE_PAGER_H = 0
const SQLITE_PERM = 3
const SQLITE_PRAGMA = 19
const SQLITE_PRIVATE = 0
const SQLITE_PropagateConst = 32768
const SQLITE_PROTOCOL = 15
const SQLITE_PTRSIZE = 8
const SQLITE_PushDown = 4096
const SQLITE_QueryOnly = 1048576
const SQLITE_RANGE = 25
const SQLITE_READ = 20
const SQLITE_READONLY = 8
const SQLITE_ReadUncommit = 1024
const SQLITE_RecTriggers = 8192
const SQLITE_RECURSIVE = 33
const SQLITE_REINDEX = 27
const SQLITE_REPLACE = 5
const SQLITE_ResetDatabase = 33554432
const SQLITE_ReverseOrder = 4096
const SQLITE_ROLLBACK = 1
const SQLITE_ROW = 100
const SQLITE_SAVEPOINT = 32
const SQLITE_SCHEMA = 17
const SQLITE_SeekScan = 131072
const SQLITE_SELECT = 21
const SQLITE_SHM_LOCK = 2
const SQLITE_SHM_NLOCK = 8
const SQLITE_SimplifyJoin = 8192
const SQLITE_SkipScan = 16384
const SQLITE_SO_ASC = 0
const SQLITE_SO_DESC = 1
const SQLITE_SORTER_PMASZ = 250
const SQLITE_SOUNDEX = 1
const SQLITE_SOURCE_ID = "2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187a...
const SQLITE_Stat4 = 2048
const SQLITE_STDCALL = 0
const SQLITE_STMTJRNL_SPILL = 65536
const SQLITE_SUBTYPE = 1048576
const SQLITE_SYNC_FULL = 3
const SQLITE_SYSAPI = 0
const SQLITE_TCLAPI = 0
const SQLITE_TEMP_FILE_PREFIX = "etilqs_"
const SQLITE_TEXT = 3
const SQLITE_TOOBIG = 18
const SQLITE_TRACE_ROW = 4
const SQLITE_TRANSACTION = 22
const SQLITE_Transitive = 128
const SQLITE_TriggerEQP = 16777216
const SQLITE_TXN_NONE = 0
const SQLITE_TXN_READ = 1
const SQLITE_TXN_WRITE = 2
const SQLITE_UPDATE = 23
const SQLITE_USE_URI = 0
const SQLITE_UTF16 = 4
const SQLITE_UTF16BE = 3
const SQLITE_UTF16LE = 2
const SQLITE_UTF8 = 1
const SQLITE_VDBE_H = 0
const SQLITE_VDBEINT_H = 0
const SQLITE_VERSION = "3.36.0"
const SQLITE_VERSION_NUMBER = 3036000
const SQLITE_WAL_H = 0
const SQLITE_WARNING = 28
const SQLITE_WSD = 0
const SQLITEINT_H = 0
const SRCHFS_MATCHDIRS = 4
const SRCHFS_NEGATEPARAMS = 2147483648
const SRCHFS_START = 1
const SRCHFS_VALIDOPTIONSMASK = 2147483903
const SRT_Coroutine = 13
const SRT_Discard = 4
const SRT_DistFifo = 5
const SRT_DistQueue = 6
const SRT_EphemTab = 12
const SRT_Except = 2
const SRT_Exists = 3
const SRT_Fifo = 8
const SRT_Mem = 10
const SRT_Output = 9
const SRT_Queue = 7
const SRT_Set = 11
const SRT_Table = 14
const SRT_Union = 1
const SRT_Upfrom = 15
const SS_DISABLE = 4
const SS_ONSTACK = 1
const SSIZE_MAX = 9223372036854775807
const STAT_GET_NDLT = 4
const STAT_GET_NEQ = 2
const STAT_GET_NLT = 3
const STAT_GET_ROWID = 1
const STAT_GET_STAT1 = 0
const STDERR_FILENO = 2
const STDIN_FILENO = 0
const STDOUT_FILENO = 1
const SV_INTERRUPT = 2
const SV_NOCLDSTOP = 8
const SV_NODEFER = 16
const SV_ONSTACK = 1
const SV_RESETHAND = 4
const SV_SIGINFO = 64
const SYNC_VOLUME_WAIT = 2
const TABLDISC = 3
const TARGET_CPU_68K = 0
const TARGET_CPU_ALPHA = 0
const TARGET_CPU_ARM = 0
const TARGET_CPU_ARM64 = 0
const TARGET_CPU_MIPS = 0
const TARGET_CPU_PPC = 0
const TARGET_CPU_PPC64 = 0
const TARGET_CPU_SPARC = 0
const TARGET_CPU_X86 = 0
const TARGET_OS_IOS = 0
const TARGET_OS_IPHONE = 0
const TARGET_OS_MAC = 1
const TARGET_OS_NANO = 0
const TARGET_OS_OSX = 1
const TARGET_OS_RTKIT = 0
const TARGET_OS_TV = 0
const TARGET_OS_UNIX = 0
const TARGET_OS_WATCH = 0
const TARGET_OS_WIN32 = 0
const TARGET_RT_64_BIT = 1
const TERM_ANDINFO = 32
const TERM_CODED = 4
const TERM_COPIED = 8
const TERM_DYNAMIC = 1
const TERM_HEURTRUTH = 8192
const TERM_HIGHTRUTH = 16384
const TERM_IS = 2048
const TERM_LIKE = 1024
const TERM_LIKECOND = 512
const TERM_LIKEOPT = 256
const TERM_OR_OK = 64
const TERM_ORINFO = 16
const TERM_VARSELECT = 4096
const TERM_VIRTUAL = 2
const TERM_VNULL = 128
const TF_Autoincrement = 8
const TF_Ephemeral = 16384
const TF_Eponymous = 32768
const TF_HasGenerated = 96
const TF_HasHidden = 2
const TF_HasNotNull = 2048
const TF_HasPrimaryKey = 4
const TF_HasStat1 = 16
const TF_HasStat4 = 8192
const TF_HasStored = 64
const TF_HasVirtual = 32
const TF_NoVisibleRowid = 512
const TF_OOOHidden = 1024
const TF_Readonly = 1
const TF_Shadow = 4096
const TF_StatsUsed = 256
const TF_WithoutRowid = 128
const TIME_UTC = 1
const TIMER_END = 0
const TIMER_START = 0
const TIOCM_CAR = 64
const TIOCM_CD = 64
const TIOCM_CTS = 32
const TIOCM_DSR = 256
const TIOCM_DTR = 2
const TIOCM_LE = 1
const TIOCM_RI = 128
const TIOCM_RNG = 128
const TIOCM_RTS = 4
const TIOCM_SR = 16
const TIOCM_ST = 8
const TIOCPKT_DATA = 0
const TIOCPKT_DOSTOP = 32
const TIOCPKT_IOCTL = 64
const TIOCPKT_NOSTOP = 16
const TIOCPKT_START = 8
const TIOCPKT_STOP = 4
const TK_ABORT = 27
const TK_ACTION = 28
const TK_ADD = 162
const TK_AFTER = 29
const TK_AGG_COLUMN = 168
const TK_AGG_FUNCTION = 167
const TK_ALL = 134
const TK_ALTER = 161
const TK_ALWAYS = 96
const TK_ANALYZE = 30
const TK_AND = 44
const TK_ANY = 101
const TK_AS = 24
const TK_ASC = 31
const TK_ASTERISK = 179
const TK_ATTACH = 32
const TK_AUTOINCR = 125
const TK_BEFORE = 33
const TK_BEGIN = 5
const TK_BETWEEN = 48
const TK_BITAND = 102
const TK_BITNOT = 113
const TK_BITOR = 103
const TK_BLOB = 153
const TK_BY = 34
const TK_CASCADE = 35
const TK_CASE = 156
const TK_CAST = 36
const TK_CHECK = 123
const TK_COLLATE = 112
const TK_COLUMN = 166
const TK_COLUMNKW = 60
const TK_COMMA = 26
const TK_COMMIT = 10
const TK_CONCAT = 111
const TK_CONFLICT = 37
const TK_CONSTRAINT = 118
const TK_CREATE = 17
const TK_CTIME_KW = 100
const TK_CURRENT = 85
const TK_DATABASE = 38
const TK_DEFAULT = 119
const TK_DEFERRABLE = 130
const TK_DEFERRED = 7
const TK_DELETE = 127
const TK_DESC = 39
const TK_DETACH = 40
const TK_DISTINCT = 139
const TK_DO = 61
const TK_DOT = 140
const TK_DROP = 132
const TK_EACH = 41
const TK_ELSE = 159
const TK_END = 11
const TK_EQ = 53
const TK_ERROR = 181
const TK_ESCAPE = 58
const TK_EXCEPT = 135
const TK_EXCLUDE = 91
const TK_EXCLUSIVE = 9
const TK_EXISTS = 20
const TK_EXPLAIN = 2
const TK_FAIL = 42
const TK_FILTER = 165
const TK_FIRST = 83
const TK_FLOAT = 152
const TK_FOLLOWING = 86
const TK_FOR = 62
const TK_FOREIGN = 131
const TK_FROM = 141
const TK_FUNCTION = 171
const TK_GE = 57
const TK_GENERATED = 95
const TK_GROUP = 145
const TK_GROUPS = 92
const TK_GT = 54
const TK_HAVING = 146
const TK_ID = 59
const TK_IF = 18
const TK_IF_NULL_ROW = 178
const TK_IGNORE = 63
const TK_ILLEGAL = 183
const TK_IMMEDIATE = 8
const TK_IN = 49
const TK_INDEX = 160
const TK_INDEXED = 115
const TK_INITIALLY = 64
const TK_INSERT = 126
const TK_INSTEAD = 65
const TK_INTEGER = 154
const TK_INTERSECT = 136
const TK_INTO = 150
const TK_IS = 45
const TK_ISNOT = 170
const TK_ISNULL = 50
const TK_JOIN = 142
const TK_JOIN_KW = 117
const TK_KEY = 67
const TK_LAST = 84
const TK_LE = 55
const TK_LIKE_KW = 47
const TK_LIMIT = 147
const TK_LP = 22
const TK_LSHIFT = 104
const TK_LT = 56
const TK_MATCH = 46
const TK_MATERIALIZED = 97
const TK_MINUS = 107
const TK_NE = 52
const TK_NO = 66
const TK_NOT = 19
const TK_NOTHING = 151
const TK_NOTNULL = 51
const TK_NULL = 120
const TK_NULLS = 82
const TK_OF = 68
const TK_OFFSET = 69
const TK_ON = 114
const TK_OR = 43
const TK_ORDER = 144
const TK_OTHERS = 93
const TK_OVER = 164
const TK_PARTITION = 87
const TK_PLAN = 4
const TK_PLUS = 106
const TK_PRAGMA = 70
const TK_PRECEDING = 88
const TK_PRIMARY = 121
const TK_QUERY = 3
const TK_RAISE = 71
const TK_RANGE = 89
const TK_RECURSIVE = 72
const TK_REFERENCES = 124
const TK_REGISTER = 175
const TK_REINDEX = 98
const TK_RELEASE = 14
const TK_REM = 110
const TK_RENAME = 99
const TK_REPLACE = 73
const TK_RESTRICT = 74
const TK_RETURNING = 149
const TK_ROLLBACK = 12
const TK_ROW = 75
const TK_ROWS = 76
const TK_RP = 23
const TK_RSHIFT = 105
const TK_SAVEPOINT = 13
const TK_SELECT = 137
const TK_SELECT_COLUMN = 177
const TK_SEMI = 1
const TK_SET = 129
const TK_SLASH = 109
const TK_SPACE = 182
const TK_SPAN = 180
const TK_STAR = 108
const TK_STRING = 116
const TK_TABLE = 16
const TK_TEMP = 21
const TK_THEN = 158
const TK_TIES = 94
const TK_TO = 15
const TK_TRANSACTION = 6
const TK_TRIGGER = 77
const TK_TRUEFALSE = 169
const TK_TRUTH = 174
const TK_UMINUS = 172
const TK_UNBOUNDED = 90
const TK_UNION = 133
const TK_UNIQUE = 122
const TK_UPDATE = 128
const TK_UPLUS = 173
const TK_USING = 143
const TK_VACUUM = 78
const TK_VALUES = 138
const TK_VARIABLE = 155
const TK_VECTOR = 176
const TK_VIEW = 79
const TK_VIRTUAL = 80
const TK_WHEN = 157
const TK_WHERE = 148
const TK_WINDOW = 163
const TK_WITH = 81
const TK_WITHOUT = 25
const TkCREATE = 4
const TkEND = 7
const TkEXPLAIN = 3
const TkOTHER = 2
const TkSEMI = 0
const TkTEMP = 5
const TkTRIGGER = 6
const TkWS = 1
const TLOSS = 5
const TMP_MAX = 308915776
const TRACEBUF = 0
const TRANS_NONE = 0
const TRANS_READ = 1
const TRANS_WRITE = 2
const TRAP_BRKPT = 1
const TRAP_TRACE = 2
const TRIGGER_AFTER = 2
const TRIGGER_BEFORE = 1
const TRUE = 1
const True = 1
const TTYDISC = 0
const UCHAR_MAX = 255
const UF_APPEND = 4
const UF_COMPRESSED = 32
const UF_DATAVAULT = 128
const UF_HIDDEN = 32768
const UF_IMMUTABLE = 2
const UF_NODUMP = 1
const UF_OPAQUE = 8
const UF_SETTABLE = 65535
const UF_TRACKED = 64
const UID_MAX = 2147483647
const UINT16_MAX = 65535
const UINT32_MAX = 4294967295
const UINT64_MAX = 18446744073709551615
const UINT8_MAX = 255
const UINT_FAST16_MAX = 65535
const UINT_FAST32_MAX = 4294967295
const UINT_FAST64_MAX = 18446744073709551615
const UINT_FAST8_MAX = 255
const UINT_LEAST16_MAX = 65535
const UINT_LEAST32_MAX = 4294967295
const UINT_LEAST64_MAX = 18446744073709551615
const UINT_LEAST8_MAX = 255
const UINT_MAX = 4294967295
const UINTMAX_MAX = 18446744073709551615
const UINTPTR_MAX = 18446744073709551615
const ULLONG_MAX = 18446744073709551615
const ULONG_LONG_MAX = 18446744073709551615
const ULONG_MAX = 18446744073709551615
const UNDERFLOW = 4
const UNIX_SHM_BASE = 120
const UNIX_SHM_DMS = 128
const UNIXFILE_DELETE = 32
const UNIXFILE_DIRSYNC = 8
const UNIXFILE_EXCL = 1
const UNIXFILE_NOLOCK = 128
const UNIXFILE_PSOW = 16
const UNIXFILE_RDONLY = 2
const UNIXFILE_URI = 64
const UNKNOWN_LOCK = 5
const UQUAD_MAX = 18446744073709551615
const USE_PREAD = 1
const USHRT_MAX = 65535
const UTIME_NOW = -1
const UTIME_OMIT = -2
const VDBE_DISPLAY_P4 = 1
const VDBE_MAGIC_DEAD = 1443283912
const VDBE_MAGIC_HALT = 832317811
const VDBE_MAGIC_INIT = 381479589
const VDBE_MAGIC_RESET = 1224384374
const VDBE_MAGIC_RUN = 770837923
const VFS_CONF = 2
const VFS_CTL_DISC = 65544
const VFS_CTL_NEWADDR = 65540
const VFS_CTL_NOLOCKS = 65542
const VFS_CTL_NSTATUS = 65546
const VFS_CTL_QUERY = 65539
const VFS_CTL_SADDR = 65543
const VFS_CTL_SERVERINFO = 65545
const VFS_CTL_STATFS = 65537
const VFS_CTL_TIMEO = 65541
const VFS_CTL_UMOUNT = 65538
const VFS_CTL_VERS1 = 1
const VFS_GENERIC = 0
const VFS_MAXTYPENUM = 1
const VFS_NUMMNTOPS = 1
const VOL_CAP_FMT_DOCUMENT_ID = 524288
const VOL_CAP_FMT_SHARED_SPACE = 8388608
const VOL_CAP_FMT_VOL_GROUPS = 16777216
const VOL_CAP_INT_ADVLOCK = 256
const VOL_CAP_INT_CLONE = 65536
const VOL_CAP_INT_FLOCK = 512
const VOL_CAP_INT_MANLOCK = 4096
const VOL_CAP_INT_RENAME_EXCL = 524288
const VOL_CAP_INT_RENAME_SWAP = 262144
const VOL_CAP_INT_SNAPSHOT = 131072
const VQ_ASSIST = 64
const VQ_DEAD = 32
const VQ_DESIRED_DISK = 16384
const VQ_FLAG10000 = 65536
const VQ_FREE_SPACE_CHANGE = 32768
const VQ_LOWDISK = 4
const VQ_MOUNT = 8
const VQ_NEARLOWDISK = 8192
const VQ_NEEDAUTH = 2
const VQ_NOTRESP = 1
const VQ_NOTRESPLOCK = 128
const VQ_QUOTA = 4096
const VQ_SERVEREVENT = 2048
const VQ_SYNCEVENT = 1024
const VQ_UNMOUNT = 16
const VQ_UPDATE = 256
const VQ_VERYLOWDISK = 512
const W_OK = 2
const WAIT_ANY = -1
const WAIT_MYPGRP = 0
const WAKEMON_DISABLE = 2
const WAKEMON_ENABLE = 1
const WAKEMON_MAKE_FATAL = 16
const WAL_CKPT_LOCK = 1
const WAL_FRAME_HDRSIZE = 24
const WAL_HDRSIZE = 32
const WAL_LOCK_CKPT = 1
const WAL_LOCK_READ0 = 3
const WAL_LOCK_WRITE = 0
const WAL_MAGIC = 931071618
const WAL_MAX_VERSION = 3007000
const WAL_NORMAL_MODE = 0
const WAL_NREADER = 5
const WAL_RDONLY = 1
const WAL_RDWR = 0
const WAL_RECOVER_LOCK = 2
const WAL_RETRY = -1
const WAL_SHM_RDONLY = 2
const WAL_WRITE_LOCK = 0
const WALINDEX_MAX_VERSION = 3007000
const WCHAR_MAX = 2147483647
const WCHAR_MIN = -2147483648
const WCONTINUED = 16
const WCOREFLAG = 128
const WEXITED = 4
const WHERE_AGG_DISTINCT = 1024
const WHERE_AUTO_INDEX = 16384
const WHERE_BIGNULL_SORT = 524288
const WHERE_BOTH_LIMIT = 48
const WHERE_BTM_LIMIT = 32
const WHERE_COLUMN_EQ = 1
const WHERE_COLUMN_IN = 4
const WHERE_CONSTRAINT = 15
const WHERE_DISTINCTBY = 128
const WHERE_GROUPBY = 64
const WHERE_IDX_ONLY = 64
const WHERE_IN_ABLE = 2048
const WHERE_IN_EARLYOUT = 262144
const WHERE_IN_SEEKSCAN = 1048576
const WHERE_INDEXED = 512
const WHERE_IPK = 256
const WHERE_MULTI_OR = 8192
const WHERE_ONEROW = 4096
const WHERE_OR_SUBCLAUSE = 32
const WHERE_ORDERBY_LIMIT = 2048
const WHERE_PARTIALIDX = 131072
const WHERE_SKIPSCAN = 32768
const WHERE_SORTBYGROUP = 512
const WHERE_TOP_LIMIT = 16
const WHERE_TRANSCONS = 2097152
const WHERE_UNQ_WANTED = 65536
const WHERE_USE_LIMIT = 16384
const WHERE_VIRTUALTABLE = 1024
const WHERE_WANT_DISTINCT = 256
const WINDOW_AGGSTEP = 3
const WINT_MAX = 2147483647
const WINT_MIN = -2147483648
const WNOHANG = 1
const WNOWAIT = 32
const WO_ALL = 8191
const WO_AND = 1024
const WO_AUX = 64
const WO_EQ = 2
const WO_EQUIV = 2048
const WO_GE = 32
const WO_GT = 4
const WO_IN = 1
const WO_IS = 128
const WO_ISNULL = 256
const WO_LE = 8
const WO_LT = 16
const WO_NOOP = 4096
const WO_OR = 512
const WO_SINGLE = 511
const WORD_BIT = 32
const WRC_Abort = 2
const WRC_Continue = 0
const WRC_Prune = 1
const WRITE_LOCK = 2
const WsdAutoextInit = 0
const WsdHooksInit = 0
const WsdStatInit = 0
const WSTOPPED = 8
const WUNTRACED = 2
const X_ACCESS_EXTENDED_MASK = 4193792
const X_ALLOCA_H_ = 0
const X_ANSI_STDARG_H_ = 0
const X_ANSI_STDDEF_H = 0
const X_APPEND_OK = 8192
const X_ASSERT_H_ = 0
const X_BLKCNT_T = 0
const X_BLKSIZE_T = 0
const X_BSD_PTRDIFF_T_ = 0
const X_BSM_AUDIT_H = 0
const X_CADDR_T = 0
const X_CDEFS_H_ = 0
const X_CHOWN_OK = 2097152
const X_CLOCK_REALTIME = 0
const X_CLOCK_T = 0
const X_CS_DARWIN_USER_DIR = 65536
const X_CS_PATH = 1
const X_CT_RUNE_T = 0
const X_CTERMID_H_ = 0
const X_DELETE_OK = 4096
const X_DEV_T = 0
const X_DLFCN_H_ = 0
const X_ERRNO_T = 0
const X_EXECUTE_OK = 2048
const X_FD_SET = 0
const X_FILE_OFFSET_BITS = 64
const X_FILESEC_T = 0
const X_FORTIFY_SOURCE = 2
const X_FSBLKCNT_T = 0
const X_FSFILCNT_T = 0
const X_FSID_T = 0
const X_FSOBJ_ID_T = 0
const X_FSTDIO = 0
const X_FTS5_H = 0
const X_FTS5INT_H = 0
const X_FTSINT_H = 0
const X_GCC_LIMITS_H_ = 0
const X_GCC_PTRDIFF_T = 0
const X_GID_T = 0
const X_GNU_SOURCE = 0
const X_I386__PARAM_H_ = 0
const X_I386_LIMITS_H_ = 0
const X_I386_PARAM_H_ = 0
const X_I386_SIGNAL_H_ = 1
const X_ID_T = 0
const X_IN_ADDR_T = 0
const X_IN_PORT_T = 0
const X_INO64_T = 0
const X_INO_T = 0
const X_INT16_T = 0
const X_INT32_T = 0
const X_INT64_T = 0
const X_INT8_T = 0
const X_INTMAX_T = 0
const X_INTPTR_T = 0
const X_IOFBF = 0
const X_IOLBF = 1
const X_IONBF = 2
const X_KAUTH_CRED_T = 0
const X_KEY_T = 0
const X_LARGE_FILE = 1
const X_LIMITS_H_ = 0
const X_LIMITS_H___ = 0
const X_LP64 = 1
const X_MACH_PORT_H_ = 0
const X_MACH_PORT_T = 0
const X_MACHTYPES_H_ = 0
const X_MCONTEXT_T = 0
const X_MMAP = 0
const X_MODE_T = 0
const X_Nonnull = 0
const X_Nullable = 0
const X_OFF_T = 0
const X_OK = 1
const X_OS_COMMON_H_ = 0
const X_PC_ASYNC_IO = 17
const X_PC_FILESIZEBITS = 18
const X_PC_MAX_CANON = 2
const X_PC_MAX_INPUT = 3
const X_PC_MIN_HOLE_SIZE = 27
const X_PC_NAME_MAX = 4
const X_PC_NO_TRUNC = 8
const X_PC_PATH_MAX = 5
const X_PC_PIPE_BUF = 6
const X_PC_PRIO_IO = 19
const X_PC_SYNC_IO = 25
const X_PC_VDISABLE = 9
const X_PID_T = 0
const X_POSIX2_BC_DIM_MAX = 2048
const X_POSIX2_C_BIND = 200112
const X_POSIX2_C_DEV = 200112
const X_POSIX2_CHAR_TERM = 200112
const X_POSIX2_FORT_DEV = -1
const X_POSIX2_FORT_RUN = 200112
const X_POSIX2_LINE_MAX = 2048
const X_POSIX2_LOCALEDEF = 200112
const X_POSIX2_PBS = -1
const X_POSIX2_PBS_TRACK = -1
const X_POSIX2_RE_DUP_MAX = 255
const X_POSIX2_SW_DEV = 200112
const X_POSIX2_UPE = 200112
const X_POSIX2_VERSION = 200112
const X_POSIX_AIO_MAX = 1
const X_POSIX_ARG_MAX = 4096
const X_POSIX_BARRIERS = -1
const X_POSIX_CHILD_MAX = 25
const X_POSIX_CHOWN_RESTRICTED = 200112
const X_POSIX_CLOCKRES_MIN = 20000000
const X_POSIX_CPUTIME = -1
const X_POSIX_FSYNC = 200112
const X_POSIX_IPV6 = 200112
const X_POSIX_JOB_CONTROL = 200112
const X_POSIX_MAPPED_FILES = 200112
const X_POSIX_MAX_CANON = 255
const X_POSIX_MAX_INPUT = 255
const X_POSIX_MEMLOCK = -1
const X_POSIX_NAME_MAX = 14
const X_POSIX_NO_TRUNC = 200112
const X_POSIX_OPEN_MAX = 20
const X_POSIX_PATH_MAX = 256
const X_POSIX_PIPE_BUF = 512
const X_POSIX_RE_DUP_MAX = 255
const X_POSIX_REGEXP = 200112
const X_POSIX_SAVED_IDS = 200112
const X_POSIX_SEM_VALUE_MAX = 32767
const X_POSIX_SEMAPHORES = -1
const X_POSIX_SHELL = 200112
const X_POSIX_SPAWN = -1
const X_POSIX_SPIN_LOCKS = -1
const X_POSIX_SSIZE_MAX = 32767
const X_POSIX_THREADS = 200112
const X_POSIX_TIMEOUTS = -1
const X_POSIX_TIMER_MAX = 32
const X_POSIX_TIMERS = -1
const X_POSIX_TRACE = -1
const X_POSIX_TRACE_LOG = -1
const X_POSIX_VERSION = 200112
const X_PTHREAD_ATTR_T = 0
const X_PTHREAD_COND_T = 0
const X_PTHREAD_KEY_T = 0
const X_PTHREAD_ONCE_T = 0
const X_PTHREAD_T = 0
const X_PTRDIFF_T = 0
const X_PTRDIFF_T_ = 0
const X_QUAD_HIGHWORD = 1
const X_QUAD_LOWWORD = 0
const X_RATTR_OK = 32768
const X_READ_OK = 512
const X_REXT_OK = 131072
const X_RLIMIT_POSIX_FLAG = 4096
const X_RMFILE_OK = 16384
const X_RPERM_OK = 524288
const X_RSIZE_T = 0
const X_RUNE_T = 0
const X_SC_2_C_BIND = 18
const X_SC_2_C_DEV = 19
const X_SC_2_CHAR_TERM = 20
const X_SC_2_FORT_DEV = 21
const X_SC_2_FORT_RUN = 22
const X_SC_2_LOCALEDEF = 23
const X_SC_2_PBS = 59
const X_SC_2_PBS_LOCATE = 62
const X_SC_2_PBS_MESSAGE = 63
const X_SC_2_PBS_TRACK = 64
const X_SC_2_SW_DEV = 24
const X_SC_2_UPE = 25
const X_SC_2_VERSION = 17
const X_SC_ADVISORY_INFO = 65
const X_SC_AIO_MAX = 43
const X_SC_ARG_MAX = 1
const X_SC_ATEXIT_MAX = 107
const X_SC_BARRIERS = 66
const X_SC_BC_BASE_MAX = 9
const X_SC_BC_DIM_MAX = 10
const X_SC_BC_SCALE_MAX = 11
const X_SC_BC_STRING_MAX = 12
const X_SC_CHILD_MAX = 2
const X_SC_CLK_TCK = 3
const X_SC_CPUTIME = 68
const X_SC_EXPR_NEST_MAX = 14
const X_SC_FILE_LOCKING = 69
const X_SC_FSYNC = 38
const X_SC_HOST_NAME_MAX = 72
const X_SC_IOV_MAX = 56
const X_SC_IPV6 = 118
const X_SC_JOB_CONTROL = 6
const X_SC_LINE_MAX = 15
const X_SC_MAPPED_FILES = 47
const X_SC_MEMLOCK = 30
const X_SC_MEMLOCK_RANGE = 31
const X_SC_MQ_OPEN_MAX = 46
const X_SC_MQ_PRIO_MAX = 75
const X_SC_NGROUPS_MAX = 4
const X_SC_OPEN_MAX = 5
const X_SC_PAGE_SIZE = 29
const X_SC_PAGESIZE = 29
const X_SC_PASS_MAX = 131
const X_SC_PHYS_PAGES = 200
const X_SC_RAW_SOCKETS = 119
const X_SC_RE_DUP_MAX = 16
const X_SC_REGEXP = 77
const X_SC_RTSIG_MAX = 48
const X_SC_SAVED_IDS = 7
const X_SC_SEM_NSEMS_MAX = 49
const X_SC_SEM_VALUE_MAX = 50
const X_SC_SEMAPHORES = 37
const X_SC_SHELL = 78
const X_SC_SIGQUEUE_MAX = 51
const X_SC_SPAWN = 79
const X_SC_SPIN_LOCKS = 80
const X_SC_SS_REPL_MAX = 126
const X_SC_STREAM_MAX = 26
const X_SC_SYMLOOP_MAX = 120
const X_SC_THREADS = 96
const X_SC_TIMEOUTS = 95
const X_SC_TIMER_MAX = 52
const X_SC_TIMERS = 41
const X_SC_TRACE = 97
const X_SC_TRACE_INHERIT = 99
const X_SC_TRACE_LOG = 100
const X_SC_TRACE_NAME_MAX = 128
const X_SC_TRACE_SYS_MAX = 129
const X_SC_TTY_NAME_MAX = 101
const X_SC_TZNAME_MAX = 27
const X_SC_V6_ILP32_OFF32 = 103
const X_SC_V6_LP64_OFF64 = 105
const X_SC_VERSION = 8
const X_SC_XOPEN_CRYPT = 108
const X_SC_XOPEN_ENH_I18N = 109
const X_SC_XOPEN_LEGACY = 110
const X_SC_XOPEN_REALTIME = 111
const X_SC_XOPEN_SHM = 113
const X_SC_XOPEN_STREAMS = 114
const X_SC_XOPEN_UNIX = 115
const X_SC_XOPEN_VERSION = 116
const X_SIGSET_T = 0
const X_SIZE_T = 0
const X_SQLITE3RBU_H = 0
const X_SQLITE_OS_H_ = 0
const X_SSIZE_T = 0
const X_STDARG_H = 0
const X_STDBOOL_H = 0
const X_STDDEF_H = 0
const X_STDDEF_H_ = 0
const X_STDINT_H_ = 0
const X_STDIO_H_ = 0
const X_STDLIB_H_ = 0
const X_STRING_H_ = 0
const X_STRINGS_H_ = 0
const X_SUSECONDS_T = 0
const X_SYS__ENDIAN_H_ = 0
const X_SYS__SELECT_H_ = 0
const X_SYS__TYPES_H_ = 0
const X_SYS_ATTR_H_ = 0
const X_SYS_ERRNO_H_ = 0
const X_SYS_FCNTL_H_ = 0
const X_SYS_FILE_H_ = 0
const X_SYS_FILIO_H_ = 0
const X_SYS_IOCCOM_H_ = 0
const X_SYS_IOCTL_H_ = 0
const X_SYS_MMAN_H_ = 0
const X_SYS_MOUNT_H_ = 0
const X_SYS_PARAM_H_ = 0
const X_SYS_QUEUE_H_ = 0
const X_SYS_SELECT_H_ = 0
const X_SYS_SIGNAL_H_ = 0
const X_SYS_SOCKIO_H_ = 0
const X_SYS_STAT_H_ = 0
const X_SYS_STDIO_H_ = 0
const X_SYS_TIME_H_ = 0
const X_SYS_TTYCOM_H_ = 0
const X_SYS_TYPES_H_ = 0
const X_SYS_UCRED_H_ = 0
const X_SYS_UNISTD_H_ = 0
const X_SYS_WAIT_H_ = 0
const X_T_PTRDIFF = 0
const X_T_PTRDIFF_ = 0
const X_TIME_H_ = 0
const X_TIME_T = 0
const X_TLOSS = 1.41485e+16
const X_U_CHAR = 0
const X_U_INT = 0
const X_U_INT16_T = 0
const X_U_INT32_T = 0
const X_U_INT64_T = 0
const X_U_INT8_T = 0
const X_U_LONG = 0
const X_U_SHORT = 0
const X_UID_T = 0
const X_UINT16_T = 0
const X_UINT32_T = 0
const X_UINT64_T = 0
const X_UINT8_T = 0
const X_UINTMAX_T = 0
const X_UINTPTR_T = 0
const X_UNISTD_H_ = 0
const X_USECONDS_T = 0
const X_UUID_T = 0
const X_V6_ILP32_OFF32 = -1
const X_V6_ILP32_OFFBIG = -1
const X_V6_LP64_OFF64 = 1
const X_VA_LIST = 0
const X_VA_LIST_ = 0
const X_VA_LIST_T = 0
const X_VA_LIST_T_H = 0
const X_WATTR_OK = 65536
const X_WCHAR_T = 0
const X_WEXT_OK = 262144
const X_WPERM_OK = 1048576
const X_WRITE_OK = 1024
const X_WSTOPPED = 127
const X_XBS5_ILP32_OFF32 = -1
const X_XOPEN_CRYPT = 1
const X_XOPEN_ENH_I18N = 1
const X_XOPEN_IOV_MAX = 16
const X_XOPEN_LEGACY = -1
const X_XOPEN_NAME_MAX = 255
const X_XOPEN_PATH_MAX = 1024
const X_XOPEN_REALTIME = -1
const X_XOPEN_SHM = 1
const X_XOPEN_STREAMS = -1
const X_XOPEN_UNIX = 1
const X_XOPEN_VERSION = 600
const XN_EXPR = -2
const XN_ROWID = -1
const XUCRED_VERSION = 0
const YY_ACCEPT_ACTION = 1224
const YY_ACTTAB_COUNT = 2023
const YY_ERROR_ACTION = 1223
const YY_MAX_REDUCE = 1623
const YY_MAX_SHIFT = 569
const YY_MAX_SHIFTREDUCE = 1222
const YY_MIN_REDUCE = 1226
const YY_MIN_SHIFTREDUCE = 825
const YY_NO_ACTION = 1225
const YY_REDUCE_COUNT = 405
const YY_REDUCE_MAX = 1683
const YY_REDUCE_MIN = -266
const YY_SHIFT_COUNT = 569
const YY_SHIFT_MAX = 2009
const YY_SHIFT_MIN = 0
const YYFALLBACK = 1
const YYNOCODE = 317
const YYNRULE = 398
const YYNRULE_WITH_ACTION = 337
const YYNSTATE = 570
const YYNTOKEN = 184
const YYSTACKDEPTH = 100
const YYWILDCARD = 101