// Code generated by modernc.org/undup from the per-target sqlite_*.go files; DO NOT EDIT.

//go:build (darwin && amd64) || (darwin && arm64) || (freebsd && 386) || (freebsd && amd64) || (freebsd && arm64) || (linux && 386) || (linux && amd64) || (linux && arm64) || (linux && loong64) || (linux && ppc64le) || (linux && riscv64) || (linux && s390x) || (netbsd && amd64) || (openbsd && amd64) || (openbsd && arm64) || (windows && (amd64 || arm64))

package sqlite3

type TBtCursor = struct {
	FeState        Tu8
	FcurFlags      Tu8
	FcurPagerFlags Tu8
	Fhints         Tu8
	FskipNext      int32
	FpBtree        uintptr
	FaOverflow     uintptr
	FpKey          uintptr
	FpBt           uintptr
	FpNext         uintptr
	Finfo          TCellInfo
	FnKey          Ti64
	FpgnoRoot      TPgno
	FiPage         Ti8
	FcurIntKey     Tu8
	Fix            Tu16
	FaiIdx         [19]Tu16
	FpKeyInfo      uintptr
	FpPage         uintptr
	FapPage        [19]uintptr
}

type TBtreePayload = struct {
	FpKey  uintptr
	FnKey  Tsqlite3_int64
	FpData uintptr
	FaMem  uintptr
	FnMem  Tu16
	FnData int32
	FnZero int32
}

/*
** Context object type used by rank(), dense_rank(), percent_rank() and
** cume_dist().
 */
type TCallCount = struct {
	FnValue Ti64
	FnStep  Ti64
	FnTotal Ti64
}

type TCellInfo = struct {
	FnKey     Ti64
	FpPayload uintptr
	FnPayload Tu32
	FnLocal   Tu16
	FnSize    Tu16
}

// C documentation
//
//	/*
//	** The following structure keeps track of state information for the
//	** count() aggregate function.
//	*/
type TCountCtx = struct {
	Fn Ti64
}

// C documentation
//
//	/*
//	** Handle type for pages.
//	*/
type TDbPage = struct {
	FpPage      uintptr
	FpData      uintptr
	FpExtra     uintptr
	FpCache     uintptr
	FpDirty     uintptr
	FpPager     uintptr
	Fpgno       TPgno
	Fflags      Tu16
	FnRef       Ti64
	FpDirtyNext uintptr
	FpDirtyPrev uintptr
}

type TFilePoint = struct {
	FiOffset Tsqlite3_int64
	FpChunk  uintptr
}

// C documentation
//
//	/*
//	** The first time the bm25() function is called for a query, an instance
//	** of the following structure is allocated and populated.
//	*/
type TFts5Bm25Data = struct {
	FnPhrase int32
	Favgdl   float64
	FaIDF    uintptr
	FaFreq   uintptr
}

type TFts5Cursor = struct {
	Fbase         Tsqlite3_vtab_cursor
	FpNext        uintptr
	FaColumnSize  uintptr
	FiCsrId       Ti64
	FePlan        int32
	FbDesc        int32
	FiFirstRowid  Ti64
	FiLastRowid   Ti64
	FpStmt        uintptr
	FpExpr        uintptr
	FpSorter      uintptr
	Fcsrflags     int32
	FiSpecial     Ti64
	FzRank        uintptr
	FzRankArgs    uintptr
	FpRank        uintptr
	FnRankArg     int32
	FapRankArg    uintptr
	FpRankArgStmt uintptr
	FpAux         uintptr
	FpAuxdata     uintptr
	FaInstIter    uintptr
	FnInstAlloc   int32
	FnInstCount   int32
	FaInst        uintptr
}

type TFts5DlidxLvl = struct {
	FpData     uintptr
	FiOff      int32
	FbEof      int32
	FiFirstOff int32
	FiLeafPgno int32
	FiRowid    Ti64
}

type TFts5DlidxWriter = struct {
	Fpgno       int32
	FbPrevValid int32
	FiPrev      Ti64
	Fbuf        TFts5Buffer
}

type TFts5DoclistIter = struct {
	FaEof     uintptr
	FiRowid   Ti64
	FaPoslist uintptr
	FnPoslist int32
	FnSize    int32
}

type TFts5ExprCtx = struct {
	FpExpr      uintptr
	FaPopulator uintptr
	FiOff       Ti64
}

type TFts5ExprNode = struct {
	FeType    int32
	FbEof     int32
	FbNomatch int32
	FiHeight  int32
	FxNext    uintptr
	FiRowid   Ti64
	FpNear    uintptr
	FnChild   int32
}

type TFts5FlushCtx = struct {
	FpIdx   uintptr
	Fwriter TFts5SegWriter
}

type TFts5Global = struct {
	Fapi        Tfts5_api
	Fdb         uintptr
	FiNextId    Ti64
	FpAux       uintptr
	FpTok       uintptr
	FpDfltTok   uintptr
	FpCsr       uintptr
	FaLocaleHdr [4]Tu32
}

type TFts5HashEntry = struct {
	FpHashNext  uintptr
	FpScanNext  uintptr
	FnAlloc     int32
	FiSzPoslist int32
	FnData      int32
	FnKey       int32
	FbDel       Tu8
	FbContent   Tu8
	FiCol       Ti16
	FiPos       int32
	FiRowid     Ti64
}

type TFts5Index = struct {
	FpConfig            uintptr
	FzDataTbl           uintptr
	FnWorkUnit          int32
	FpHash              uintptr
	FnPendingData       int32
	FiWriteRowid        Ti64
	FbDelete            int32
	FnContentlessDelete int32
	FnPendingRow        int32
	Frc                 int32
	FflushRc            int32
	FpReader            uintptr
	FpWriter            uintptr
	FpDeleter           uintptr
	FpIdxWriter         uintptr
	FpIdxDeleter        uintptr
	FpIdxSelect         uintptr
	FpIdxNextSelect     uintptr
	FnRead              int32
	FpDeleteFromIdx     uintptr
	FpDataVersion       uintptr
	FiStructVersion     Ti64
	FpStruct            uintptr
}

type TFts5IndexIter = struct {
	FiRowid Ti64
	FpData  uintptr
	FnData  int32
	FbEof   Tu8
}

// C documentation
//
//	/*
//	** Context object used by sqlite3Fts5StorageIntegrity().
//	*/
type TFts5IntegrityCtx = struct {
	FiRowid   Ti64
	FiCol     int32
	FszCol    int32
	Fcksum    Tu64
	FpTermset uintptr
	FpConfig  uintptr
}

type TFts5Iter = struct {
	Fbase           TFts5IndexIter
	FpTokenDataIter uintptr
	FpIndex         uintptr
	Fposlist        TFts5Buffer
	FpColset        uintptr
	FxSetOutputs    uintptr
	FnSeg           int32
	FbRev           int32
	FbSkipEmpty     Tu8
	FiSwitchRowid   Ti64
	FaFirst         uintptr
}

type TFts5LookaheadReader = struct {
	Fa          uintptr
	Fn          int32
	Fi          int32
	FiPos       Ti64
	FiLookahead Ti64
}

type TFts5NearTrimmer = struct {
	Freader TFts5LookaheadReader
	Fwriter TFts5PoslistWriter
	FpOut   uintptr
}

type TFts5PoslistPopulator = struct {
	Fwriter TFts5PoslistWriter
	FbOk    int32
	FbMiss  int32
}

type TFts5PoslistReader = struct {
	Fa     uintptr
	Fn     int32
	Fi     int32
	FbFlag Tu8
	FbEof  Tu8
	FiPos  Ti64
}

type TFts5PoslistWriter = struct {
	FiPrev Ti64
}

type TFts5SegIter = struct {
	FpSeg            uintptr
	Fflags           int32
	FiLeafPgno       int32
	FpLeaf           uintptr
	FpNextLeaf       uintptr
	FiLeafOffset     Ti64
	FpTombArray      uintptr
	FxNext           uintptr
	FiTermLeafPgno   int32
	FiTermLeafOffset int32
	FiPgidxOff       int32
	FiEndofDoclist   int32
	FiRowidOffset    int32
	FnRowidOffset    int32
	FaRowidOffset    uintptr
	FpDlidx          uintptr
	Fterm            TFts5Buffer
	FiRowid          Ti64
	FnPos            int32
	FbDel            Tu8
}

type TFts5SegWriter = struct {
	FiSegid               int32
	Fwriter               TFts5PageWriter
	FiPrevRowid           Ti64
	FbFirstRowidInDoclist Tu8
	FbFirstRowidInPage    Tu8
	FbFirstTermInPage     Tu8
	FnLeafWritten         int32
	FnEmpty               int32
	FnDlidx               int32
	FaDlidx               uintptr
	Fbtterm               TFts5Buffer
	FiBtPage              int32
}

type TFts5Sorter = struct {
	FpStmt    uintptr
	FiRowid   Ti64
	FaPoslist uintptr
	FnIdx     int32
}

type TFts5Storage = struct {
	FpConfig      uintptr
	FpIndex       uintptr
	FbTotalsValid int32
	FnTotalRow    Ti64
	FaTotalSize   uintptr
	FpSavedRow    uintptr
	FaStmt        [12]uintptr
}

type TFts5Structure = struct {
	FnRef          int32
	FnWriteCounter Tu64
	FnOriginCntr   Tu64
	FnSegment      int32
	FnLevel        int32
}

type TFts5StructureSegment = struct {
	FiSegid          int32
	FpgnoFirst       int32
	FpgnoLast        int32
	FiOrigin1        Tu64
	FiOrigin2        Tu64
	FnPgTombstone    int32
	FnEntryTombstone Tu64
	FnEntry          Tu64
}

type TFts5TokenDataIter = struct {
	FnMapAlloc      Ti64
	FnMap           Ti64
	FaMap           uintptr
	Fterms          TFts5Buffer
	FnIter          Ti64
	FnIterAlloc     Ti64
	FaPoslistReader uintptr
	FaPoslistToIter uintptr
}

type TFts5TokenDataMap = struct {
	FiRowid Ti64
	FiPos   Ti64
	FiIter  int32
	FnByte  int32
}

type TFts5VocabCursor = struct {
	Fbase     Tsqlite3_vtab_cursor
	FpStmt    uintptr
	FpFts5    uintptr
	FbEof     int32
	FpIter    uintptr
	FpStruct  uintptr
	FnLeTerm  int32
	FzLeTerm  uintptr
	FcolUsed  int32
	FiCol     int32
	FaCnt     uintptr
	FaDoc     uintptr
	Frowid    Ti64
	Fterm     TFts5Buffer
	FiInstPos Ti64
	FiInstOff int32
}

// C documentation
//
//	/* Objects used by the overlap algorithm. */
type TGeoEvent = struct {
	Fx     float64
	FeType int32
	FpSeg  uintptr
	FpNext uintptr
}

type TGeoSegment = struct {
	FC     float64
	FB     float64
	Fy     float64
	Fy0    float32
	Fside  uint8
	Fidx   uint32
	FpNext uintptr
}

/* In-memory list of records */
type TIncrMerger = struct {
	FpTask      uintptr
	FpMerger    uintptr
	FiStartOff  Ti64
	FmxSz       int32
	FbEof       int32
	FbUseThread int32
	FaFile      [2]TSorterFile
}

// C documentation
//
//	/*
//	** This structure is passed around through all the PRAGMA integrity_check
//	** 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).
//	*/
type TIntegrityCk = struct {
	FpBt     uintptr
	FpPager  uintptr
	FaPgRef  uintptr
	FnCkPage TPgno
	FmxErr   int32
	FnErr    int32
	Frc      int32
	FnStep   Tu32
	FzPfx    uintptr
	Fv0      TPgno
	Fv1      TPgno
	Fv2      int32
	FerrMsg  TStrAccum
	Fheap    uintptr
	Fdb      uintptr
	FnRow    Ti64
}

type TJsonEachCursor = struct {
	Fbase         Tsqlite3_vtab_cursor
	FiRowid       Tu32
	Fi            Tu32
	FiEnd         Tu32
	FnRoot        Tu32
	FeType        Tu8
	FbRecursive   Tu8
	FeMode        Tu8
	FnParent      Tu32
	FnParentAlloc Tu32
	FaParent      uintptr
	Fdb           uintptr
	Fpath         TJsonString
	FsParse       TJsonParse
}

// C documentation
//
//	/****************************************************************************
//	** The json_each virtual table
//	****************************************************************************/
type TJsonParent = struct {
	FiHead  Tu32
	FiValue Tu32
	FiEnd   Tu32
	FnPath  Tu32
	FiKey   Ti64
}

// C documentation
//
//	/*
//	** The names of the following types declared in vdbeInt.h are required
//	** for the VdbeOp definition.
//	*/
type TMem = struct {
	Fu        TMemValue
	Fz        uintptr
	Fn        int32
	Fflags    Tu16
	Fenc      Tu8
	FeSubtype Tu8
	Fdb       uintptr
	FszMalloc int32
	FuTemp    Tu32
	FzMalloc  uintptr
	FxDel     uintptr
}

// C documentation
//
//	/*
//	** State information local to the memory allocation subsystem.
//	*/
type TMem0Global = struct {
	Fmutex          uintptr
	FalarmThreshold Tsqlite3_int64
	FhardLimit      Tsqlite3_int64
	FnearlyFull     int32
}

// C documentation
//
//	/* Forward references to internal structures */
type TMemJournal = struct {
	FpMethod    uintptr
	FnChunkSize int32
	FnSpill     int32
	FpFirst     uintptr
	Fendpoint   TFilePoint
	Freadpoint  TFilePoint
	Fflags      int32
	FpVfs       uintptr
	FzJournal   uintptr
}

type TMemStore = struct {
	Fsz      Tsqlite3_int64
	FszAlloc Tsqlite3_int64
	FszMax   Tsqlite3_int64
	FaData   uintptr
	FpMutex  uintptr
	FnMmap   int32
	FmFlags  uint32
	FnRdLock int32
	FnWrLock int32
	FnRef    int32
	FzFName  uintptr
}

type TMemValue = struct {
	Fi      [0]int64
	FnZero  [0]int32
	FzPType [0]uintptr
	FpDef   [0]uintptr
	Fr      float64
}

/*
** 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".
 */
type TNthValueCtx = struct {
	FnStep  Ti64
	FpValue uintptr
}

/*
** Context object for ntile() window function.
 */
type TNtileCtx = struct {
	FnTotal Ti64
	FnParam Ti64
	FiRow   Ti64
}

type TPCache = struct {
	FpDirty     uintptr
	FpDirtyTail uintptr
	FpSynced    uintptr
	FnRefSum    Ti64
	FszCache    int32
	FszSpill    int32
	FszPage     int32
	FszExtra    int32
	FbPurgeable Tu8
	FeCreate    Tu8
	FxStress    uintptr
	FpStress    uintptr
	FpCache     uintptr
}

// C documentation
//
//	/*
//	** 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()).
//	*/
type TPagerSavepoint = struct {
	FiOffset            Ti64
	FiHdrOffset         Ti64
	FpInSavepoint       uintptr
	FnOrig              TPgno
	FiSubRec            TPgno
	FbTruncateOnRelease int32
	FaWalData           [4]Tu32
}

/* Merge PMAs together */
type TPmaReader = struct {
	FiReadOff Ti64
	FiEof     Ti64
	FnAlloc   int32
	FnKey     int32
	FpFd      uintptr
	FaAlloc   uintptr
	FaKey     uintptr
	FaBuffer  uintptr
	FnBuffer  int32
	FaMap     uintptr
	FpIncr    uintptr
}

/* Incrementally read one PMA */
type TPmaWriter = struct {
	FeFWErr    int32
	FaBuffer   uintptr
	FnBuffer   int32
	FiBufStart int32
	FiBufEnd   int32
	FiWriteOff Ti64
	FpFd       uintptr
	FnPmaSpill Tu64
}

// C documentation
//
//	/* Definitions of all built-in pragmas */
type TPragmaName = struct {
	FzName      uintptr
	FePragTyp   Tu8
	FmPragFlg   Tu8
	FiPragCName Tu8
	FnPragCName Tu8
	FiArg       Tu64
}

type TPragmaVtabCursor = struct {
	Fbase    Tsqlite3_vtab_cursor
	FpPragma uintptr
	FiRowid  Tsqlite_int64
	FazArg   [2]uintptr
}

type TPrefixMerger = struct {
	Fiter  TFts5DoclistIter
	FiPos  Ti64
	FiOff  int32
	FaPos  uintptr
	FpNext uintptr
}

// C documentation
//
//	/*
//	** Context object passed by fts5SetupPrefixIter() to fts5VisitEntries().
//	*/
type TPrefixSetupCtx = struct {
	FxMerge     uintptr
	FxAppend    uintptr
	FiLastRowid Ti64
	FnMerge     int32
	FaBuf       uintptr
	FnBuf       int32
	Fdoclist    TFts5Buffer
	FpTokendata uintptr
}

type TRCStr = struct {
	FnRCRef Tu64
}

type TRbuState = struct {
	FeStage        int32
	FzTbl          uintptr
	FzDataTbl      uintptr
	FzIdx          uintptr
	FiWalCksum     Ti64
	FnRow          int32
	FnProgress     Ti64
	FiCookie       Tu32
	FiOalSz        Ti64
	FnPhaseOneStep Ti64
}

/* Structure used to pass information throughout the Walker in order to
** implement sqlite3ReferencesSrcList().
 */
type TRefSrcList = struct {
	Fdb        uintptr
	FpRef      uintptr
	FnExclude  Ti64
	FaiExclude uintptr
}

/* 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.
 */
type TReusableSpace = struct {
	FpSpace  uintptr
	FnFree   Tsqlite3_int64
	FnNeeded Tsqlite3_int64
}

/*
** 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.
 */
type TRowSetEntry = struct {
	Fv      Ti64
	FpRight uintptr
	FpLeft  uintptr
}

type TRtree = struct {
	Fbase          Tsqlite3_vtab
	Fdb            uintptr
	FiNodeSize     int32
	FnDim          Tu8
	FnDim2         Tu8
	FeCoordType    Tu8
	FnBytesPerCell Tu8
	FinWrTrans     Tu8
	FnAux          Tu16
	FnAuxNotNull   Tu8
	FiDepth        int32
	FzDb           uintptr
	FzName         uintptr
	FzNodeName     uintptr
	FnBusy         Tu32
	FnRowEst       Ti64
	FnCursor       Tu32
	FnNodeRef      Tu32
	FzReadAuxSql   uintptr
	FpDeleted      uintptr
	FpNodeBlob     uintptr
	FpWriteNode    uintptr
	FpDeleteNode   uintptr
	FpReadRowid    uintptr
	FpWriteRowid   uintptr
	FpDeleteRowid  uintptr
	FpReadParent   uintptr
	FpWriteParent  uintptr
	FpDeleteParent uintptr
	FpWriteAux     uintptr
	FaHash         [97]uintptr
}

type TRtreeCell = struct {
	FiRowid Ti64
	FaCoord [10]TRtreeCoord
}

type TRtreeConstraint = struct {
	FiCoord int32
	Fop     int32
	Fu      struct {
		FxGeom      [0]uintptr
		FxQueryFunc [0]uintptr
		FrValue     TRtreeDValue
	}
	FpInfo uintptr
}

type TRtreeCursor = struct {
	Fbase        Tsqlite3_vtab_cursor
	FatEOF       Tu8
	FbPoint      Tu8
	FbAuxValid   Tu8
	FiStrategy   int32
	FnConstraint int32
	FaConstraint uintptr
	FnPointAlloc int32
	FnPoint      int32
	FmxLevel     int32
	FaPoint      uintptr
	FpReadAux    uintptr
	FsPoint      TRtreeSearchPoint
	FaNode       [5]uintptr
	FanQueue     [42]Tu32
}

type TRtreeMatchArg = struct {
	FiSize      Tu32
	Fcb         TRtreeGeomCallback
	FnParam     int32
	FapSqlParam uintptr
}

type TRtreeNode = struct {
	FpParent uintptr
	FiNode   Ti64
	FnRef    int32
	FisDirty int32
	FzData   uintptr
	FpNext   uintptr
}

type TRtreeSearchPoint = struct {
	FrScore  TRtreeDValue
	Fid      Tsqlite3_int64
	FiLevel  Tu8
	FeWithin Tu8
	FiCell   Tu8
}

type TSavepoint = struct {
	FzName            uintptr
	FnDeferredCons    Ti64
	FnDeferredImmCons Ti64
	FpNext            uintptr
}

/* A record being sorted */
type TSortSubtask = struct {
	FpThread   uintptr
	FbDone     int32
	FnPMA      int32
	FpSorter   uintptr
	FpUnpacked uintptr
	Flist      TSorterList
	FxCompare  TSorterCompare
	Ffile      TSorterFile
	Ffile2     TSorterFile
	FnSpill    Tu64
}

/* A sub-task in the sort process */
type TSorterFile = struct {
	FpFd  uintptr
	FiEof Ti64
}

/* Temporary file object wrapper */
type TSorterList = struct {
	FpList   uintptr
	FaMemory uintptr
	FszPMA   Ti64
}

/*
** Structure containing global configuration data for the SQLite library.
**
** This structure also contains some state information.
 */
type TSqlite3Config = struct {
	FbMemstat            int32
	FbCoreMutex          Tu8
	FbFullMutex          Tu8
	FbOpenUri            Tu8
	FbUseCis             Tu8
	FbSmallMalloc        Tu8
	FbExtraSchemaChecks  Tu8
	FmxStrlen            int32
	FneverCorrupt        int32
	FszLookaside         int32
	FnLookaside          int32
	FnStmtSpill          int32
	Fm                   Tsqlite3_mem_methods
	Fmutex               Tsqlite3_mutex_methods
	Fpcache2             Tsqlite3_pcache_methods2
	FpHeap               uintptr
	FnHeap               int32
	FmnReq               int32
	FmxReq               int32
	FszMmap              Tsqlite3_int64
	FmxMmap              Tsqlite3_int64
	FpPage               uintptr
	FszPage              int32
	FnPage               int32
	FmxParserStack       int32
	FsharedCacheEnabled  int32
	FszPma               Tu32
	FisInit              int32
	FinProgress          int32
	FisMutexInit         int32
	FisMallocInit        int32
	FisPCacheInit        int32
	FnRefInitMutex       int32
	FpInitMutex          uintptr
	FxLog                uintptr
	FpLogArg             uintptr
	FmxMemdbSize         Tsqlite3_int64
	FxTestCallback       uintptr
	FbLocaltimeFault     int32
	FxAltLocaltime       uintptr
	FiOnceResetThreshold int32
	FszSorterRef         Tu32
	FiPrngSeed           uint32
}

type TSrcItem = struct {
	FzName  uintptr
	FzAlias uintptr
	FpSTab  uintptr
	Ffg     struct {
		Fjointype Tu8
		F__ccgo4  uint32
	}
	FiCursor int32
	FcolUsed TBitmask
	Fu1      struct {
		FpFuncArg   [0]uintptr
		FnRow       [0]Tu32
		FzIndexedBy uintptr
	}
	Fu2 struct {
		FpCteUse  [0]uintptr
		FpIBIndex uintptr
	}
	Fu3 struct {
		FpUsing [0]uintptr
		FpOn    uintptr
	}
	Fu4 struct {
		FzDatabase [0]uintptr
		FpSubq     [0]uintptr
		FpSchema   uintptr
	}
}

// C documentation
//
//	/*
//	** Three SQL functions - stat_init(), stat_push(), and stat_get() -
//	** share an instance of the following structure to hold their state
//	** information.
//	*/
type TStatAccum = struct {
	Fdb         uintptr
	FnEst       TtRowcnt
	FnRow       TtRowcnt
	FnLimit     int32
	FnCol       int32
	FnKeyCol    int32
	FnSkipAhead Tu8
	Fcurrent    TStatSample
	FnPSample   TtRowcnt
	FmxSample   int32
	FiPrn       Tu32
	FaBest      uintptr
	FiMin       int32
	FnSample    int32
	FnMaxEqZero int32
	FiGet       int32
	Fa          uintptr
}

type TStatCursor = struct {
	Fbase       Tsqlite3_vtab_cursor
	FpStmt      uintptr
	FisEof      Tu8
	FisAgg      Tu8
	FiDb        int32
	FaPage      [32]TStatPage
	FiPage      int32
	FiPageno    Tu32
	FzName      uintptr
	FzPath      uintptr
	FzPagetype  uintptr
	FnPage      int32
	FnCell      int32
	FnMxPayload int32
	FnUnused    Ti64
	FnPayload   Ti64
	FiOffset    Ti64
	FszPage     Ti64
}

type TStatSample = struct {
	FanDLt uintptr
	FanEq  uintptr
	FanLt  uintptr
	Fu     struct {
		FaRowid [0]uintptr
		FiRowid Ti64
	}
	FnRowid    Tu32
	FisPSample Tu8
	FiCol      int32
	FiHash     Tu32
}

// C documentation
//
//	/*
//	** An instance of the following structure holds the context of a
//	** sum() or avg() aggregate computation.
//	*/
type TSumCtx = struct {
	FrSum   float64
	FrErr   float64
	FiSum   Ti64
	Fcnt    Ti64
	Fapprox Tu8
	Fovrfl  Tu8
}

// C documentation
//
//	/*
//	** 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
//	*/
type TVdbeCursor = struct {
	FeCurType       Tu8
	FiDb            Ti8
	FnullRow        Tu8
	FdeferredMoveto Tu8
	FisTable        Tu8
	F__ccgo_align5  [3]byte
	F__ccgo8        uint8
	FseekHit        Tu16
	Fub             struct {
		FaAltMap [0]uintptr
		FpBtx    uintptr
	}
	FseqCount    Ti64
	FcacheStatus Tu32
	FseekResult  int32
	FpAltCursor  uintptr
	Fuc          struct {
		FpVCur   [0]uintptr
		FpSorter [0]uintptr
		FpCursor uintptr
	}
	FpKeyInfo     uintptr
	FiHdrOffset   Tu32
	FpgnoRoot     TPgno
	FnField       Ti16
	FnHdrParsed   Tu16
	FmovetoTarget Ti64
	FaOffset      uintptr
	FaRow         uintptr
	FpayloadSize  Tu32
	FszRow        Tu32
	FpCache       uintptr
}

// C documentation
//
//	/*
//	** 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.
//	*/
type TVdbeFrame = struct {
	Fv         uintptr
	FpParent   uintptr
	FaOp       uintptr
	FaMem      uintptr
	FapCsr     uintptr
	FaOnce     uintptr
	Ftoken     uintptr
	FlastRowid Ti64
	FpAuxData  uintptr
	FnCursor   int32
	Fpc        int32
	FnOp       int32
	FnMem      int32
	FnChildMem int32
	FnChildCsr int32
	FnChange   Ti64
	FnDbChange Ti64
}

// C documentation
//
//	/* Opaque type used by code in vdbesort.c */
type TVdbeSorter = struct {
	FmnPmaSize   int32
	FmxPmaSize   int32
	FmxKeysize   int32
	Fpgsz        int32
	FpReader     uintptr
	FpMerger     uintptr
	Fdb          uintptr
	FpKeyInfo    uintptr
	FpUnpacked   uintptr
	Flist        TSorterList
	FiMemory     int32
	FnMemory     int32
	FbUsePMA     Tu8
	FbUseThreads Tu8
	FiPrev       Tu8
	FnTask       Tu8
	FtypeMask    Tu8
}

// C documentation
//
//	/* A cache of large TEXT or BLOB values in a VdbeCursor */
type TVdbeTxtBlbCache = struct {
	FpCValue     uintptr
	FiOffset     Ti64
	FiCol        int32
	FcacheStatus Tu32
	FcolCacheCtr Tu32
}

// C documentation
//
//	/* Connection to a write-ahead log (WAL) file.
//	** There is one object of this type for each pager.
//	*/
type TWal = struct {
	FpVfs                uintptr
	FpDbFd               uintptr
	FpWalFd              uintptr
	FiCallback           Tu32
	FmxWalSize           Ti64
	FnWiData             int32
	FszFirstBlock        int32
	FapWiData            uintptr
	FszPage              Tu32
	FreadLock            Ti16
	FsyncFlags           Tu8
	FexclusiveMode       Tu8
	FwriteLock           Tu8
	FckptLock            Tu8
	FreadOnly            Tu8
	FtruncateOnCommit    Tu8
	FsyncHeader          Tu8
	FpadToSectorBoundary Tu8
	FbShmUnreliable      Tu8
	Fhdr                 TWalIndexHdr
	FminFrame            Tu32
	FiReCksum            Tu32
	FzWalName            uintptr
	FnCkpt               Tu32
	FpSnapshot           uintptr
	FbGetSnapshot        int32
}

// C documentation
//
//	/*
//	** Information about the current state of the WAL file and where
//	** the next fsync should occur - passed from sqlite3WalFrames() into
//	** walWriteToLog().
//	*/
type TWalWriter = struct {
	FpWal       uintptr
	FpFd        uintptr
	FiSyncPoint Tsqlite3_int64
	FsyncFlags  int32
	FszPage     int32
}

type TWhereAndInfo = struct {
	Fwc TWhereClause
}

// C documentation
//
//	/* Forward references
//	*/
type TWhereClause = struct {
	FpWInfo  uintptr
	FpOuter  uintptr
	Fop      Tu8
	FhasOr   Tu8
	FnTerm   int32
	FnSlot   int32
	FnBase   int32
	Fa       uintptr
	FaStatic [8]TWhereTerm
}

type TWhereLevel = struct {
	FiLeftJoin   int32
	FiTabCur     int32
	FiIdxCur     int32
	FaddrBrk     int32
	FaddrHalt    int32
	FaddrNxt     int32
	FaddrSkip    int32
	FaddrCont    int32
	FaddrFirst   int32
	FaddrBody    int32
	FregBignull  int32
	FaddrBignull int32
	FregFilter   int32
	FpRJ         uintptr
	FiFrom       Tu8
	Fop          Tu8
	Fp3          Tu8
	Fp5          Tu8
	Fp1          int32
	Fp2          int32
	Fu           struct {
		FpCoveringIdx [0]uintptr
		Fin           struct {
			FnIn     int32
			FaInLoop uintptr
		}
	}
	FpWLoop   uintptr
	FnotReady TBitmask
}

type TWhereLoop = struct {
	Fprereq   TBitmask
	FmaskSelf TBitmask
	FiTab     Tu8
	FiSortIdx Tu8
	FrSetup   TLogEst
	FrRun     TLogEst
	FnOut     TLogEst
	Fu        struct {
		Fvtab [0]struct {
			FidxNum    int32
			F__ccgo4   uint8
			FisOrdered Ti8
			FomitMask  Tu16
			FidxStr    uintptr
			FmHandleIn Tu32
		}
		Fbtree struct {
			FnEq          Tu16
			FnBtm         Tu16
			FnTop         Tu16
			FnDistinctCol Tu16
			FpIndex       uintptr
			FpOrderBy     uintptr
		}
	}
	FwsFlags     Tu32
	FnLTerm      Tu16
	FnSkip       Tu16
	FnLSlot      Tu16
	FaLTerm      uintptr
	FpNextLoop   uintptr
	FaLTermSpace [3]uintptr
}

type TWhereMemBlock = struct {
	FpNext uintptr
	Fsz    Tu64
}

type TWhereOrCost = struct {
	Fprereq TBitmask
	FrRun   TLogEst
	FnOut   TLogEst
}

type TWhereOrInfo = struct {
	Fwc        TWhereClause
	Findexable TBitmask
}

type TWhereOrSet = struct {
	Fn Tu16
	Fa [3]TWhereOrCost
}

type TWherePath = struct {
	FmaskLoop  TBitmask
	FrevLoop   TBitmask
	FnRow      TLogEst
	FrCost     TLogEst
	FrUnsort   TLogEst
	FisOrdered Ti8
	FaLoop     uintptr
}

type TWhereTerm = struct {
	FpExpr      uintptr
	FpWC        uintptr
	FtruthProb  TLogEst
	FwtFlags    Tu16
	FeOperator  Tu16
	FnChild     Tu8
	FeMatchOp   Tu8
	FiParent    int32
	FleftCursor int32
	Fu          struct {
		FpOrInfo  [0]uintptr
		FpAndInfo [0]uintptr
		Fx        struct {
			FleftColumn int32
			FiField     int32
		}
	}
	FprereqRight TBitmask
	FprereqAll   TBitmask
}

type Tlldiv_t = struct {
	Fquot int64
	Frem  int64
}

type Trbu_file = struct {
	Fbase         Tsqlite3_file
	FpReal        uintptr
	FpRbuVfs      uintptr
	FpRbu         uintptr
	Fsz           Ti64
	FopenFlags    int32
	FiCookie      Tu32
	FiWriteVer    Tu8
	FbNolock      Tu8
	FnShm         int32
	FapShm        uintptr
	FzDel         uintptr
	FzWal         uintptr
	FpWalFd       uintptr
	FpMainNext    uintptr
	FpMainRbuNext uintptr
}

// C documentation
//
//	/*
//	** 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.
//	*/
type Tsqlite3 = struct {
	FpVfs                   uintptr
	FpVdbe                  uintptr
	FpDfltColl              uintptr
	Fmutex                  uintptr
	FaDb                    uintptr
	FnDb                    int32
	FmDbFlags               Tu32
	Fflags                  Tu64
	FlastRowid              Ti64
	FszMmap                 Ti64
	FnSchemaLock            Tu32
	FopenFlags              uint32
	FerrCode                int32
	FerrByteOffset          int32
	FerrMask                int32
	FiSysErrno              int32
	FdbOptFlags             Tu32
	Fenc                    Tu8
	FautoCommit             Tu8
	Ftemp_store             Tu8
	FmallocFailed           Tu8
	FbBenignMalloc          Tu8
	FdfltLockMode           Tu8
	FnextAutovac            int8
	FsuppressErr            Tu8
	FvtabOnConflict         Tu8
	FisTransactionSavepoint Tu8
	FmTrace                 Tu8
	FnoSharedCache          Tu8
	FnSqlExec               Tu8
	FeOpenState             Tu8
	FnFpDigit               Tu8
	FnextPagesize           int32
	FnChange                Ti64
	FnTotalChange           Ti64
	FaLimit                 [13]int32
	FnMaxSorterMmap         int32
	Finit1                  Tsqlite3InitInfo
	FnVdbeActive            int32
	FnVdbeRead              int32
	FnVdbeWrite             int32
	FnVdbeExec              int32
	FnVDestroy              int32
	FnExtension             int32
	FaExtension             uintptr
	Ftrace                  struct {
		FxV2     [0]uintptr
		FxLegacy uintptr
	}
	FpTraceArg          uintptr
	FxProfile           uintptr
	FpProfileArg        uintptr
	FpCommitArg         uintptr
	FxCommitCallback    uintptr
	FpRollbackArg       uintptr
	FxRollbackCallback  uintptr
	FpUpdateArg         uintptr
	FxUpdateCallback    uintptr
	FpAutovacPagesArg   uintptr
	FxAutovacDestr      uintptr
	FxAutovacPages      uintptr
	FpParse             uintptr
	FpPreUpdateArg      uintptr
	FxPreUpdateCallback uintptr
	FpPreUpdate         uintptr
	FxWalCallback       uintptr
	FpWalArg            uintptr
	FxCollNeeded        uintptr
	FxCollNeeded16      uintptr
	FpCollNeededArg     uintptr
	FpErr               uintptr
	Fu1                 struct {
		FnotUsed1      [0]float64
		FisInterrupted int32
		F__ccgo_pad2   [4]byte
	}
	Flookaside           TLookaside
	FxAuth               Tsqlite3_xauth
	FpAuthArg            uintptr
	FxProgress           uintptr
	FpProgressArg        uintptr
	FnProgressOps        uint32
	FnVTrans             int32
	FaModule             THash
	FpVtabCtx            uintptr
	FaVTrans             uintptr
	FpDisconnect         uintptr
	FaFunc               THash
	FaCollSeq            THash
	FbusyHandler         TBusyHandler
	FaDbStatic           [2]TDb
	FpSavepoint          uintptr
	FnAnalysisLimit      int32
	FbusyTimeout         int32
	FnSavepoint          int32
	FnStatement          int32
	FnDeferredCons       Ti64
	FnDeferredImmCons    Ti64
	FpnBytesFreed        uintptr
	FpDbData             uintptr
	FnSpill              Tu64
	FpBlockingConnection uintptr
	FpUnlockConnection   uintptr
	FpUnlockArg          uintptr
	FxUnlockNotify       uintptr
	FpNextBlocked        uintptr
}

type Tsqlite3_index_info = struct {
	FnConstraint      int32
	FaConstraint      uintptr
	FnOrderBy         int32
	FaOrderBy         uintptr
	FaConstraintUsage uintptr
	FidxNum           int32
	FidxStr           uintptr
	FneedToFreeIdxStr int32
	ForderByConsumed  int32
	FestimatedCost    float64
	FestimatedRows    Tsqlite3_int64
	FidxFlags         int32
	FcolUsed          Tsqlite3_uint64
}

type Tsqlite3_rtree_query_info = struct {
	FpContext      uintptr
	FnParam        int32
	FaParam        uintptr
	FpUser         uintptr
	FxDelUser      uintptr
	FaCoord        uintptr
	FanQueue       uintptr
	FnCoord        int32
	FiLevel        int32
	FmxLevel       int32
	FiRowid        Tsqlite3_int64
	FrParentScore  Tsqlite3_rtree_dbl
	FeParentWithin int32
	FeWithin       int32
	FrScore        Tsqlite3_rtree_dbl
	FapSqlParam    uintptr
}

// C documentation
//
//	/*
//	** CAPI3REF: Session Object Handle
//	**
//	** An instance of this object is a [session] that can be used to
//	** record changes to a database.
//	*/
type Tsqlite3_session = struct {
	Fdb                uintptr
	FzDb               uintptr
	FbEnableSize       int32
	FbEnable           int32
	FbIndirect         int32
	FbAutoAttach       int32
	FbImplicitPK       int32
	Frc                int32
	FpFilterCtx        uintptr
	FxTableFilter      uintptr
	FnMalloc           Ti64
	FnMaxChangesetSize Ti64
	FpZeroBlob         uintptr
	FpNext             uintptr
	FpTable            uintptr
	Fhook              TSessionHook
}

// C documentation
//
//	/*
//	** 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 objects returned by [sqlite3_vtab_rhs_value()]
//	** 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.
//	*/
type Tsqlite3_value = struct {
	Fu        TMemValue
	Fz        uintptr
	Fn        int32
	Fflags    Tu16
	Fenc      Tu8
	FeSubtype Tu8
	Fdb       uintptr
	FszMalloc int32
	FuTemp    Tu32
	FzMalloc  uintptr
	FxDel     uintptr
}
