// Code generated by modernc.org/undup from the per-target sqlite_*.go files; DO NOT EDIT. //go:build (linux && 386) || (linux && amd64) || (linux && arm) || (linux && arm64) || (linux && ppc64le) || (linux && riscv64) || (linux && s390x) package sqlite3 import ( "unsafe" "modernc.org/libc" ) // C documentation // // /* Force an SQLITE_TOOBIG error. */ func Xsqlite3_result_error_toobig(tls *libc.TLS, pCtx uintptr) { (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError = int32(SQLITE_TOOBIG) _sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, __ccgo_ts+5594, int64(-int32(1)), uint8(SQLITE_UTF8), libc.UintptrFromInt32(0)) } // C documentation // // /************** End of stmt.c ************************************************/ // /* Return the source-id for this library */ func Xsqlite3_sourceid(tls *libc.TLS) (r uintptr) { return __ccgo_ts + 42539 } // C documentation // // /* // ** Register an unlock-notify callback. // ** // ** This is called after connection "db" has attempted some operation // ** but has received an SQLITE_LOCKED error because another connection // ** (call it pOther) in the same process was busy using the same shared // ** cache. pOther is found by looking at db->pBlockingConnection. // ** // ** If there is no blocking connection, the callback is invoked immediately, // ** before this routine returns. // ** // ** If pOther is already blocked on db, then report SQLITE_LOCKED, to indicate // ** a deadlock. // ** // ** Otherwise, make arrangements to invoke xNotify when pOther drops // ** its locks. // ** // ** Each call to this routine overrides any prior callbacks registered // ** on the same "db". If xNotify==0 then any prior callbacks are immediately // ** cancelled. // */ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, __ccgo_fp_xNotify uintptr, _pArg uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) *(*uintptr)(unsafe.Pointer(bp)) = _pArg var p, v2 uintptr var rc int32 _, _, _ = p, rc, v2 rc = SQLITE_OK Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) _enterMutex(tls) if __ccgo_fp_xNotify == uintptr(0) { _removeFromBlockedList(tls, db) (*Tsqlite3)(unsafe.Pointer(db)).FpBlockingConnection = uintptr(0) (*Tsqlite3)(unsafe.Pointer(db)).FpUnlockConnection = uintptr(0) (*Tsqlite3)(unsafe.Pointer(db)).FxUnlockNotify = uintptr(0) (*Tsqlite3)(unsafe.Pointer(db)).FpUnlockArg = uintptr(0) } else { if uintptr(0) == (*Tsqlite3)(unsafe.Pointer(db)).FpBlockingConnection { /* The blocking transaction has been concluded. Or there never was a ** blocking transaction. In either case, invoke the notify callback ** immediately. */ (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{__ccgo_fp_xNotify})))(tls, bp, int32(1)) } else { p = (*Tsqlite3)(unsafe.Pointer(db)).FpBlockingConnection for { if !(p != 0 && p != db) { break } goto _1 _1: ; p = (*Tsqlite3)(unsafe.Pointer(p)).FpUnlockConnection } if p != 0 { rc = int32(SQLITE_LOCKED) /* Deadlock detected. */ } else { (*Tsqlite3)(unsafe.Pointer(db)).FpUnlockConnection = (*Tsqlite3)(unsafe.Pointer(db)).FpBlockingConnection (*Tsqlite3)(unsafe.Pointer(db)).FxUnlockNotify = __ccgo_fp_xNotify (*Tsqlite3)(unsafe.Pointer(db)).FpUnlockArg = **(**uintptr)(__ccgo_up(bp)) _removeFromBlockedList(tls, db) _addToBlockedList(tls, db) } } } _leaveMutex(tls) if rc != 0 { v2 = __ccgo_ts + 26376 } else { v2 = uintptr(0) } _sqlite3ErrorWithMsg(tls, db, rc, v2, 0) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return rc } func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) (r int32) { var pDb, zBegin, v1 uintptr var rc int32 _, _, _, _ = pDb, rc, zBegin, v1 rc = (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc if rc == int32(SQLITE_DONE) { return SQLITE_OK } if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { if rc == SQLITE_OK { rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+16122, uintptr(0), uintptr(0), uintptr(0)) } } /* Sync the db file */ if rc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_CKPT) { pDb = (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpReal rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(pDb)).FpMethods)).FxSync})))(tls, pDb, int32(SQLITE_SYNC_NORMAL)) } (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc _rbuSaveState(tls, p, (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage) rc = (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc if (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage == int32(RBU_STAGE_OAL) { if rc == SQLITE_OK { rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, __ccgo_ts+16122, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget == uintptr(0) { v1 = __ccgo_ts + 16107 } else { v1 = __ccgo_ts + 34636 } zBegin = v1 rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbRbu, zBegin, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { rc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+34636, uintptr(0), uintptr(0), uintptr(0)) } } (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc return rc } var _aAgg = [1]struct { FxStep uintptr FxFinal uintptr FzName uintptr }{ 0: { FzName: __ccgo_ts + 30202, }, } var _aAlterTableFuncs = [9]TFuncDef{ 0: { FnArg: int16(9), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FzName: __ccgo_ts + 12655, }, 1: { FnArg: int16(7), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FzName: __ccgo_ts + 12676, }, 2: { FnArg: int16(7), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FzName: __ccgo_ts + 12696, }, 3: { FnArg: int16(3), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FzName: __ccgo_ts + 12715, }, 4: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FzName: __ccgo_ts + 12734, }, 5: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FzName: __ccgo_ts + 12757, }, 6: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FzName: __ccgo_ts + 12780, }, 7: { FnArg: int16(3), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FzName: __ccgo_ts + 12792, }, 8: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FzName: __ccgo_ts + 12814, }, } var _aCacheMode = [3]struct { Fz uintptr Fmode int32 }{ 0: { Fz: __ccgo_ts + 26172, Fmode: int32(SQLITE_OPEN_SHAREDCACHE), }, 1: { Fz: __ccgo_ts + 26179, Fmode: int32(SQLITE_OPEN_PRIVATECACHE), }, 2: {}, } var _aDateTimeFuncs = [10]TFuncDef{ 0: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FpUserData: uintptr(unsafe.Pointer(&_sqlite3Config)), FzName: __ccgo_ts + 1291, }, 1: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FpUserData: uintptr(unsafe.Pointer(&_sqlite3Config)), FzName: __ccgo_ts + 1311, }, 2: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FpUserData: uintptr(unsafe.Pointer(&_sqlite3Config)), FzName: __ccgo_ts + 1519, }, 3: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FpUserData: uintptr(unsafe.Pointer(&_sqlite3Config)), FzName: __ccgo_ts + 1524, }, 4: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FpUserData: uintptr(unsafe.Pointer(&_sqlite3Config)), FzName: __ccgo_ts + 1529, }, 5: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FpUserData: uintptr(unsafe.Pointer(&_sqlite3Config)), FzName: __ccgo_ts + 1538, }, 6: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT)), FpUserData: uintptr(unsafe.Pointer(&_sqlite3Config)), FzName: __ccgo_ts + 1547, }, 7: { FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 1556, }, 8: { FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 1569, }, 9: { FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 1587, }, } var _aFunc = [12]struct { FxFunc uintptr FnArg int8 FbPure uint8 FzName uintptr }{ 0: { FnArg: int8(1), FbPure: uint8(1), FzName: __ccgo_ts + 30059, }, 1: { FnArg: int8(1), FbPure: uint8(1), FzName: __ccgo_ts + 30072, }, 2: { FnArg: int8(1), FbPure: uint8(1), FzName: __ccgo_ts + 30085, }, 3: { FnArg: int8(-int32(1)), FbPure: uint8(1), FzName: __ccgo_ts + 30098, }, 4: { FnArg: int8(2), FbPure: uint8(1), FzName: __ccgo_ts + 30044, }, 5: { FnArg: int8(3), FbPure: uint8(1), FzName: __ccgo_ts + 30110, }, 6: { FnArg: int8(2), FbPure: uint8(1), FzName: __ccgo_ts + 30028, }, 7: { FnArg: int8(1), FzName: __ccgo_ts + 30133, }, 8: { FnArg: int8(1), FbPure: uint8(1), FzName: __ccgo_ts + 30147, }, 9: { FnArg: int8(7), FbPure: uint8(1), FzName: __ccgo_ts + 30160, }, 10: { FnArg: int8(4), FbPure: uint8(1), FzName: __ccgo_ts + 30174, }, 11: { FnArg: int8(1), FbPure: uint8(1), FzName: __ccgo_ts + 30190, }, } var _aMsg = [29]uintptr{ 0: __ccgo_ts + 25359, 1: __ccgo_ts + 25372, 3: __ccgo_ts + 25388, 4: __ccgo_ts + 25413, 5: __ccgo_ts + 25427, 6: __ccgo_ts + 25446, 7: __ccgo_ts + 1674, 8: __ccgo_ts + 25471, 9: __ccgo_ts + 25508, 10: __ccgo_ts + 25520, 11: __ccgo_ts + 25535, 12: __ccgo_ts + 25568, 13: __ccgo_ts + 25586, 14: __ccgo_ts + 25611, 15: __ccgo_ts + 25640, 17: __ccgo_ts + 6243, 18: __ccgo_ts + 5594, 19: __ccgo_ts + 25657, 20: __ccgo_ts + 25675, 21: __ccgo_ts + 25693, 23: __ccgo_ts + 25727, 25: __ccgo_ts + 25748, 26: __ccgo_ts + 25774, 27: __ccgo_ts + 25797, 28: __ccgo_ts + 25818, } var _aOp = [4]struct { FzOp uintptr FeOp uint8 }{ 0: { FzOp: __ccgo_ts + 17816, FeOp: uint8(SQLITE_INDEX_CONSTRAINT_MATCH), }, 1: { FzOp: __ccgo_ts + 17150, FeOp: uint8(SQLITE_INDEX_CONSTRAINT_GLOB), }, 2: { FzOp: __ccgo_ts + 16609, FeOp: uint8(SQLITE_INDEX_CONSTRAINT_LIKE), }, 3: { FzOp: __ccgo_ts + 23938, FeOp: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP), }, } var _aOpenMode = [5]struct { Fz uintptr Fmode int32 }{ 0: { Fz: __ccgo_ts + 26192, Fmode: int32(SQLITE_OPEN_READONLY), }, 1: { Fz: __ccgo_ts + 26195, Fmode: int32(SQLITE_OPEN_READWRITE), }, 2: { Fz: __ccgo_ts + 26198, Fmode: libc.Int32FromInt32(SQLITE_OPEN_READWRITE) | libc.Int32FromInt32(SQLITE_OPEN_CREATE), }, 3: { Fz: __ccgo_ts + 19037, Fmode: int32(SQLITE_OPEN_MEMORY), }, 4: {}, } var _aPragmaName = [66]TPragmaName{ 0: { FzName: __ccgo_ts + 18036, FePragTyp: uint8(PragTyp_ANALYSIS_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 1: { FzName: __ccgo_ts + 18051, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_APPLICATION_ID), }, 2: { FzName: __ccgo_ts + 18066, FePragTyp: uint8(PragTyp_AUTO_VACUUM), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 3: { FzName: __ccgo_ts + 18078, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_AutoIndex), }, 4: { FzName: __ccgo_ts + 18094, FePragTyp: uint8(PragTyp_BUSY_TIMEOUT), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(56), FnPragCName: uint8(1), }, 5: { FzName: __ccgo_ts + 18017, FePragTyp: uint8(PragTyp_CACHE_SIZE), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 6: { FzName: __ccgo_ts + 18107, FePragTyp: uint8(PragTyp_CACHE_SPILL), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 7: { FzName: __ccgo_ts + 18119, FePragTyp: uint8(PragTyp_CASE_SENSITIVE_LIKE), FmPragFlg: uint8(PragFlg_NoColumns), }, 8: { FzName: __ccgo_ts + 18139, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_CellSizeCk), }, 9: { FzName: __ccgo_ts + 18155, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_CkptFullFSync), }, 10: { FzName: __ccgo_ts + 18176, FePragTyp: uint8(PragTyp_COLLATION_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(33), FnPragCName: uint8(2), }, 11: { FzName: __ccgo_ts + 18191, FePragTyp: uint8(PragTyp_COMPILE_OPTIONS), FmPragFlg: uint8(PragFlg_Result0), }, 12: { FzName: __ccgo_ts + 18207, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: libc.Uint64FromInt32(libc.Int32FromInt32(0x00001)) << libc.Int32FromInt32(32), }, 13: { FzName: __ccgo_ts + 18221, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_DATA_VERSION), }, 14: { FzName: __ccgo_ts + 18234, FePragTyp: uint8(PragTyp_DATABASE_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(50), FnPragCName: uint8(3), }, 15: { FzName: __ccgo_ts + 18248, FePragTyp: uint8(PragTyp_DEFAULT_CACHE_SIZE), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiPragCName: uint8(55), FnPragCName: uint8(1), }, 16: { FzName: __ccgo_ts + 18267, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_DeferFKs), }, 17: { FzName: __ccgo_ts + 18286, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_NullCallback), }, 18: { FzName: __ccgo_ts + 18309, FePragTyp: uint8(PragTyp_ENCODING), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 19: { FzName: __ccgo_ts + 18318, FePragTyp: uint8(PragTyp_FOREIGN_KEY_CHECK), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(43), FnPragCName: uint8(4), }, 20: { FzName: __ccgo_ts + 18336, FePragTyp: uint8(PragTyp_FOREIGN_KEY_LIST), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FnPragCName: uint8(8), }, 21: { FzName: __ccgo_ts + 18353, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ForeignKeys), }, 22: { FzName: __ccgo_ts + 18366, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_ReadOnly) | libc.Int32FromInt32(PragFlg_Result0)), }, 23: { FzName: __ccgo_ts + 18381, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_FullColNames), }, 24: { FzName: __ccgo_ts + 18399, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_FullFSync), }, 25: { FzName: __ccgo_ts + 18409, FePragTyp: uint8(PragTyp_FUNCTION_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(15), FnPragCName: uint8(6), }, 26: { FzName: __ccgo_ts + 18423, FePragTyp: uint8(PragTyp_HARD_HEAP_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 27: { FzName: __ccgo_ts + 18439, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_IgnoreChecks), }, 28: { FzName: __ccgo_ts + 18464, FePragTyp: uint8(PragTyp_INCREMENTAL_VACUUM), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_NoColumns)), }, 29: { FzName: __ccgo_ts + 18483, FePragTyp: uint8(PragTyp_INDEX_INFO), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(27), FnPragCName: uint8(3), }, 30: { FzName: __ccgo_ts + 18494, FePragTyp: uint8(PragTyp_INDEX_LIST), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(33), FnPragCName: uint8(5), }, 31: { FzName: __ccgo_ts + 18505, FePragTyp: uint8(PragTyp_INDEX_INFO), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(27), FnPragCName: uint8(6), FiArg: uint64(1), }, 32: { FzName: __ccgo_ts + 18517, FePragTyp: uint8(PragTyp_INTEGRITY_CHECK), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), }, 33: { FzName: __ccgo_ts + 18533, FePragTyp: uint8(PragTyp_JOURNAL_MODE), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 34: { FzName: __ccgo_ts + 18546, FePragTyp: uint8(PragTyp_JOURNAL_SIZE_LIMIT), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 35: { FzName: __ccgo_ts + 18565, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_LegacyAlter), }, 36: { FzName: __ccgo_ts + 18584, FePragTyp: uint8(PragTyp_LOCKING_MODE), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 37: { FzName: __ccgo_ts + 18597, FePragTyp: uint8(PragTyp_PAGE_COUNT), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 38: { FzName: __ccgo_ts + 18612, FePragTyp: uint8(PragTyp_MMAP_SIZE), }, 39: { FzName: __ccgo_ts + 18622, FePragTyp: uint8(PragTyp_MODULE_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(9), FnPragCName: uint8(1), }, 40: { FzName: __ccgo_ts + 18634, FePragTyp: uint8(PragTyp_OPTIMIZE), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_NeedSchema)), }, 41: { FzName: __ccgo_ts + 18643, FePragTyp: uint8(PragTyp_PAGE_COUNT), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq)), }, 42: { FzName: __ccgo_ts + 18654, FePragTyp: uint8(PragTyp_PAGE_SIZE), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 43: { FzName: __ccgo_ts + 18664, FePragTyp: uint8(PragTyp_PRAGMA_LIST), FmPragFlg: uint8(PragFlg_Result0), FiPragCName: uint8(9), FnPragCName: uint8(1), }, 44: { FzName: __ccgo_ts + 18676, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_QueryOnly), }, 45: { FzName: __ccgo_ts + 18687, FePragTyp: uint8(PragTyp_INTEGRITY_CHECK), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), }, 46: { FzName: __ccgo_ts + 18699, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: libc.Uint64FromInt32(libc.Int32FromInt32(0x00004)) << libc.Int32FromInt32(32), }, 47: { FzName: __ccgo_ts + 18716, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_RecTriggers), }, 48: { FzName: __ccgo_ts + 18735, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ReverseOrder), }, 49: { FzName: __ccgo_ts + 18761, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_SCHEMA_VERSION), }, 50: { FzName: __ccgo_ts + 18776, FePragTyp: uint8(PragTyp_SECURE_DELETE), FmPragFlg: uint8(PragFlg_Result0), }, 51: { FzName: __ccgo_ts + 18790, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_ShortColNames), }, 52: { FzName: __ccgo_ts + 18809, FePragTyp: uint8(PragTyp_SHRINK_MEMORY), FmPragFlg: uint8(PragFlg_NoColumns), }, 53: { FzName: __ccgo_ts + 18823, FePragTyp: uint8(PragTyp_SOFT_HEAP_LIMIT), FmPragFlg: uint8(PragFlg_Result0), }, 54: { FzName: __ccgo_ts + 18839, FePragTyp: uint8(PragTyp_SYNCHRONOUS), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_SchemaReq) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 55: { FzName: __ccgo_ts + 18851, FePragTyp: uint8(PragTyp_TABLE_INFO), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(8), FnPragCName: uint8(6), }, 56: { FzName: __ccgo_ts + 18862, FePragTyp: uint8(PragTyp_TABLE_LIST), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1)), FiPragCName: uint8(21), FnPragCName: uint8(6), }, 57: { FzName: __ccgo_ts + 18873, FePragTyp: uint8(PragTyp_TABLE_INFO), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NeedSchema) | libc.Int32FromInt32(PragFlg_Result1) | libc.Int32FromInt32(PragFlg_SchemaOpt)), FiPragCName: uint8(8), FnPragCName: uint8(7), FiArg: uint64(1), }, 58: { FzName: __ccgo_ts + 18885, FePragTyp: uint8(PragTyp_TEMP_STORE), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), }, 59: { FzName: __ccgo_ts + 18896, FePragTyp: uint8(PragTyp_TEMP_STORE_DIRECTORY), FmPragFlg: uint8(PragFlg_NoColumns1), }, 60: { FzName: __ccgo_ts + 18917, FePragTyp: uint8(PragTyp_THREADS), FmPragFlg: uint8(PragFlg_Result0), }, 61: { FzName: __ccgo_ts + 18925, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: uint64(SQLITE_TrustedSchema), }, 62: { FzName: __ccgo_ts + 18940, FePragTyp: uint8(PragTyp_HEADER_VALUE), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_NoColumns1) | libc.Int32FromInt32(PragFlg_Result0)), FiArg: uint64(BTREE_USER_VERSION), }, 63: { FzName: __ccgo_ts + 18953, FePragTyp: uint8(PragTyp_WAL_AUTOCHECKPOINT), }, 64: { FzName: __ccgo_ts + 18972, FePragTyp: uint8(PragTyp_WAL_CHECKPOINT), FmPragFlg: uint8(PragFlg_NeedSchema), FiPragCName: uint8(47), FnPragCName: uint8(3), }, 65: { FzName: __ccgo_ts + 18987, FePragTyp: uint8(PragTyp_FLAG), FmPragFlg: libc.Uint8FromInt32(libc.Int32FromInt32(PragFlg_Result0) | libc.Int32FromInt32(PragFlg_NoColumns1)), FiArg: libc.Uint64FromInt32(libc.Int32FromInt32(SQLITE_WriteSchema) | libc.Int32FromInt32(SQLITE_NoSchemaError)), }, } /* Number of pragmas: 68 on by default, 78 total. */ /************** End of pragma.h **********************************************/ /************** Continuing where we left off in pragma.c *********************/ /* ** When the 0x10 bit of PRAGMA optimize is set, any ANALYZE commands ** will be run with an analysis_limit set to the lessor of the value of ** the following macro or to the actual analysis_limit if it is non-zero, ** in order to prevent PRAGMA optimize from running for too long. ** ** The value of 2000 is chosen empirically so that the worst-case run-time ** for PRAGMA optimize does not exceed 100 milliseconds against a variety ** of test databases on a RaspberryPI-4 compiled using -Os and without ** -DSQLITE_DEBUG. Of course, your mileage may vary. For the purpose of ** this paragraph, "worst-case" means that ANALYZE ends up being ** run on every table in the database. The worst case typically only ** happens if PRAGMA optimize is run on a database file for which ANALYZE ** has not been previously run and the 0x10000 flag is included so that ** all tables are analyzed. The usual case for PRAGMA optimize is that ** no ANALYZE commands will be run at all, or if any ANALYZE happens it ** will be against a single table, so that expected timing for PRAGMA ** optimize on a PI-4 is more like 1 millisecond or less with the 0x10000 ** flag or less than 100 microseconds without the 0x10000 flag. ** ** An analysis limit of 2000 is almost always sufficient for the query ** planner to fully characterize an index. The additional accuracy from ** a larger analysis is not usually helpful. */ // C documentation // // /* // ** Many system calls are accessed through pointer-to-functions so that // ** they may be overridden at runtime to facilitate fault injection during // ** testing and sandboxing. The following array holds the names and pointers // ** to all overrideable system calls. // */ var _aSyscall = [29]Tunix_syscall{ 0: { FzName: __ccgo_ts + 3542, }, 1: { FzName: __ccgo_ts + 3547, }, 2: { FzName: __ccgo_ts + 3553, }, 3: { FzName: __ccgo_ts + 3560, }, 4: { FzName: __ccgo_ts + 3567, }, 5: { FzName: __ccgo_ts + 3572, }, 6: { FzName: __ccgo_ts + 3578, }, 7: { FzName: __ccgo_ts + 3588, }, 8: { FzName: __ccgo_ts + 3594, }, 9: { FzName: __ccgo_ts + 3599, }, 10: { FzName: __ccgo_ts + 3605, }, 11: { FzName: __ccgo_ts + 3613, }, 12: { FzName: __ccgo_ts + 3619, }, 13: { FzName: __ccgo_ts + 3626, }, 14: { FzName: __ccgo_ts + 3635, }, 15: { FzName: __ccgo_ts + 3642, }, 16: { FzName: __ccgo_ts + 3652, }, 17: { FzName: __ccgo_ts + 3659, }, 18: { FzName: __ccgo_ts + 3673, }, 19: { FzName: __ccgo_ts + 3679, }, 20: { FzName: __ccgo_ts + 3685, }, 21: { FzName: __ccgo_ts + 3692, }, 22: { FzName: __ccgo_ts + 3700, }, 23: { FzName: __ccgo_ts + 3705, }, 24: { FzName: __ccgo_ts + 3712, }, 25: { FzName: __ccgo_ts + 3719, }, 26: { FzName: __ccgo_ts + 3731, }, 27: { FzName: __ccgo_ts + 3740, }, 28: { FzName: __ccgo_ts + 3746, }, } var _aTable = [3]struct { FzName uintptr FzCols uintptr }{ 0: { FzName: __ccgo_ts + 12837, FzCols: __ccgo_ts + 12850, }, 1: { FzName: __ccgo_ts + 12863, FzCols: __ccgo_ts + 12876, }, 2: { FzName: __ccgo_ts + 12904, }, } /* ** Recommended number of samples for sqlite_stat4 */ // C documentation // // /* // ** Implementation of the abs() function. // ** // ** IMP: R-23979-26855 The abs(X) function returns the absolute value of // ** the numeric argument X. // */ func _absFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var iVal Ti64 var rVal float64 _, _ = iVal, rVal _ = argc switch Xsqlite3_value_type(tls, **(**uintptr)(__ccgo_up(argv))) { case int32(SQLITE_INTEGER): iVal = Xsqlite3_value_int64(tls, **(**uintptr)(__ccgo_up(argv))) if iVal < 0 { if iVal == int64(-libc.Int32FromInt32(1))-(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)<mallocFailed to true. // ** // ** C-style comments at the end are preserved. "--" style comments are // ** removed because the comment terminator might be \000, and we are about // ** to insert the pCons[] text into the middle of a larger string, and that // ** will have the effect of removing the comment terminator and messing up // ** the syntax. // */ func _alterRtrimConstraint(tls *libc.TLS, db uintptr, pCons uintptr, nCons int32) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var iEnd, iOff, nToken int32 var zTmp uintptr var _ /* t at bp+0 */ int32 _, _, _, _ = iEnd, iOff, nToken, zTmp zTmp = _sqlite3MPrintf(tls, db, __ccgo_ts+12050, libc.VaList(bp+16, nCons, pCons)) iOff = 0 iEnd = 0 if zTmp == uintptr(0) { return 0 } for int32(1) != 0 { **(**int32)(__ccgo_up(bp)) = 0 nToken = int32(_sqlite3GetToken(tls, zTmp+uintptr(iOff), bp)) if **(**int32)(__ccgo_up(bp)) == int32(TK_ILLEGAL) { break } if **(**int32)(__ccgo_up(bp)) != int32(TK_SPACE) && (**(**int32)(__ccgo_up(bp)) != int32(TK_COMMENT) || libc.Int32FromUint8(**(**Tu8)(__ccgo_up(zTmp + uintptr(iOff)))) != int32('-')) { iEnd = iOff + nToken } iOff = iOff + nToken } _sqlite3DbFree(tls, db, zTmp) return iEnd } var _attach_func = TFuncDef{ FnArg: int16(3), FfuncFlags: uint32(SQLITE_UTF8), FzName: __ccgo_ts + 13529, } var _az = [3]uintptr{ 0: __ccgo_ts + 16107, 1: __ccgo_ts + 16129, 2: __ccgo_ts + 16113, } var _azAlterType = [4]uintptr{ 0: __ccgo_ts + 19981, 1: __ccgo_ts + 19988, 2: __ccgo_ts + 20000, 3: __ccgo_ts + 20011, } var _azEnc = [4]uintptr{ 1: __ccgo_ts + 19186, 2: __ccgo_ts + 19191, 3: __ccgo_ts + 19199, } /* Shared library endings to try if zFile cannot be loaded as written */ var _azEndings = [1]uintptr{ 0: __ccgo_ts + 17588, } var _azErr = [5]uintptr{ 0: __ccgo_ts + 24624, 1: __ccgo_ts + 24677, 2: __ccgo_ts + 24179, 3: __ccgo_ts + 24728, 4: __ccgo_ts + 24780, } // C documentation // // /* // ** Column names appropriate for EXPLAIN or EXPLAIN QUERY PLAN. // */ var _azExplainColNames8 = [12]uintptr{ 0: __ccgo_ts + 5617, 1: __ccgo_ts + 5622, 2: __ccgo_ts + 5629, 3: __ccgo_ts + 5632, 4: __ccgo_ts + 5635, 5: __ccgo_ts + 5638, 6: __ccgo_ts + 5641, 7: __ccgo_ts + 5644, 8: __ccgo_ts + 5652, 9: __ccgo_ts + 5655, 10: __ccgo_ts + 5662, 11: __ccgo_ts + 5670, } var _azFormat = [2]uintptr{ 0: __ccgo_ts + 28988, 1: __ccgo_ts + 28999, } var _azInsType = [3]uintptr{ 0: __ccgo_ts + 26768, 1: __ccgo_ts + 26775, 2: __ccgo_ts + 26779, } var _azModeName = [6]uintptr{ 0: __ccgo_ts + 19154, 1: __ccgo_ts + 19161, 2: __ccgo_ts + 19169, 3: __ccgo_ts + 19173, 4: __ccgo_ts + 19037, 5: __ccgo_ts + 19182, } var _azModule = [4]uintptr{ 0: __ccgo_ts + 27366, 1: __ccgo_ts + 27376, 2: __ccgo_ts + 27386, 3: __ccgo_ts + 27397, } /* In SQLite core */ /* #include */ /* ** If building separately, we will need some setup that is normally ** found in sqliteInt.h */ /* Macro to check for 4-byte alignment. Only used inside of assert() */ /* #include */ /* #include */ /* #include */ /* #include */ /* The following macro is used to suppress compiler warnings. */ var _azName = [192]uintptr{ 0: __ccgo_ts + 1914, 1: __ccgo_ts + 1924, 2: __ccgo_ts + 1935, 3: __ccgo_ts + 1947, 4: __ccgo_ts + 1958, 5: __ccgo_ts + 1970, 6: __ccgo_ts + 1977, 7: __ccgo_ts + 1985, 8: __ccgo_ts + 1993, 9: __ccgo_ts + 1998, 10: __ccgo_ts + 2003, 11: __ccgo_ts + 2009, 12: __ccgo_ts + 2023, 13: __ccgo_ts + 2029, 14: __ccgo_ts + 2039, 15: __ccgo_ts + 2044, 16: __ccgo_ts + 2049, 17: __ccgo_ts + 2052, 18: __ccgo_ts + 2058, 19: __ccgo_ts + 2065, 20: __ccgo_ts + 2069, 21: __ccgo_ts + 2079, 22: __ccgo_ts + 2086, 23: __ccgo_ts + 2093, 24: __ccgo_ts + 2100, 25: __ccgo_ts + 2107, 26: __ccgo_ts + 2117, 27: __ccgo_ts + 2126, 28: __ccgo_ts + 2137, 29: __ccgo_ts + 2146, 30: __ccgo_ts + 2152, 31: __ccgo_ts + 2162, 32: __ccgo_ts + 2172, 33: __ccgo_ts + 2177, 34: __ccgo_ts + 2191, 35: __ccgo_ts + 2202, 36: __ccgo_ts + 2207, 37: __ccgo_ts + 2214, 38: __ccgo_ts + 2222, 39: __ccgo_ts + 2233, 40: __ccgo_ts + 2238, 41: __ccgo_ts + 2243, 42: __ccgo_ts + 2249, 43: __ccgo_ts + 2255, 44: __ccgo_ts + 2258, 45: __ccgo_ts + 2262, 46: __ccgo_ts + 2268, 47: __ccgo_ts + 2274, 48: __ccgo_ts + 2283, 49: __ccgo_ts + 2294, 50: __ccgo_ts + 2305, 51: __ccgo_ts + 2313, 52: __ccgo_ts + 2320, 53: __ccgo_ts + 2328, 54: __ccgo_ts + 2331, 55: __ccgo_ts + 2334, 56: __ccgo_ts + 2337, 57: __ccgo_ts + 2340, 58: __ccgo_ts + 2343, 59: __ccgo_ts + 2346, 60: __ccgo_ts + 2353, 61: __ccgo_ts + 2362, 62: __ccgo_ts + 2368, 63: __ccgo_ts + 2378, 64: __ccgo_ts + 2391, 65: __ccgo_ts + 2402, 66: __ccgo_ts + 2408, 67: __ccgo_ts + 2415, 68: __ccgo_ts + 2424, 69: __ccgo_ts + 2433, 70: __ccgo_ts + 2440, 71: __ccgo_ts + 2453, 72: __ccgo_ts + 2464, 73: __ccgo_ts + 2469, 74: __ccgo_ts + 2477, 75: __ccgo_ts + 2483, 76: __ccgo_ts + 2490, 77: __ccgo_ts + 2502, 78: __ccgo_ts + 2507, 79: __ccgo_ts + 2516, 80: __ccgo_ts + 2521, 81: __ccgo_ts + 2530, 82: __ccgo_ts + 2535, 83: __ccgo_ts + 2540, 84: __ccgo_ts + 2546, 85: __ccgo_ts + 2554, 86: __ccgo_ts + 2562, 87: __ccgo_ts + 2572, 88: __ccgo_ts + 2580, 89: __ccgo_ts + 2587, 90: __ccgo_ts + 2600, 91: __ccgo_ts + 2605, 92: __ccgo_ts + 2617, 93: __ccgo_ts + 2625, 94: __ccgo_ts + 2632, 95: __ccgo_ts + 2643, 96: __ccgo_ts + 2650, 97: __ccgo_ts + 2657, 98: __ccgo_ts + 2667, 99: __ccgo_ts + 2676, 100: __ccgo_ts + 2687, 101: __ccgo_ts + 2693, 102: __ccgo_ts + 2704, 103: __ccgo_ts + 2714, 104: __ccgo_ts + 2721, 105: __ccgo_ts + 2727, 106: __ccgo_ts + 2737, 107: __ccgo_ts + 2748, 108: __ccgo_ts + 2752, 109: __ccgo_ts + 2761, 110: __ccgo_ts + 2770, 111: __ccgo_ts + 2777, 112: __ccgo_ts + 2787, 113: __ccgo_ts + 2794, 114: __ccgo_ts + 2804, 115: __ccgo_ts + 2813, 116: __ccgo_ts + 2820, 117: __ccgo_ts + 2830, 118: __ccgo_ts + 2838, 119: __ccgo_ts + 2846, 120: __ccgo_ts + 2860, 121: __ccgo_ts + 2874, 122: __ccgo_ts + 2885, 123: __ccgo_ts + 2898, 124: __ccgo_ts + 2909, 125: __ccgo_ts + 2915, 126: __ccgo_ts + 2927, 127: __ccgo_ts + 2936, 128: __ccgo_ts + 2944, 129: __ccgo_ts + 2953, 130: __ccgo_ts + 2962, 131: __ccgo_ts + 2969, 132: __ccgo_ts + 2977, 133: __ccgo_ts + 2984, 134: __ccgo_ts + 2995, 135: __ccgo_ts + 3009, 136: __ccgo_ts + 3020, 137: __ccgo_ts + 3028, 138: __ccgo_ts + 3034, 139: __ccgo_ts + 3042, 140: __ccgo_ts + 3050, 141: __ccgo_ts + 3060, 142: __ccgo_ts + 3073, 143: __ccgo_ts + 3083, 144: __ccgo_ts + 3096, 145: __ccgo_ts + 3105, 146: __ccgo_ts + 3116, 147: __ccgo_ts + 3124, 148: __ccgo_ts + 3130, 149: __ccgo_ts + 3142, 150: __ccgo_ts + 3154, 151: __ccgo_ts + 3162, 152: __ccgo_ts + 3174, 153: __ccgo_ts + 3187, 154: __ccgo_ts + 3197, 155: __ccgo_ts + 3202, 156: __ccgo_ts + 3212, 157: __ccgo_ts + 3224, 158: __ccgo_ts + 3236, 159: __ccgo_ts + 3246, 160: __ccgo_ts + 3252, 161: __ccgo_ts + 3262, 162: __ccgo_ts + 3269, 163: __ccgo_ts + 3281, 164: __ccgo_ts + 3292, 165: __ccgo_ts + 3300, 166: __ccgo_ts + 3309, 167: __ccgo_ts + 3318, 168: __ccgo_ts + 3327, 169: __ccgo_ts + 3334, 170: __ccgo_ts + 3345, 171: __ccgo_ts + 3358, 172: __ccgo_ts + 3368, 173: __ccgo_ts + 3375, 174: __ccgo_ts + 3383, 175: __ccgo_ts + 3392, 176: __ccgo_ts + 3398, 177: __ccgo_ts + 3405, 178: __ccgo_ts + 3413, 179: __ccgo_ts + 3421, 180: __ccgo_ts + 3429, 181: __ccgo_ts + 3439, 182: __ccgo_ts + 3448, 183: __ccgo_ts + 3459, 184: __ccgo_ts + 3470, 185: __ccgo_ts + 3481, 186: __ccgo_ts + 3491, 187: __ccgo_ts + 3497, 188: __ccgo_ts + 3508, 189: __ccgo_ts + 3519, 190: __ccgo_ts + 3524, 191: __ccgo_ts + 3532, } var _azName1 = [3]uintptr{ 0: __ccgo_ts + 27799, 1: __ccgo_ts + 5655, 2: __ccgo_ts + 17967, } var _azName2 = [5]uintptr{ 0: __ccgo_ts + 40600, 1: __ccgo_ts + 37591, 2: __ccgo_ts + 27408, 3: __ccgo_ts + 38286, 4: __ccgo_ts + 13048, } var _azOne = [1]uintptr{ 0: __ccgo_ts + 11545, } var _azSql = [8]uintptr{ 0: __ccgo_ts + 27804, 1: __ccgo_ts + 27857, 2: __ccgo_ts + 27902, 3: __ccgo_ts + 27954, 4: __ccgo_ts + 28008, 5: __ccgo_ts + 28053, 6: __ccgo_ts + 28111, 7: __ccgo_ts + 28166, } // C documentation // // /* // ** Directories to consider for temp files. // */ var _azTempDirs = [6]uintptr{ 2: __ccgo_ts + 4001, 3: __ccgo_ts + 4010, 4: __ccgo_ts + 4019, 5: __ccgo_ts + 1743, } var _azType = [4]uintptr{ 0: __ccgo_ts + 5826, 1: __ccgo_ts + 5835, 2: __ccgo_ts + 5842, 3: __ccgo_ts + 5848, } var _azType1 = [6]uintptr{ 0: __ccgo_ts + 1704, 1: __ccgo_ts + 14378, 2: __ccgo_ts + 14384, 3: __ccgo_ts + 14389, 4: __ccgo_ts + 14394, 5: __ccgo_ts + 14384, } var _azType2 = [5]uintptr{ 0: __ccgo_ts + 6496, 1: __ccgo_ts + 6491, 2: __ccgo_ts + 8491, 3: __ccgo_ts + 8486, 4: __ccgo_ts + 1690, } var _azTypes = [5]uintptr{ 0: __ccgo_ts + 1174, 1: __ccgo_ts + 1186, 2: __ccgo_ts + 1191, 3: __ccgo_ts + 1169, 4: __ccgo_ts + 1705, } // C documentation // // /* // ** Check the integrity of the freelist or of an overflow page list. // ** Verify that the number of pages on the list is N. // */ func _checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage TPgno, N Tu32) { bp := tls.Alloc(48) defer tls.Free(48) var expected, n Tu32 var i, nErrAtStart int32 var iFreePage TPgno var pOvflData, v2 uintptr var _ /* pOvflPage at bp+0 */ uintptr _, _, _, _, _, _, _ = expected, i, iFreePage, n, nErrAtStart, pOvflData, v2 expected = N nErrAtStart = (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr for iPage != uint32(0) && (*TIntegrityCk)(unsafe.Pointer(pCheck)).FmxErr != 0 { if _checkRef(tls, pCheck, iPage) != 0 { break } N = N - 1 if _sqlite3PagerGet(tls, (*TIntegrityCk)(unsafe.Pointer(pCheck)).FpPager, iPage, bp, 0) != 0 { _checkAppendMsg(tls, pCheck, __ccgo_ts+4489, libc.VaList(bp+16, iPage)) break } pOvflData = _sqlite3PagerGetData(tls, **(**uintptr)(__ccgo_up(bp))) if isFreeList != 0 { n = _sqlite3Get4byte(tls, pOvflData+4) if (*TBtShared)(unsafe.Pointer((*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FautoVacuum != 0 { _checkPtrmap(tls, pCheck, iPage, uint8(PTRMAP_FREEPAGE), uint32(0)) } if n > (*TBtShared)(unsafe.Pointer((*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FusableSize/uint32(4)-uint32(2) { _checkAppendMsg(tls, pCheck, __ccgo_ts+4511, libc.VaList(bp+16, iPage)) N = N - 1 } else { i = 0 for { if !(i < libc.Int32FromUint32(n)) { break } iFreePage = _sqlite3Get4byte(tls, pOvflData+uintptr(int32(8)+i*int32(4))) if (*TBtShared)(unsafe.Pointer((*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FautoVacuum != 0 { _checkPtrmap(tls, pCheck, iFreePage, uint8(PTRMAP_FREEPAGE), uint32(0)) } _checkRef(tls, pCheck, iFreePage) goto _1 _1: ; i = i + 1 } N = N - n } } else { /* If this database supports auto-vacuum and iPage is not the last ** page in this overflow list, check that the pointer-map entry for ** the following page matches iPage. */ if (*TBtShared)(unsafe.Pointer((*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FautoVacuum != 0 && N > uint32(0) { i = libc.Int32FromUint32(_sqlite3Get4byte(tls, pOvflData)) _checkPtrmap(tls, pCheck, libc.Uint32FromInt32(i), uint8(PTRMAP_OVERFLOW2), iPage) } } iPage = _sqlite3Get4byte(tls, pOvflData) _sqlite3PagerUnref(tls, **(**uintptr)(__ccgo_up(bp))) } if N != 0 && nErrAtStart == (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr { if isFreeList != 0 { v2 = __ccgo_ts + 4550 } else { v2 = __ccgo_ts + 4555 } _checkAppendMsg(tls, pCheck, __ccgo_ts+4576, libc.VaList(bp+16, v2, expected-N, expected)) } } // C documentation // // /* // ** Check that the entry in the pointer-map for page iChild maps to // ** page iParent, pointer type ptrType. If not, append an error message // ** to pCheck. // */ func _checkPtrmap(tls *libc.TLS, pCheck uintptr, iChild TPgno, eType Tu8, iParent TPgno) { bp := tls.Alloc(64) defer tls.Free(64) var rc int32 var _ /* ePtrmapType at bp+0 */ Tu8 var _ /* iPtrmapParent at bp+4 */ TPgno _ = rc rc = _ptrmapGet(tls, (*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt, iChild, bp, bp+4) if rc != SQLITE_OK { if rc == int32(SQLITE_NOMEM) || rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)<zErrMsg. // ** Return 1 if there are 2 or more references to the page and 0 if // ** if this is the first reference to the page. // ** // ** Also check that the page number is in bounds. // */ func _checkRef(tls *libc.TLS, pCheck uintptr, iPage TPgno) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if iPage > (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnCkPage || iPage == uint32(0) { _checkAppendMsg(tls, pCheck, __ccgo_ts+4358, libc.VaList(bp+8, iPage)) return int32(1) } if _getPageReferenced(tls, pCheck, iPage) != 0 { _checkAppendMsg(tls, pCheck, __ccgo_ts+4381, libc.VaList(bp+8, iPage)) return int32(1) } _setPageReferenced(tls, pCheck, iPage) return 0 } // C documentation // // /* // ** The CONCAT(...) function. Generate a string result that is the // ** concatentation of all non-null arguments. // */ func _concatFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { _concatFuncCore(tls, context, argc, argv, 0, __ccgo_ts+1704) } var _detach_func = TFuncDef{ FnArg: int16(1), FfuncFlags: uint32(SQLITE_UTF8), FzName: __ccgo_ts + 13515, } func _disallowAggregatesInOrderByCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if libc.Int32FromUint8((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_AGG_FUNCTION) && (*TExpr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0) { _sqlite3ErrorMsg(tls, (*TWalker)(unsafe.Pointer(pWalker)).FpParse, __ccgo_ts+24433, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8)))) } return WRC_Continue } var _encnames = [4]uintptr{ 0: __ccgo_ts + 5263, 1: __ccgo_ts + 5265, 2: __ccgo_ts + 5267, 3: __ccgo_ts + 5272, } var _encnames1 = [9]struct { FzName uintptr Fenc Tu8 }{ 0: { FzName: __ccgo_ts + 19796, Fenc: uint8(SQLITE_UTF8), }, 1: { FzName: __ccgo_ts + 19801, Fenc: uint8(SQLITE_UTF8), }, 2: { FzName: __ccgo_ts + 19807, Fenc: uint8(SQLITE_UTF16LE), }, 3: { FzName: __ccgo_ts + 19816, Fenc: uint8(SQLITE_UTF16BE), }, 4: { FzName: __ccgo_ts + 19825, Fenc: uint8(SQLITE_UTF16LE), }, 5: { FzName: __ccgo_ts + 19833, Fenc: uint8(SQLITE_UTF16BE), }, 6: { FzName: __ccgo_ts + 19841, }, 7: { FzName: __ccgo_ts + 19848, }, 8: {}, } // C documentation // // /* // ** This routine is a helper for explainIndexRange() below // ** // ** pStr holds the text of an expression that we are building up one term // ** at a time. This routine adds a new term to the end of the expression. // ** Terms are separated by AND so add the "AND" text for second and subsequent // ** terms only. // */ func _explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, iTerm int32, bAnd int32, zOp uintptr) { var i int32 _ = i if bAnd != 0 { Xsqlite3_str_append(tls, pStr, __ccgo_ts+23629, int32(5)) } if nTerm > int32(1) { Xsqlite3_str_append(tls, pStr, __ccgo_ts+23635, int32(1)) } i = 0 for { if !(i < nTerm) { break } if i != 0 { Xsqlite3_str_append(tls, pStr, __ccgo_ts+14350, int32(1)) } Xsqlite3_str_appendall(tls, pStr, _explainIndexColumnName(tls, pIdx, iTerm+i)) goto _1 _1: ; i = i + 1 } if nTerm > int32(1) { Xsqlite3_str_append(tls, pStr, __ccgo_ts+5261, int32(1)) } Xsqlite3_str_append(tls, pStr, zOp, int32(1)) if nTerm > int32(1) { Xsqlite3_str_append(tls, pStr, __ccgo_ts+23635, int32(1)) } i = 0 for { if !(i < nTerm) { break } if i != 0 { Xsqlite3_str_append(tls, pStr, __ccgo_ts+14350, int32(1)) } Xsqlite3_str_append(tls, pStr, __ccgo_ts+5263, int32(1)) goto _2 _2: ; i = i + 1 } if nTerm > int32(1) { Xsqlite3_str_append(tls, pStr, __ccgo_ts+5261, int32(1)) } } // C documentation // // /* // ** Argument pLevel describes a strategy for scanning table pTab. This // ** function appends text to pStr that describes the subset of table // ** rows scanned by the strategy in the form of an SQL expression. // ** // ** For example, if the query: // ** // ** SELECT * FROM t1 WHERE a=1 AND b>2; // ** // ** is run and there is an index on (a, b), then this function returns a // ** string similar to: // ** // ** "a=? AND b>?" // */ func _explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var i, j int32 var nEq, nSkip Tu16 var pIndex, z, v2 uintptr _, _, _, _, _, _, _ = i, j, nEq, nSkip, pIndex, z, v2 pIndex = (*(*struct { FnEq Tu16 FnBtm Tu16 FnTop Tu16 FnDistinctCol Tu16 FpIndex uintptr FpOrderBy uintptr })(unsafe.Pointer(pLoop + 24))).FpIndex nEq = (*(*struct { FnEq Tu16 FnBtm Tu16 FnTop Tu16 FnDistinctCol Tu16 FpIndex uintptr FpOrderBy uintptr })(unsafe.Pointer(pLoop + 24))).FnEq nSkip = (*TWhereLoop)(unsafe.Pointer(pLoop)).FnSkip if libc.Int32FromUint16(nEq) == 0 && (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&libc.Uint32FromInt32(libc.Int32FromInt32(WHERE_BTM_LIMIT)|libc.Int32FromInt32(WHERE_TOP_LIMIT)) == uint32(0) { return } Xsqlite3_str_append(tls, pStr, __ccgo_ts+23637, int32(2)) i = 0 for { if !(i < libc.Int32FromUint16(nEq)) { break } z = _explainIndexColumnName(tls, pIndex, i) if i != 0 { Xsqlite3_str_append(tls, pStr, __ccgo_ts+23629, int32(5)) } if i >= libc.Int32FromUint16(nSkip) { v2 = __ccgo_ts + 23640 } else { v2 = __ccgo_ts + 23645 } Xsqlite3_str_appendf(tls, pStr, v2, libc.VaList(bp+8, z)) goto _1 _1: ; i = i + 1 } j = i if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_BTM_LIMIT) != 0 { _explainAppendTerm(tls, pStr, pIndex, libc.Int32FromUint16((*(*struct { FnEq Tu16 FnBtm Tu16 FnTop Tu16 FnDistinctCol Tu16 FpIndex uintptr FpOrderBy uintptr })(unsafe.Pointer(pLoop + 24))).FnBtm), j, i, __ccgo_ts+23653) i = int32(1) } if (*TWhereLoop)(unsafe.Pointer(pLoop)).FwsFlags&uint32(WHERE_TOP_LIMIT) != 0 { _explainAppendTerm(tls, pStr, pIndex, libc.Int32FromUint16((*(*struct { FnEq Tu16 FnBtm Tu16 FnTop Tu16 FnDistinctCol Tu16 FpIndex uintptr FpOrderBy uintptr })(unsafe.Pointer(pLoop + 24))).FnTop), j, i, __ccgo_ts+23655) } Xsqlite3_str_append(tls, pStr, __ccgo_ts+5261, int32(1)) } // C documentation // // /* // ** Unless an "EXPLAIN QUERY PLAN" command is being processed, this function // ** is a no-op. Otherwise, it adds a single row of output to the EQP result, // ** where the caption is of the form: // ** // ** "USE TEMP B-TREE FOR xxx" // ** // ** where xxx is one of "DISTINCT", "ORDER BY" or "GROUP BY". Exactly which // ** is determined by the zUsage argument. // */ func _explainTempTable(tls *libc.TLS, pParse uintptr, zUsage uintptr) { bp := tls.Alloc(16) defer tls.Free(16) _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20522, libc.VaList(bp+8, zUsage)) } /* ** Assign expression b to lvalue a. A second, no-op, version of this macro ** is provided when SQLITE_OMIT_EXPLAIN is defined. This allows the code ** in sqlite3Select() to assign values to structure member variables that ** only exist if SQLITE_OMIT_EXPLAIN is not defined without polluting the ** code with #ifndef directives. */ // C documentation // // /* // ** Implementation of the fts5() function used by clients to obtain the // ** API pointer. // */ func _fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { var pGlobal, ppApi uintptr _, _ = pGlobal, ppApi pGlobal = Xsqlite3_user_data(tls, pCtx) _ = nArg ppApi = Xsqlite3_value_pointer(tls, **(**uintptr)(__ccgo_up(apArg)), __ccgo_ts+40496) if ppApi != 0 { **(**uintptr)(__ccgo_up(ppApi)) = pGlobal } } func _fts5IndexCorruptIdx(tls *libc.TLS, pIdx uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) (*TFts5Index)(unsafe.Pointer(pIdx)).Frc = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)<iBtPage) is completed. // ** // ** The doclist-index for that term is currently stored in-memory within the // ** Fts5SegWriter.aDlidx[] array. If it is large enough, this function // ** writes it out to disk. Or, if it is too small to bother with, discards // ** it. // ** // ** Fts5SegWriter.btterm currently contains the first term on page iBtPage. // */ func _fts5WriteFlushBtree(tls *libc.TLS, p uintptr, pWriter uintptr) { var bFlag int32 var z, v1 uintptr _, _, _ = bFlag, z, v1 if (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FiBtPage == 0 { return } bFlag = _fts5WriteFlushDlidx(tls, p, pWriter) if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*TFts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fn > 0 { v1 = (*TFts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fp } else { v1 = __ccgo_ts + 1704 } z = v1 /* The following was already done in fts5WriteInit(): */ /* sqlite3_bind_int(p->pIdxWriter, 1, pWriter->iSegid); */ Xsqlite3_bind_blob(tls, (*TFts5Index)(unsafe.Pointer(p)).FpIdxWriter, int32(2), z, (*TFts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fn, libc.UintptrFromInt32(0)) Xsqlite3_bind_int64(tls, (*TFts5Index)(unsafe.Pointer(p)).FpIdxWriter, int32(3), int64(bFlag)+int64((*TFts5SegWriter)(unsafe.Pointer(pWriter)).FiBtPage)< (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yystack { _fts5yy_pop_parser_stack(tls, fts5yypParser) } /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+37090, 0) /******** End %stack_overflow code ********************************************/ (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument var */ } /* ** Print tracing information for a SHIFT action */ // C documentation // // /* // ** The following code executes when a syntax error first occurs. // */ func _fts5yy_syntax_error(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor int32, fts5yyminor TFts5Token) { bp := tls.Alloc(32) defer tls.Free(32) var pParse uintptr _ = pParse pParse = (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse /************ Begin %syntax_error code ****************************************/ _ = fts5yymajor /* Silence a compiler warning */ _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+37118, libc.VaList(bp+8, fts5yyminor.Fn, fts5yyminor.Fp)) /************ End %syntax_error code ******************************************/ (*Tfts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse /* Suppress warning about unused %extra_argument variable */ } // C documentation // // /* // ** Rtree virtual table module xBestIndex method. There are three // ** table scan strategies to choose from (in order from most to // ** least desirable): // ** // ** idxNum idxStr Strategy // ** ------------------------------------------------ // ** 1 "rowid" Direct lookup by rowid. // ** 2 "rtree" R-tree overlap query using geopoly_overlap() // ** 3 "rtree" R-tree within query using geopoly_within() // ** 4 "fullscan" full-table scan. // ** ------------------------------------------------ // */ func _geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) (r int32) { var iFuncTerm, iRowidTerm, idxNum, ii int32 var p uintptr _, _, _, _, _ = iFuncTerm, iRowidTerm, idxNum, ii, p iRowidTerm = -int32(1) iFuncTerm = -int32(1) idxNum = 0 _ = tab ii = 0 for { if !(ii < (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) { break } p = (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(ii)*12 if !((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fusable != 0) { goto _1 } if (*Tsqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn < 0 && libc.Int32FromUint8((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == int32(SQLITE_INDEX_CONSTRAINT_EQ) { iRowidTerm = ii break } if (*Tsqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn == 0 && libc.Int32FromUint8((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) >= int32(SQLITE_INDEX_CONSTRAINT_FUNCTION) { /* p->op==SQLITE_INDEX_CONSTRAINT_FUNCTION for geopoly_overlap() ** p->op==(SQLITE_INDEX_CONTRAINT_FUNCTION+1) for geopoly_within(). ** See geopolyFindFunction() */ iFuncTerm = ii idxNum = libc.Int32FromUint8((*Tsqlite3_index_constraint)(unsafe.Pointer(p)).Fop) - int32(SQLITE_INDEX_CONSTRAINT_FUNCTION) + int32(2) } goto _1 _1: ; ii = ii + 1 } if iRowidTerm >= 0 { (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(1) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 17967 (**(**Tsqlite3_index_constraint_usage)(__ccgo_up((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).FargvIndex = int32(1) (**(**Tsqlite3_index_constraint_usage)(__ccgo_up((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8))).Fomit = uint8(1) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(30) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(1) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxFlags = int32(SQLITE_INDEX_SCAN_UNIQUE) return SQLITE_OK } if iFuncTerm >= 0 { (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 29973 (**(**Tsqlite3_index_constraint_usage)(__ccgo_up((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).FargvIndex = int32(1) (**(**Tsqlite3_index_constraint_usage)(__ccgo_up((*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8))).Fomit = uint8(0) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(300) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(10) return SQLITE_OK } (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32(4) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = __ccgo_ts + 29979 (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(3e+06) (*Tsqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(100000) return SQLITE_OK } // C documentation // // /* // ** Report that geopoly_overlap() is an overloaded function suitable // ** for use in xBestIndex. // */ func _geopolyFindFunction(tls *libc.TLS, pVtab uintptr, nArg int32, zName uintptr, __ccgo_fp_pxFunc uintptr, ppArg uintptr) (r int32) { _ = pVtab _ = nArg if Xsqlite3_stricmp(tls, zName, __ccgo_ts+30028) == 0 { **(**uintptr)(__ccgo_up(__ccgo_fp_pxFunc)) = __ccgo_fp(_geopolyOverlapFunc) **(**uintptr)(__ccgo_up(ppArg)) = uintptr(0) return int32(SQLITE_INDEX_CONSTRAINT_FUNCTION) } if Xsqlite3_stricmp(tls, zName, __ccgo_ts+30044) == 0 { **(**uintptr)(__ccgo_up(__ccgo_fp_pxFunc)) = __ccgo_fp(_geopolyWithinFunc) **(**uintptr)(__ccgo_up(ppArg)) = uintptr(0) return libc.Int32FromInt32(SQLITE_INDEX_CONSTRAINT_FUNCTION) + libc.Int32FromInt32(1) } return 0 } // C documentation // // /* // ** SQL function: geopoly_json(X) // ** // ** Interpret X as a polygon and render it as a JSON array // ** of coordinates. Or, if X is not a valid polygon, return NULL. // */ func _geopolyJsonFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { bp := tls.Alloc(32) defer tls.Free(32) var db, p, x uintptr var i int32 _, _, _, _ = db, i, p, x p = _geopolyFuncParam(tls, context, **(**uintptr)(__ccgo_up(argv)), uintptr(0)) _ = argc if p != 0 { db = Xsqlite3_context_db_handle(tls, context) x = Xsqlite3_str_new(tls, db) Xsqlite3_str_append(tls, x, __ccgo_ts+26674, int32(1)) i = 0 for { if !(i < (*TGeoPoly)(unsafe.Pointer(p)).FnVertex) { break } Xsqlite3_str_appendf(tls, x, __ccgo_ts+29837, libc.VaList(bp+8, float64(**(**TGeoCoord)(__ccgo_up(p + 8 + uintptr(i*int32(2))*4))), float64(**(**TGeoCoord)(__ccgo_up(p + 8 + uintptr(i*int32(2)+int32(1))*4))))) goto _1 _1: ; i = i + 1 } Xsqlite3_str_appendf(tls, x, __ccgo_ts+29848, libc.VaList(bp+8, float64(**(**TGeoCoord)(__ccgo_up(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2))*4))), float64(**(**TGeoCoord)(__ccgo_up(p + 8 + uintptr(libc.Int32FromInt32(0)*libc.Int32FromInt32(2)+libc.Int32FromInt32(1))*4))))) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -int32(1), __ccgo_fp(Xsqlite3_free)) Xsqlite3_free(tls, p) } } // C documentation // // /* // ** Interpret the given string as an auto-vacuum mode value. // ** // ** The following strings, "none", "full" and "incremental" are // ** acceptable, as are their numeric equivalents: 0, 1 and 2 respectively. // */ func _getAutoVacuum(tls *libc.TLS, z uintptr) (r int32) { var i, v1 int32 _, _ = i, v1 if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+8512) { return BTREE_AUTOVACUUM_NONE } if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+19020) { return int32(BTREE_AUTOVACUUM_FULL) } if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+19025) { return int32(BTREE_AUTOVACUUM_INCR) } i = _sqlite3Atoi(tls, z) if i >= 0 && i <= int32(2) { v1 = i } else { v1 = 0 } return libc.Int32FromUint8(libc.Uint8FromInt32(v1)) } // C documentation // // /* // ** Interpret the given string as a locking mode value. // */ func _getLockingMode(tls *libc.TLS, z uintptr) (r int32) { if z != 0 { if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+19003) { return int32(PAGER_LOCKINGMODE_EXCLUSIVE) } if 0 == _sqlite3StrICmp(tls, z, __ccgo_ts+19013) { return PAGER_LOCKINGMODE_NORMAL } } return -int32(1) } func _groupConcatValue(tls *libc.TLS, context uintptr) { var pAccum, pGCC, zText uintptr _, _, _ = pAccum, pGCC, zText pGCC = Xsqlite3_aggregate_context(tls, context, 0) if pGCC != 0 { pAccum = pGCC if libc.Int32FromUint8((*TStrAccum)(unsafe.Pointer(pAccum)).FaccError) == int32(SQLITE_TOOBIG) { Xsqlite3_result_error_toobig(tls, context) } else { if libc.Int32FromUint8((*TStrAccum)(unsafe.Pointer(pAccum)).FaccError) == int32(SQLITE_NOMEM) { Xsqlite3_result_error_nomem(tls, context) } else { if (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FnAccum > 0 && (*TStrAccum)(unsafe.Pointer(pAccum)).FnChar == uint32(0) { Xsqlite3_result_text(tls, context, __ccgo_ts+1704, int32(1), libc.UintptrFromInt32(0)) } else { zText = Xsqlite3_str_value(tls, pAccum) Xsqlite3_result_text(tls, context, zText, libc.Int32FromUint32((*TStrAccum)(unsafe.Pointer(pAccum)).FnChar), uintptr(-libc.Int32FromInt32(1))) } } } } } // C documentation // // /* // ** Parameter zName is the name of a table that is about to be altered // ** (either with ALTER TABLE ... RENAME TO or ALTER TABLE ... ADD COLUMN). // ** If the table is a system table, this function leaves an error message // ** in pParse->zErr (system tables may not be altered) and returns non-zero. // ** // ** Or, if zName is not a system table, zero is returned. // */ func _isAlterableTable(tls *libc.TLS, pParse uintptr, pTab uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if 0 == Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6760, int32(7)) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != uint32(0) || (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb) != 0 { _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8647, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 } // C documentation // // /* // ** Return true if the pExpr term from the RETURNING clause argument // ** list is of the form "*". Raise an error if the terms if of the // ** form "table.*". // */ func _isAsteriskTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr) (r int32) { if libc.Int32FromUint8((*TExpr)(unsafe.Pointer(pTerm)).Fop) == int32(TK_ASTERISK) { return int32(1) } if libc.Int32FromUint8((*TExpr)(unsafe.Pointer(pTerm)).Fop) != int32(TK_DOT) { return 0 } if libc.Int32FromUint8((*TExpr)(unsafe.Pointer((*TExpr)(unsafe.Pointer(pTerm)).FpRight)).Fop) != int32(TK_ASTERISK) { return 0 } _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22526, 0) return int32(1) } // C documentation // // /* // ** Parameter pTab is the subject of an ALTER TABLE ... RENAME COLUMN // ** command. This function checks if the table is a view or virtual // ** table (columns of views or virtual tables may not be renamed). If so, // ** it loads an error message into pParse and returns non-zero. // ** // ** Or, if pTab is not a view or virtual table, zero is returned. // */ func _isRealTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iOp int32) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var azMsg [3]uintptr var zType uintptr _, _ = azMsg, zType zType = uintptr(0) if libc.Int32FromUint8((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { zType = __ccgo_ts + 11119 } if libc.Int32FromUint8((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { zType = __ccgo_ts + 11124 } if zType != 0 { azMsg = [3]uintptr{ 0: __ccgo_ts + 11138, 1: __ccgo_ts + 11156, 2: __ccgo_ts + 11173, } _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11193, libc.VaList(bp+8, azMsg[iOp], zType, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 } // C documentation // // /* // ** Return TRUE (non-zero) if zTab is a valid name for the schema table pTab. // */ func _isValidSchemaTableName(tls *libc.TLS, zTab uintptr, pTab uintptr, zDb uintptr) (r int32) { var zLegacy uintptr _ = zLegacy if Xsqlite3_strnicmp(tls, zTab, __ccgo_ts+6760, int32(7)) != 0 { return 0 } zLegacy = (*TTable)(unsafe.Pointer(pTab)).FzName if libc.Xstrcmp(tls, zLegacy+uintptr(7), __ccgo_ts+6768+7) == 0 { if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6787+7) == 0 { return int32(1) } if zDb == uintptr(0) { return 0 } if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6288+7) == 0 { return int32(1) } if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6806+7) == 0 { return int32(1) } } else { if _sqlite3StrICmp(tls, zTab+uintptr(7), __ccgo_ts+6806+7) == 0 { return int32(1) } } return 0 } // C documentation // // /* // ** Generate a path error. // ** // ** The specifics of the error are determined by the rc argument. // ** // ** rc error // ** ----------------- ---------------------- // ** JSON_LOOKUP_ARRAY "not an array" // ** JSON_LOOKUP_TOODEEP "JSON nested too deep" // ** JSON_LOOKUP_ERROR "malformed JSON" // ** otherwise... "bad JSON path" // ** // ** If ctx is not NULL then push the error message into ctx and return NULL. // ** If ctx is NULL, then return the text of the error message. // */ func _jsonBadPathError(tls *libc.TLS, ctx uintptr, zPath uintptr, rc int32) (r uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var zMsg uintptr _ = zMsg if rc == libc.Int32FromUint32(JSON_LOOKUP_NOTARRAY) { zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+26610, libc.VaList(bp+8, zPath)) } else { if rc == libc.Int32FromUint32(JSON_LOOKUP_ERROR) { zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+26462, 0) } else { if rc == libc.Int32FromUint32(JSON_LOOKUP_TOODEEP) { zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+26635, 0) } else { zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+26654, libc.VaList(bp+8, zPath)) } } } if ctx == uintptr(0) { return zMsg } if zMsg != 0 { Xsqlite3_result_error(tls, ctx, zMsg, -int32(1)) Xsqlite3_free(tls, zMsg) } else { Xsqlite3_result_error_nomem(tls, ctx) } return uintptr(0) } // C documentation // // /* // ** json_replace(JSON, PATH, VALUE, ...) // ** // ** Replace the value at PATH with VALUE. If PATH does not already exist, // ** this routine is a no-op. If JSON or PATH is malformed, throw an error. // */ func _jsonReplaceFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { if argc < int32(1) { return } if argc&int32(1) == 0 { _jsonWrongNumArgs(tls, ctx, __ccgo_ts+17072) return } _jsonInsertIntoBlob(tls, ctx, argc, argv, int32(JEDIT_REPL)) } // C documentation // // /* // ** Report the wrong number of arguments for json_insert(), json_replace() // ** or json_set(). // */ func _jsonWrongNumArgs(tls *libc.TLS, pCtx uintptr, zFuncName uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var zMsg uintptr _ = zMsg zMsg = Xsqlite3_mprintf(tls, __ccgo_ts+26508, libc.VaList(bp+8, zFuncName)) Xsqlite3_result_error(tls, pCtx, zMsg, -int32(1)) Xsqlite3_free(tls, zMsg) } /**************************************************************************** ** Utility routines for dealing with the binary BLOB representation of JSON ****************************************************************************/ // C documentation // // /* Human-readable names for the JSONB values. The index for each // ** string must correspond to the JSONB_* integer above. // */ var _jsonbType = [17]uintptr{ 0: __ccgo_ts + 1690, 1: __ccgo_ts + 8182, 2: __ccgo_ts + 8187, 3: __ccgo_ts + 6496, 4: __ccgo_ts + 6496, 5: __ccgo_ts + 6491, 6: __ccgo_ts + 6491, 7: __ccgo_ts + 8491, 8: __ccgo_ts + 8491, 9: __ccgo_ts + 8491, 10: __ccgo_ts + 8491, 11: __ccgo_ts + 26399, 12: __ccgo_ts + 26405, 13: __ccgo_ts + 1704, 14: __ccgo_ts + 1704, 15: __ccgo_ts + 1704, 16: __ccgo_ts + 1704, } // C documentation // // /* // ** Check a single element of the JSONB in pParse for validity. // ** // ** The element to be checked starts at offset i and must end at on the // ** last byte before iEnd. // ** // ** Return 0 if everything is correct. Return the 1-based byte offset of the // ** error if a problem is detected. (In other words, if the error is at offset // ** 0, return 1). // */ func _jsonbValidityCheck(tls *libc.TLS, pParse uintptr, i Tu32, iEnd Tu32, iDepth Tu32) (r Tu32) { bp := tls.Alloc(16) defer tls.Free(16) var cnt, j, k, n, sub, sub1, szC Tu32 var seen, x Tu8 var z uintptr var v1 uint32 var _ /* c at bp+4 */ Tu32 var _ /* sz at bp+0 */ Tu32 _, _, _, _, _, _, _, _, _, _, _ = cnt, j, k, n, seen, sub, sub1, szC, x, z, v1 if iDepth > uint32(JSON_MAX_DEPTH) { return i + uint32(1) } **(**Tu32)(__ccgo_up(bp)) = uint32(0) n = _jsonbPayloadSize(tls, pParse, i, bp) if n == uint32(0) { return i + uint32(1) } /* Checked by caller */ if i+n+**(**Tu32)(__ccgo_up(bp)) != iEnd { return i + uint32(1) } /* Checked by caller */ z = (*TJsonParse)(unsafe.Pointer(pParse)).FaBlob x = libc.Uint8FromInt32(libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(i)))) & int32(0x0f)) switch libc.Int32FromUint8(x) { case JSONB_NULL: fallthrough case int32(JSONB_TRUE): fallthrough case int32(JSONB_FALSE): if n+**(**Tu32)(__ccgo_up(bp)) == uint32(1) { v1 = uint32(0) } else { v1 = i + uint32(1) } return v1 case int32(JSONB_INT): if **(**Tu32)(__ccgo_up(bp)) < uint32(1) { return i + uint32(1) } j = i + n if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) == int32('-') { j = j + 1 if **(**Tu32)(__ccgo_up(bp)) < uint32(2) { return i + uint32(1) } } k = i + n + **(**Tu32)(__ccgo_up(bp)) for j < k { if libc.Int32FromUint8(_sqlite3CtypeMap[**(**Tu8)(__ccgo_up(z + uintptr(j)))])&int32(0x04) != 0 { j = j + 1 } else { return j + uint32(1) } } return uint32(0) case int32(JSONB_INT5): if **(**Tu32)(__ccgo_up(bp)) < uint32(3) { return i + uint32(1) } j = i + n if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) == int32('-') { if **(**Tu32)(__ccgo_up(bp)) < uint32(4) { return i + uint32(1) } j = j + 1 } if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) != int32('0') { return i + uint32(1) } if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1))))) != int32('x') && libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1))))) != int32('X') { return j + uint32(2) } j = j + uint32(2) k = i + n + **(**Tu32)(__ccgo_up(bp)) for j < k { if libc.Int32FromUint8(_sqlite3CtypeMap[**(**Tu8)(__ccgo_up(z + uintptr(j)))])&int32(0x08) != 0 { j = j + 1 } else { return j + uint32(1) } } return uint32(0) case int32(JSONB_FLOAT): fallthrough case int32(JSONB_FLOAT5): seen = uint8(0) /* 0: initial. 1: '.' seen 2: 'e' seen */ if **(**Tu32)(__ccgo_up(bp)) < uint32(2) { return i + uint32(1) } j = i + n k = j + **(**Tu32)(__ccgo_up(bp)) if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) == int32('-') { j = j + 1 if **(**Tu32)(__ccgo_up(bp)) < uint32(3) { return i + uint32(1) } } if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) == int32('.') { if libc.Int32FromUint8(x) == int32(JSONB_FLOAT) { return j + uint32(1) } if !(libc.Int32FromUint8(_sqlite3CtypeMap[**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1))))])&libc.Int32FromInt32(0x04) != 0) { return j + uint32(1) } j = j + uint32(2) seen = uint8(1) } else { if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) == int32('0') && libc.Int32FromUint8(x) == int32(JSONB_FLOAT) { if j+uint32(3) > k { return j + uint32(1) } if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1))))) != int32('.') && libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1))))) != int32('e') && libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1))))) != int32('E') { return j + uint32(1) } j = j + 1 } } for { if !(j < k) { break } if libc.Int32FromUint8(_sqlite3CtypeMap[**(**Tu8)(__ccgo_up(z + uintptr(j)))])&int32(0x04) != 0 { goto _2 } if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) == int32('.') { if libc.Int32FromUint8(seen) > 0 { return j + uint32(1) } if libc.Int32FromUint8(x) == int32(JSONB_FLOAT) && (j == k-uint32(1) || !(libc.Int32FromUint8(_sqlite3CtypeMap[**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1))))])&libc.Int32FromInt32(0x04) != 0)) { return j + uint32(1) } seen = uint8(1) goto _2 } if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) == int32('e') || libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) == int32('E') { if libc.Int32FromUint8(seen) == int32(2) { return j + uint32(1) } if j == k-uint32(1) { return j + uint32(1) } if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1))))) == int32('+') || libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1))))) == int32('-') { j = j + 1 if j == k-uint32(1) { return j + uint32(1) } } seen = uint8(2) goto _2 } return j + uint32(1) goto _2 _2: ; j = j + 1 } if libc.Int32FromUint8(seen) == 0 { return i + uint32(1) } return uint32(0) case int32(JSONB_TEXT): j = i + n k = j + **(**Tu32)(__ccgo_up(bp)) for j < k { if !(_jsonIsOk[**(**Tu8)(__ccgo_up(z + uintptr(j)))] != 0) && libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) != int32('\'') { return j + uint32(1) } j = j + 1 } return uint32(0) case int32(JSONB_TEXTJ): fallthrough case int32(JSONB_TEXT5): j = i + n k = j + **(**Tu32)(__ccgo_up(bp)) for j < k { if !(_jsonIsOk[**(**Tu8)(__ccgo_up(z + uintptr(j)))] != 0) && libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) != int32('\'') { if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) == int32('"') { if libc.Int32FromUint8(x) == int32(JSONB_TEXTJ) { return j + uint32(1) } } else { if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) <= int32(0x1f) { /* Control characters in JSON5 string literals are ok */ if libc.Int32FromUint8(x) == int32(JSONB_TEXTJ) { return j + uint32(1) } } else { if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) != int32('\\') || j+uint32(1) >= k { return j + uint32(1) } else { if libc.Xstrchr(tls, __ccgo_ts+26551, libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1)))))) != uintptr(0) { j = j + 1 } else { if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j+uint32(1))))) == int32('u') { if j+uint32(5) >= k { return j + uint32(1) } if !(_jsonIs4Hex(tls, z+uintptr(j+uint32(2))) != 0) { return j + uint32(1) } j = j + 1 } else { if libc.Int32FromUint8(x) != int32(JSONB_TEXT5) { return j + uint32(1) } else { **(**Tu32)(__ccgo_up(bp + 4)) = uint32(0) szC = _jsonUnescapeOneChar(tls, z+uintptr(j), k-j, bp+4) if **(**Tu32)(__ccgo_up(bp + 4)) == uint32(JSON_INVALID_CHAR) { return j + uint32(1) } j = j + (szC - uint32(1)) } } } } } } } j = j + 1 } return uint32(0) case int32(JSONB_TEXTRAW): return uint32(0) case int32(JSONB_ARRAY): j = i + n k = j + **(**Tu32)(__ccgo_up(bp)) for j < k { **(**Tu32)(__ccgo_up(bp)) = uint32(0) n = _jsonbPayloadSize(tls, pParse, j, bp) if n == uint32(0) { return j + uint32(1) } if j+n+**(**Tu32)(__ccgo_up(bp)) > k { return j + uint32(1) } sub = _jsonbValidityCheck(tls, pParse, j, j+n+**(**Tu32)(__ccgo_up(bp)), iDepth+uint32(1)) if sub != 0 { return sub } j = j + (n + **(**Tu32)(__ccgo_up(bp))) } return uint32(0) case int32(JSONB_OBJECT): cnt = uint32(0) j = i + n k = j + **(**Tu32)(__ccgo_up(bp)) for j < k { **(**Tu32)(__ccgo_up(bp)) = uint32(0) n = _jsonbPayloadSize(tls, pParse, j, bp) if n == uint32(0) { return j + uint32(1) } if j+n+**(**Tu32)(__ccgo_up(bp)) > k { return j + uint32(1) } if cnt&uint32(1) == uint32(0) { x = libc.Uint8FromInt32(libc.Int32FromUint8(**(**Tu8)(__ccgo_up(z + uintptr(j)))) & int32(0x0f)) if libc.Int32FromUint8(x) < int32(JSONB_TEXT) || libc.Int32FromUint8(x) > int32(JSONB_TEXTRAW) { return j + uint32(1) } } sub1 = _jsonbValidityCheck(tls, pParse, j, j+n+**(**Tu32)(__ccgo_up(bp)), iDepth+uint32(1)) if sub1 != 0 { return sub1 } cnt = cnt + 1 j = j + (n + **(**Tu32)(__ccgo_up(bp))) } if cnt&uint32(1) != uint32(0) { return j + uint32(1) } return uint32(0) default: return i + uint32(1) } return r } // C documentation // // /* // ** Load content from the sqlite_stat4 table into // ** the Index.aSample[] arrays of all indices. // */ func _loadStat4(tls *libc.TLS, db uintptr, zDb uintptr) (r int32) { var pStat4, v1 uintptr var rc int32 var v2 bool _, _, _, _ = pStat4, rc, v1, v2 rc = SQLITE_OK if v2 = (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0); v2 { v1 = _sqlite3FindTable(tls, db, __ccgo_ts+12863, zDb) pStat4 = v1 } if v2 && v1 != uintptr(0) && libc.Int32FromUint8((*TTable)(unsafe.Pointer(pStat4)).FeTabType) == TABTYP_NORM { rc = _loadStatTbl(tls, db, __ccgo_ts+13089, __ccgo_ts+13158, zDb) } return rc } // C documentation // // /* // ** Log an error that is an API call on a connection pointer that should // ** not have been used. The "type" of connection pointer is given as the // ** argument. The zType is a word like "NULL" or "closed" or "invalid". // */ func _logBadConnection(tls *libc.TLS, zType uintptr) { bp := tls.Alloc(16) defer tls.Free(16) Xsqlite3_log(tls, int32(SQLITE_MISUSE), __ccgo_ts+1852, libc.VaList(bp+8, zType)) } // C documentation // // /* // ** File control method. For custom operations on an memdb-file. // */ func _memdbFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var iLimit Tsqlite3_int64 var p uintptr var rc int32 _, _, _ = iLimit, p, rc p = (*TMemFile)(unsafe.Pointer(pFile)).FpStore rc = int32(SQLITE_NOTFOUND) _memdbEnter(tls, p) if op == int32(SQLITE_FCNTL_VFSNAME) { **(**uintptr)(__ccgo_up(pArg)) = Xsqlite3_mprintf(tls, __ccgo_ts+4122, libc.VaList(bp+8, (*TMemStore)(unsafe.Pointer(p)).FaData, (*TMemStore)(unsafe.Pointer(p)).Fsz)) rc = SQLITE_OK } if op == int32(SQLITE_FCNTL_SIZE_LIMIT) { iLimit = **(**Tsqlite3_int64)(__ccgo_up(pArg)) if iLimit < (*TMemStore)(unsafe.Pointer(p)).Fsz { if iLimit < 0 { iLimit = (*TMemStore)(unsafe.Pointer(p)).FszMax } else { iLimit = (*TMemStore)(unsafe.Pointer(p)).Fsz } } (*TMemStore)(unsafe.Pointer(p)).FszMax = iLimit **(**Tsqlite3_int64)(__ccgo_up(pArg)) = iLimit rc = SQLITE_OK } _memdbLeave(tls, p) return rc } var _memdb_vfs = Tsqlite3_vfs{ FiVersion: int32(2), FmxPathname: int32(1024), FzName: __ccgo_ts + 4116, } // C documentation // // /* // ** Handle the special case of a compound-select that originates from a // ** VALUES clause. By handling this as a special case, we avoid deep // ** recursion, and thus do not need to enforce the SQLITE_LIMIT_COMPOUND_SELECT // ** on a VALUES clause. // ** // ** Because the Select object originates from a VALUES clause: // ** (1) There is no LIMIT or OFFSET or else there is a LIMIT of exactly 1 // ** (2) All terms are UNION ALL // ** (3) There is no ORDER BY clause // ** // ** The "LIMIT of exactly 1" case of condition (1) comes about when a VALUES // ** clause occurs within scalar expression (ex: "SELECT (VALUES(1),(2),(3))"). // ** The sqlite3CodeSubselect will have added the LIMIT 1 clause in tht case. // ** Since the limit is exactly 1, we only need to evaluate the left-most VALUES. // */ func _multiSelectValues(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var bShowAll, nRow, rc int32 var v1 uintptr _, _, _, _ = bShowAll, nRow, rc, v1 nRow = int32(1) rc = 0 bShowAll = libc.BoolInt32((*TSelect)(unsafe.Pointer(p)).FpLimit == uintptr(0)) for cond := true; cond; cond = int32(1) != 0 { if (*TSelect)(unsafe.Pointer(p)).FpWin != 0 { return -int32(1) } if (*TSelect)(unsafe.Pointer(p)).FpPrior == uintptr(0) { break } p = (*TSelect)(unsafe.Pointer(p)).FpPrior nRow = nRow + bShowAll } if nRow == int32(1) { v1 = __ccgo_ts + 1704 } else { v1 = __ccgo_ts + 20809 } _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+20811, libc.VaList(bp+8, nRow, v1)) for p != 0 { _selectInnerLoop(tls, pParse, p, -int32(1), uintptr(0), uintptr(0), pDest, int32(1), int32(1)) if !(bShowAll != 0) { break } (*TSelect)(unsafe.Pointer(p)).FnSelectRow = int16(nRow) p = (*TSelect)(unsafe.Pointer(p)).FpNext } return rc } // C documentation // // /* // ** Report an error that an expression is not valid for some set of // ** pNC->ncFlags values determined by validMask. // ** // ** static void notValid( // ** Parse *pParse, // Leave error message here // ** NameContext *pNC, // The name context // ** const char *zMsg, // Type of error // ** int validMask, // Set of contexts for which prohibited // ** Expr *pExpr // Invalidate this expression on error // ** ){...} // ** // ** As an optimization, since the conditional is almost always false // ** (because errors are rare), the conditional is moved outside of the // ** function call using a macro. // */ func _notValidImpl(tls *libc.TLS, pParse uintptr, pNC uintptr, zMsg uintptr, pExpr uintptr, pError uintptr) { bp := tls.Alloc(32) defer tls.Free(32) var zIn uintptr _ = zIn zIn = __ccgo_ts + 7102 if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IdxExpr) != 0 { zIn = __ccgo_ts + 7130 } else { if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_IsCheck) != 0 { zIn = __ccgo_ts + 7148 } else { if (*TNameContext)(unsafe.Pointer(pNC)).FncFlags&int32(NC_GenCol) != 0 { zIn = __ccgo_ts + 7166 } } } _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7184, libc.VaList(bp+8, zMsg, zIn)) if pExpr != 0 { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) } _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pError) } // C documentation // // /* // ** Implementation of ntile(). This assumes that the window frame has // ** been coerced to: // ** // ** ROWS CURRENT ROW AND UNBOUNDED FOLLOWING // */ func _ntileStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { var p uintptr _ = p _ = nArg p = Xsqlite3_aggregate_context(tls, pCtx, int32(24)) if p != 0 { if (*TNtileCtx)(unsafe.Pointer(p)).FnTotal == 0 { (*TNtileCtx)(unsafe.Pointer(p)).FnParam = Xsqlite3_value_int64(tls, **(**uintptr)(__ccgo_up(apArg))) if (*TNtileCtx)(unsafe.Pointer(p)).FnParam <= 0 { Xsqlite3_result_error(tls, pCtx, __ccgo_ts+24235, -int32(1)) } } (*TNtileCtx)(unsafe.Pointer(p)).FnTotal = (*TNtileCtx)(unsafe.Pointer(p)).FnTotal + 1 } } // C documentation // // /* // ** Attempt to parse the given string into a julian day number. Return // ** the number of errors. // ** // ** The following are acceptable forms for the input string: // ** // ** YYYY-MM-DD HH:MM:SS.FFF +/-HH:MM // ** DDDD.DD // ** now // ** // ** In the first form, the +/-HH:MM is always optional. The fractional // ** seconds extension (the ".FFF") is optional. The seconds portion // ** (":SS.FFF") is option. The year and date can be omitted as long // ** as there is a time string. The time string can be omitted as long // ** as there is a year and date. // */ func _parseDateOrTime(tls *libc.TLS, context uintptr, zDate uintptr, p uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* r at bp+0 */ float64 if _parseYyyyMmDd(tls, zDate, p) == 0 { return 0 } else { if _parseHhMmSs(tls, zDate, p) == 0 { return 0 } else { if _sqlite3StrICmp(tls, zDate, __ccgo_ts+1228) == 0 && _sqlite3NotPureFunc(tls, context) != 0 { return _setDateTimeToCurrent(tls, context, p) } else { if _sqlite3AtoF(tls, zDate, bp) > 0 { _setRawDateNumber(tls, p, **(**float64)(__ccgo_up(bp))) return 0 } else { if (_sqlite3StrICmp(tls, zDate, __ccgo_ts+1232) == 0 || _sqlite3StrICmp(tls, zDate, __ccgo_ts+1239) == 0) && _sqlite3NotPureFunc(tls, context) != 0 { libc.SetBitFieldPtr8Uint32(p+44, libc.Uint32FromInt32(1), 2, 0x4) return _setDateTimeToCurrent(tls, context, p) } } } } } return int32(1) } /* The julian day number for 9999-12-31 23:59:59.999 is 5373484.4999999. ** Multiplying this by 86400000 gives 464269060799999 as the maximum value ** for DateTime.iJD. ** ** But some older compilers (ex: gcc 4.2.1 on older Macs) cannot deal with ** such a large integer literal, so we have to encode it. */ // C documentation // // /* Add a single new term to an ExprList that is used to store a // ** list of identifiers. Report an error if the ID list contains // ** a COLLATE clause or an ASC or DESC keyword, except ignore the // ** error while parsing a legacy schema. // */ func _parserAddExprIdListTerm(tls *libc.TLS, pParse uintptr, pPrior uintptr, pIdToken uintptr, hasCollate int32, sortOrder int32) (r uintptr) { bp := tls.Alloc(32) defer tls.Free(32) var p uintptr _ = p p = _sqlite3ExprListAppend(tls, pParse, pPrior, uintptr(0)) if (hasCollate != 0 || sortOrder != -int32(1)) && libc.Int32FromUint8((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Finit1.Fbusy) == 0 { _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+24945, libc.VaList(bp+8, (*TToken)(unsafe.Pointer(pIdToken)).Fn, (*TToken)(unsafe.Pointer(pIdToken)).Fz)) } _sqlite3ExprListSetName(tls, pParse, p, pIdToken, int32(1)) return p } /**************** End of %include directives **********************************/ /* These constants specify the various numeric values for terminal symbols. ***************** Begin token definitions *************************************/ /**************** End token definitions ***************************************/ // C documentation // // /* // ** Generate a syntax error // */ func _parserSyntaxError(tls *libc.TLS, pParse uintptr, p uintptr) { bp := tls.Alloc(16) defer tls.Free(16) _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+24830, libc.VaList(bp+8, p)) } // C documentation // // /* Names of columns for pragmas that return multi-column result // ** or that return single-column results where the name of the // ** result column is different from the name of the pragma // */ var _pragCName = [57]uintptr{ 0: __ccgo_ts + 5652, 1: __ccgo_ts + 17784, 2: __ccgo_ts + 9381, 3: __ccgo_ts + 17788, 4: __ccgo_ts + 17793, 5: __ccgo_ts + 17796, 6: __ccgo_ts + 17806, 7: __ccgo_ts + 17816, 8: __ccgo_ts + 17822, 9: __ccgo_ts + 17826, 10: __ccgo_ts + 17831, 11: __ccgo_ts + 17836, 12: __ccgo_ts + 17844, 13: __ccgo_ts + 17855, 14: __ccgo_ts + 17858, 15: __ccgo_ts + 17826, 16: __ccgo_ts + 17865, 17: __ccgo_ts + 17831, 18: __ccgo_ts + 17873, 19: __ccgo_ts + 17877, 20: __ccgo_ts + 17882, 21: __ccgo_ts + 17888, 22: __ccgo_ts + 17826, 23: __ccgo_ts + 17831, 24: __ccgo_ts + 17895, 25: __ccgo_ts + 17900, 26: __ccgo_ts + 17903, 27: __ccgo_ts + 17910, 28: __ccgo_ts + 17822, 29: __ccgo_ts + 17826, 30: __ccgo_ts + 17916, 31: __ccgo_ts + 17921, 32: __ccgo_ts + 17926, 33: __ccgo_ts + 17784, 34: __ccgo_ts + 17826, 35: __ccgo_ts + 17930, 36: __ccgo_ts + 17937, 37: __ccgo_ts + 17944, 38: __ccgo_ts + 13052, 39: __ccgo_ts + 13048, 40: __ccgo_ts + 17952, 41: __ccgo_ts + 17957, 42: __ccgo_ts + 17962, 43: __ccgo_ts + 9381, 44: __ccgo_ts + 17967, 45: __ccgo_ts + 5655, 46: __ccgo_ts + 17973, 47: __ccgo_ts + 17978, 48: __ccgo_ts + 17169, 49: __ccgo_ts + 17983, 50: __ccgo_ts + 17784, 51: __ccgo_ts + 17826, 52: __ccgo_ts + 17996, 53: __ccgo_ts + 18001, 54: __ccgo_ts + 18010, 55: __ccgo_ts + 18017, 56: __ccgo_ts + 18028, } // C documentation // // /* // ** Create zero or more entries in the output for the SQL functions // ** defined by FuncDef p. // */ func _pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, showInternFuncs int32) { bp := tls.Alloc(64) defer tls.Free(64) var mask Tu32 var zType uintptr _, _ = mask, zType mask = libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_INNOCUOUS) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL)) if showInternFuncs != 0 { mask = uint32(0xffffffff) } for { if !(p != 0) { break } if (*TFuncDef)(unsafe.Pointer(p)).FxSFunc == uintptr(0) { goto _1 } if (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_INTERNAL) != uint32(0) && showInternFuncs == 0 { goto _1 } if (*TFuncDef)(unsafe.Pointer(p)).FxValue != uintptr(0) { zType = __ccgo_ts + 19207 } else { if (*TFuncDef)(unsafe.Pointer(p)).FxFinalize != uintptr(0) { zType = __ccgo_ts + 19209 } else { zType = __ccgo_ts + 7913 } } _sqlite3VdbeMultiLoad(tls, v, int32(1), __ccgo_ts+19211, libc.VaList(bp+8, (*TFuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, _azEnc[(*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&uint32(SQLITE_FUNC_ENCMASK)], int32((*TFuncDef)(unsafe.Pointer(p)).FnArg), (*TFuncDef)(unsafe.Pointer(p)).FfuncFlags&mask^uint32(SQLITE_INNOCUOUS))) goto _1 _1: ; p = (*TFuncDef)(unsafe.Pointer(p)).FpNext } } // C documentation // // /* // ** The SELECT statement iterating through the keys for the current object // ** (p->objiter.pSelect) currently points to a valid row. However, there // ** is something wrong with the rbu_control value in the rbu_control value // ** stored in the (p->nCol+1)'th column. Set the error code and error message // ** of the RBU handle to something reflecting this. // */ func _rbuBadControlError(tls *libc.TLS, p uintptr) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_ERROR) (*Tsqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+31746, 0) } // C documentation // // /* // ** If there is a "*-oal" file in the file-system corresponding to the // ** target database in the file-system, delete it. If an error occurs, // ** leave an error code and error message in the rbu handle. // */ func _rbuDeleteOalFile(tls *libc.TLS, p uintptr) { bp := tls.Alloc(32) defer tls.Free(32) var zOal uintptr var _ /* pVfs at bp+0 */ uintptr _ = zOal zOal = _rbuMPrintf(tls, p, __ccgo_ts+33752, libc.VaList(bp+16, (*Tsqlite3rbu)(unsafe.Pointer(p)).FzTarget)) if zOal != 0 { **(**uintptr)(__ccgo_up(bp)) = uintptr(0) Xsqlite3_file_control(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+6820, int32(SQLITE_FCNTL_VFS_POINTER), bp) (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp)))).FxDelete})))(tls, **(**uintptr)(__ccgo_up(bp)), zOal, 0) Xsqlite3_free(tls, zOal) } } // C documentation // // /* // ** Return true if the database handle passed as the only argument // ** was opened with the rbu_exclusive_checkpoint=1 URI parameter // ** specified. Or false otherwise. // */ func _rbuExclusiveCheckpoint(tls *libc.TLS, db uintptr) (r int32) { var zUri uintptr _ = zUri zUri = Xsqlite3_db_filename(tls, db, uintptr(0)) return Xsqlite3_uri_boolean(tls, zUri, __ccgo_ts+33727, 0) } // C documentation // // /* // ** Take an EXCLUSIVE lock on the database file. Return SQLITE_OK if // ** successful, or an SQLite error code otherwise. // */ func _rbuLockDatabase(tls *libc.TLS, db uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var rc int32 var _ /* fd at bp+0 */ uintptr _ = rc rc = SQLITE_OK **(**uintptr)(__ccgo_up(bp)) = uintptr(0) Xsqlite3_file_control(tls, db, __ccgo_ts+6820, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) if **(**uintptr)(__ccgo_up(bp)) != 0 { Xsqlite3_file_control(tls, db, __ccgo_ts+6820, int32(SQLITE_FCNTL_FILE_POINTER), bp) rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp)))).FpMethods)).FxLock})))(tls, **(**uintptr)(__ccgo_up(bp)), int32(SQLITE_LOCK_SHARED)) if rc == SQLITE_OK { rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp)))).FpMethods)).FxUnlock})))(tls, **(**uintptr)(__ccgo_up(bp)), SQLITE_LOCK_NONE) } Xsqlite3_file_control(tls, db, __ccgo_ts+6820, int32(RBU_ZIPVFS_CTRL_FILE_POINTER), bp) } else { Xsqlite3_file_control(tls, db, __ccgo_ts+6820, int32(SQLITE_FCNTL_FILE_POINTER), bp) } if rc == SQLITE_OK && (*Tsqlite3_file)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp)))).FpMethods != 0 { rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp)))).FpMethods)).FxLock})))(tls, **(**uintptr)(__ccgo_up(bp)), int32(SQLITE_LOCK_SHARED)) if rc == SQLITE_OK { rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp)))).FpMethods)).FxLock})))(tls, **(**uintptr)(__ccgo_up(bp)), int32(SQLITE_LOCK_EXCLUSIVE)) } } return rc } // C documentation // // /* // ** This function is called as part of initializing or reinitializing an // ** incremental checkpoint. // ** // ** It populates the sqlite3rbu.aFrame[] array with the set of // ** (wal frame -> db page) copy operations required to checkpoint the // ** current wal file, and obtains the set of shm locks required to safely // ** perform the copy operations directly on the file-system. // ** // ** If argument pState is not NULL, then the incremental checkpoint is // ** being resumed. In this case, if the checksum of the wal-index-header // ** following recovery is not the same as the checksum saved in the RbuState // ** object, then the rbu handle is set to DONE state. This occurs if some // ** other client appends a transaction to the wal file in the middle of // ** an incremental checkpoint. // */ func _rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { var nSectorSize, rc2, v1 int32 var pDb, pWal uintptr _, _, _, _, _ = nSectorSize, pDb, pWal, rc2, v1 /* If pState is NULL, then the wal file may not have been opened and ** recovered. Running a read-statement here to ensure that doing so ** does not interfere with the "capture" process below. */ if pState == uintptr(0) { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = 0 if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+33646, uintptr(0), uintptr(0), uintptr(0)) } } /* Assuming no error has occurred, run a "restart" checkpoint with the ** sqlite3rbu.eStage variable set to CAPTURE. This turns on the following ** special behaviour in the rbu VFS: ** ** * If the exclusive shm WRITER or READ0 lock cannot be obtained, ** the checkpoint fails with SQLITE_BUSY (normally SQLite would ** proceed with running a passive checkpoint instead of failing). ** ** * Attempts to read from the *-wal file or write to the database file ** do not perform any IO. Instead, the frame/page combinations that ** would be read/written are recorded in the sqlite3rbu.aFrame[] ** array. ** ** * Calls to xShmLock(UNLOCK) to release the exclusive shm WRITER, ** READ0 and CHECKPOINT locks taken as part of the checkpoint are ** no-ops. These locks will not be released until the connection ** is closed. ** ** * Attempting to xSync() the database file causes an SQLITE_NOTICE ** error. ** ** As a result, unless an error (i.e. OOM or SQLITE_BUSY) occurs, the ** checkpoint below fails with SQLITE_NOTICE, and leaves the aFrame[] ** array populated with a set of (frame -> page) mappings. Because the ** WRITER, CHECKPOINT and READ0 locks are still held, it is safe to copy ** data from the wal file into the database file according to the ** contents of aFrame[]. */ if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CAPTURE) rc2 = Xsqlite3_exec(tls, (*Tsqlite3rbu)(unsafe.Pointer(p)).FdbMain, __ccgo_ts+33692, uintptr(0), uintptr(0), uintptr(0)) if rc2 != int32(SQLITE_NOTICE) { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK && (*Tsqlite3rbu)(unsafe.Pointer(p)).FnFrame > 0 { (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_CKPT) if pState != 0 { v1 = (*TRbuState)(unsafe.Pointer(pState)).FnRow } else { v1 = 0 } (*Tsqlite3rbu)(unsafe.Pointer(p)).FnStep = v1 (*Tsqlite3rbu)(unsafe.Pointer(p)).FaBuf = _rbuMalloc(tls, p, int64((*Tsqlite3rbu)(unsafe.Pointer(p)).Fpgsz)) (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum = _rbuShmChecksum(tls, p) } if (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Tsqlite3rbu)(unsafe.Pointer(p)).FnFrame == 0 || pState != 0 && (*TRbuState)(unsafe.Pointer(pState)).FiWalCksum != (*Tsqlite3rbu)(unsafe.Pointer(p)).FiWalCksum { (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = int32(SQLITE_DONE) (*Tsqlite3rbu)(unsafe.Pointer(p)).FeStage = int32(RBU_STAGE_DONE) } else { pDb = (*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpReal pWal = (*Trbu_file)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer((*Tsqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd)).FpReal nSectorSize = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(pDb)).FpMethods)).FxSectorSize})))(tls, pDb) if nSectorSize > (*Tsqlite3rbu)(unsafe.Pointer(p)).Fpgsz { (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPagePerSector = nSectorSize / (*Tsqlite3rbu)(unsafe.Pointer(p)).Fpgsz } else { (*Tsqlite3rbu)(unsafe.Pointer(p)).FnPagePerSector = int32(1) } /* Call xSync() on the wal file. This causes SQLite to sync the ** directory in which the target database and the wal file reside, in ** case it has not been synced since the rename() call in ** rbuMoveOalFile(). */ (*Tsqlite3rbu)(unsafe.Pointer(p)).Frc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_io_methods)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer(pWal)).FpMethods)).FxSync})))(tls, pWal, int32(SQLITE_SYNC_NORMAL)) } } } // C documentation // // /* // ** File control method. For custom operations on an rbuVfs-file. // */ func _rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var p, pRbu, pRbu1, pRbuVfs, xControl, zIn, zOut uintptr var rc int32 var _ /* dummy at bp+0 */ uintptr _, _, _, _, _, _, _, _ = p, pRbu, pRbu1, pRbuVfs, rc, xControl, zIn, zOut p = pFile xControl = (*Tsqlite3_io_methods)(unsafe.Pointer((*Tsqlite3_file)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods)).FxFileControl if op == int32(SQLITE_FCNTL_RBU) { pRbu = pArg /* First try to find another RBU vfs lower down in the vfs stack. If ** one is found, this vfs will operate in pass-through mode. The lower ** level vfs will do the special RBU handling. */ rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xControl})))(tls, (*Trbu_file)(unsafe.Pointer(p)).FpReal, op, pArg) if rc == int32(SQLITE_NOTFOUND) { /* Now search for a zipvfs instance lower down in the VFS stack. If ** one is found, this is an error. */ **(**uintptr)(__ccgo_up(bp)) = uintptr(0) rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xControl})))(tls, (*Trbu_file)(unsafe.Pointer(p)).FpReal, int32(SQLITE_FCNTL_ZIPVFS), bp) if rc == SQLITE_OK { rc = int32(SQLITE_ERROR) (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, __ccgo_ts+34711, 0) } else { if rc == int32(SQLITE_NOTFOUND) { (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FpTargetFd = p (*Trbu_file)(unsafe.Pointer(p)).FpRbu = pRbu _rbuMainlistAdd(tls, p) if (*Trbu_file)(unsafe.Pointer(p)).FpWalFd != 0 { (*Trbu_file)(unsafe.Pointer((*Trbu_file)(unsafe.Pointer(p)).FpWalFd)).FpRbu = pRbu } rc = SQLITE_OK } } } return rc } else { if op == int32(SQLITE_FCNTL_RBUCNT) { pRbu1 = pArg (*Tsqlite3rbu)(unsafe.Pointer(pRbu1)).FnRbu = (*Tsqlite3rbu)(unsafe.Pointer(pRbu1)).FnRbu + 1 (*Tsqlite3rbu)(unsafe.Pointer(pRbu1)).FpRbuFd = p (*Trbu_file)(unsafe.Pointer(p)).FbNolock = uint8(1) } } rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{xControl})))(tls, (*Trbu_file)(unsafe.Pointer(p)).FpReal, op, pArg) if rc == SQLITE_OK && op == int32(SQLITE_FCNTL_VFSNAME) { pRbuVfs = (*Trbu_file)(unsafe.Pointer(p)).FpRbuVfs zIn = **(**uintptr)(__ccgo_up(pArg)) zOut = Xsqlite3_mprintf(tls, __ccgo_ts+34734, libc.VaList(bp+16, (*Trbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) **(**uintptr)(__ccgo_up(pArg)) = zOut if zOut == uintptr(0) { rc = int32(SQLITE_NOMEM) } } return rc } // C documentation // // /* // ** Generate VM code to replace any double-quoted strings (but not double-quoted // ** identifiers) within the "sql" column of the sqlite_schema table in // ** database zDb with their single-quoted equivalents. If argument bTemp is // ** not true, similarly update all SQL statements in the sqlite_schema table // ** of the temp db. // */ func _renameFixQuotes(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32) { bp := tls.Alloc(32) defer tls.Free(32) _sqlite3NestedParse(tls, pParse, __ccgo_ts+9024, libc.VaList(bp+8, zDb, zDb)) if bTemp == 0 { _sqlite3NestedParse(tls, pParse, __ccgo_ts+9171, 0) } } // C documentation // // /* // ** Generate an ORDER BY or GROUP BY term out-of-range error. // */ func _resolveOutOfRangeError(tls *libc.TLS, pParse uintptr, zType uintptr, i int32, mx int32, pError uintptr) { bp := tls.Alloc(32) defer tls.Free(32) _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7573, libc.VaList(bp+8, i, zType, mx)) _sqlite3RecordErrorOffsetOfExpr(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, pError) } // C documentation // // /* // ** Close a file descriptor. // ** // ** We assume that close() almost always works, since it is only in a // ** very sick application or on a very sick platform that it might fail. // ** If it does fail, simply leak the file descriptor, but do log the // ** error. // ** // ** Note that it is not safe to retry close() after EINTR since the // ** file descriptor might have already been reused by another thread. // ** So we don't even try to recover from an EINTR. Just log the error // ** and move on. // */ func _robust_close(tls *libc.TLS, pFile uintptr, h int32, lineno int32) { var v1 uintptr _ = v1 if (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(1)].FpCurrent})))(tls, h) != 0 { if pFile != 0 { v1 = (*TunixFile)(unsafe.Pointer(pFile)).FzPath } else { v1 = uintptr(0) } _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(16)<x2 conditions) and adds an error message to the RtreeCheck object // ** if they are not. // ** // ** Additionally, if pParent is not NULL, then it is assumed to point to // ** the array of coordinates on the parent page that bound the page // ** containing pCell. In this case it is also verified that the two // ** sets of coordinates are mutually consistent and an error message added // ** to the RtreeCheck object if they are not. // */ func _rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode Ti64, iCell int32, pCell uintptr, pParent uintptr) { bp := tls.Alloc(48) defer tls.Free(48) var i, v2, v3 int32 var v5 bool var _ /* c1 at bp+0 */ TRtreeCoord var _ /* c2 at bp+4 */ TRtreeCoord var _ /* p1 at bp+8 */ TRtreeCoord var _ /* p2 at bp+12 */ TRtreeCoord _, _, _, _ = i, v2, v3, v5 i = 0 for { if !(i < (*TRtreeCheck)(unsafe.Pointer(pCheck)).FnDim) { break } _readCoord(tls, pCell+uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(2)*i), bp) _readCoord(tls, pCell+uintptr(int32(4)*(int32(2)*i+int32(1))), bp+4) /* printf("%e, %e\n", c1.u.f, c2.u.f); */ if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FbInt != 0 { v2 = libc.BoolInt32(*(*int32)(unsafe.Pointer(bp)) > *(*int32)(unsafe.Pointer(bp + 4))) } else { v2 = libc.BoolInt32(*(*TRtreeValue)(unsafe.Pointer(bp)) > *(*TRtreeValue)(unsafe.Pointer(bp + 4))) } if v2 != 0 { _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+29361, libc.VaList(bp+24, i, iCell, iNode)) } if pParent != 0 { _readCoord(tls, pParent+uintptr(libc.Int32FromInt32(4)*libc.Int32FromInt32(2)*i), bp+8) _readCoord(tls, pParent+uintptr(int32(4)*(int32(2)*i+int32(1))), bp+12) if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FbInt != 0 { v2 = libc.BoolInt32(*(*int32)(unsafe.Pointer(bp)) < *(*int32)(unsafe.Pointer(bp + 8))) } else { v2 = libc.BoolInt32(*(*TRtreeValue)(unsafe.Pointer(bp)) < *(*TRtreeValue)(unsafe.Pointer(bp + 8))) } if v5 = v2 != 0; !v5 { if (*TRtreeCheck)(unsafe.Pointer(pCheck)).FbInt != 0 { v3 = libc.BoolInt32(*(*int32)(unsafe.Pointer(bp + 4)) > *(*int32)(unsafe.Pointer(bp + 12))) } else { v3 = libc.BoolInt32(*(*TRtreeValue)(unsafe.Pointer(bp + 4)) > *(*TRtreeValue)(unsafe.Pointer(bp + 12))) } } if v5 || v3 != 0 { _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+29409, libc.VaList(bp+24, i, iCell, iNode)) } } goto _1 _1: ; i = i + 1 } } // C documentation // // /* // ** The second argument to this function must be either "_rowid" or // ** "_parent". This function checks that the number of entries in the // ** %_rowid or %_parent table is exactly nExpect. If not, it adds // ** an error message to the report in the RtreeCheck object indicated // ** by the first argument. // */ func _rtreeCheckCount(tls *libc.TLS, pCheck uintptr, zTbl uintptr, nExpect Ti64) { bp := tls.Alloc(32) defer tls.Free(32) var nActual Ti64 var pCount uintptr _, _ = nActual, pCount if (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { pCount = _rtreeCheckPrepare(tls, pCheck, __ccgo_ts+29595, libc.VaList(bp+8, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*TRtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) if pCount != 0 { if Xsqlite3_step(tls, pCount) == int32(SQLITE_ROW) { nActual = Xsqlite3_column_int64(tls, pCount, 0) if nActual != nExpect { _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+29626, libc.VaList(bp+8, zTbl, nExpect, nActual)) } } (*TRtreeCheck)(unsafe.Pointer(pCheck)).Frc = Xsqlite3_finalize(tls, pCount) } } } // C documentation // // /* // ** Run rtreecheck() checks on node iNode, which is at depth iDepth within // ** the r-tree structure. Argument aParent points to the array of coordinates // ** that bound node iNode on the parent node. // ** // ** If any problems are discovered, an error message is appended to the // ** report accumulated in the RtreeCheck object. // */ func _rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintptr, iNode Ti64) { bp := tls.Alloc(48) defer tls.Free(48) var aNode, pCell uintptr var i, nCell int32 var iVal Ti64 var _ /* nNode at bp+0 */ int32 _, _, _, _, _ = aNode, i, iVal, nCell, pCell aNode = uintptr(0) **(**int32)(__ccgo_up(bp)) = 0 aNode = _rtreeCheckGetNode(tls, pCheck, iNode, bp) if aNode != 0 { if **(**int32)(__ccgo_up(bp)) < int32(4) { _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+29476, libc.VaList(bp+16, iNode, **(**int32)(__ccgo_up(bp)))) } else { /* Used to iterate through cells */ if aParent == uintptr(0) { iDepth = _readInt16(tls, aNode) if iDepth > int32(RTREE_MAX_DEPTH) { _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+29510, libc.VaList(bp+16, iDepth)) Xsqlite3_free(tls, aNode) return } } nCell = _readInt16(tls, aNode+2) if int32(4)+nCell*(int32(8)+(*TRtreeCheck)(unsafe.Pointer(pCheck)).FnDim*int32(2)*int32(4)) > **(**int32)(__ccgo_up(bp)) { _rtreeCheckAppendMsg(tls, pCheck, __ccgo_ts+29540, libc.VaList(bp+16, iNode, nCell, **(**int32)(__ccgo_up(bp)))) } else { i = 0 for { if !(i < nCell) { break } pCell = aNode + uintptr(int32(4)+i*(int32(8)+(*TRtreeCheck)(unsafe.Pointer(pCheck)).FnDim*int32(2)*int32(4))) iVal = _readInt64(tls, pCell) _rtreeCheckCellCoord(tls, pCheck, iNode, i, pCell+8, aParent) if iDepth > 0 { _rtreeCheckMapping(tls, pCheck, 0, iVal, iNode) _rtreeCheckNode(tls, pCheck, iDepth-int32(1), pCell+8, iVal) (*TRtreeCheck)(unsafe.Pointer(pCheck)).FnNonLeaf = (*TRtreeCheck)(unsafe.Pointer(pCheck)).FnNonLeaf + 1 } else { _rtreeCheckMapping(tls, pCheck, int32(1), iVal, iNode) (*TRtreeCheck)(unsafe.Pointer(pCheck)).FnLeaf = (*TRtreeCheck)(unsafe.Pointer(pCheck)).FnLeaf + 1 } goto _1 _1: ; i = i + 1 } } } Xsqlite3_free(tls, aNode) } } // C documentation // // /* // ** A constraint has failed while inserting a row into an rtree table. // ** Assuming no OOM error occurs, this function sets the error message // ** (at pRtree->base.zErrMsg) to an appropriate value and returns // ** SQLITE_CONSTRAINT. // ** // ** Parameter iCol is the index of the leftmost column involved in the // ** constraint failure. If it is 0, then the constraint that failed is // ** the unique constraint on the id column. Otherwise, it is the rtree // ** (c1<=c2) constraint on columns iCol and iCol+1 that has failed. // ** // ** If an OOM occurs, SQLITE_NOMEM is returned instead of SQLITE_CONSTRAINT. // */ func _rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var rc, v1 int32 var zCol, zCol1, zCol2, zSql uintptr var _ /* pStmt at bp+0 */ uintptr _, _, _, _, _, _ = rc, zCol, zCol1, zCol2, zSql, v1 **(**uintptr)(__ccgo_up(bp)) = uintptr(0) zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27509, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) if zSql != 0 { rc = Xsqlite3_prepare_v2(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, -int32(1), bp, uintptr(0)) } else { rc = int32(SQLITE_NOMEM) } Xsqlite3_free(tls, zSql) if rc == SQLITE_OK { if iCol == 0 { zCol = Xsqlite3_column_name(tls, **(**uintptr)(__ccgo_up(bp)), 0) (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+27529, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol)) } else { zCol1 = Xsqlite3_column_name(tls, **(**uintptr)(__ccgo_up(bp)), iCol) zCol2 = Xsqlite3_column_name(tls, **(**uintptr)(__ccgo_up(bp)), iCol+int32(1)) (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+27561, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) } } Xsqlite3_finalize(tls, **(**uintptr)(__ccgo_up(bp))) if rc == SQLITE_OK { v1 = int32(SQLITE_CONSTRAINT) } else { v1 = rc } return v1 } // C documentation // // /* // ** Rtree virtual table module xDestroy method. // */ func _rtreeDestroy(tls *libc.TLS, pVtab uintptr) (r int32) { bp := tls.Alloc(64) defer tls.Free(64) var pRtree, zCreate uintptr var rc int32 _, _, _ = pRtree, rc, zCreate pRtree = pVtab zCreate = Xsqlite3_mprintf(tls, __ccgo_ts+27413, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) if !(zCreate != 0) { rc = int32(SQLITE_NOMEM) } else { _nodeBlobReset(tls, pRtree) rc = Xsqlite3_exec(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zCreate, uintptr(0), uintptr(0), uintptr(0)) Xsqlite3_free(tls, zCreate) } if rc == SQLITE_OK { _rtreeRelease(tls, pRtree) } return rc } // C documentation // // /* // ** Implementation of the xIntegrity method for Rtree. // */ func _rtreeIntegrity(tls *libc.TLS, pVtab uintptr, zSchema uintptr, zName uintptr, isQuick int32, pzErr uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var pRtree uintptr var rc int32 _, _ = pRtree, rc pRtree = pVtab _ = zSchema _ = zName _ = isQuick rc = _rtreeCheckTable(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, pzErr) if rc == SQLITE_OK && **(**uintptr)(__ccgo_up(pzErr)) != 0 { **(**uintptr)(__ccgo_up(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+29767, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, **(**uintptr)(__ccgo_up(pzErr)))) if **(**uintptr)(__ccgo_up(pzErr)) == uintptr(0) { rc = int32(SQLITE_NOMEM) } } return rc } // C documentation // // /* // ** This function populates the pRtree->nRowEst variable with an estimate // ** of the number of rows in the virtual table. If possible, this is based // ** on sqlite_stat1 data. Otherwise, use RTREE_DEFAULT_ROWEST. // */ func _rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var nRow Ti64 var rc, v1 int32 var zFmt, zSql uintptr var v2 int64 var _ /* p at bp+0 */ uintptr _, _, _, _, _, _ = nRow, rc, zFmt, zSql, v1, v2 zFmt = __ccgo_ts + 27743 nRow = int64(RTREE_MIN_ROWEST) rc = Xsqlite3_table_column_metadata(tls, db, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, __ccgo_ts+12837, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) if rc != SQLITE_OK { (*TRtree)(unsafe.Pointer(pRtree)).FnRowEst = int64(RTREE_DEFAULT_ROWEST) if rc == int32(SQLITE_ERROR) { v1 = SQLITE_OK } else { v1 = rc } return v1 } zSql = Xsqlite3_mprintf(tls, zFmt, libc.VaList(bp+16, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName)) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { rc = Xsqlite3_prepare_v2(tls, db, zSql, -int32(1), bp, uintptr(0)) if rc == SQLITE_OK { if Xsqlite3_step(tls, **(**uintptr)(__ccgo_up(bp))) == int32(SQLITE_ROW) { nRow = Xsqlite3_column_int64(tls, **(**uintptr)(__ccgo_up(bp)), 0) } rc = Xsqlite3_finalize(tls, **(**uintptr)(__ccgo_up(bp))) } Xsqlite3_free(tls, zSql) } if nRow > int64(libc.Int32FromInt32(RTREE_MIN_ROWEST)) { v2 = nRow } else { v2 = int64(libc.Int32FromInt32(RTREE_MIN_ROWEST)) } (*TRtree)(unsafe.Pointer(pRtree)).FnRowEst = v2 return rc } // C documentation // // /* // ** The xRename method for rtree module virtual tables. // */ func _rtreeRename(tls *libc.TLS, pVtab uintptr, zNewName uintptr) (r int32) { bp := tls.Alloc(80) defer tls.Free(80) var pRtree, zSql uintptr var rc int32 _, _, _ = pRtree, rc, zSql pRtree = pVtab rc = int32(SQLITE_NOMEM) zSql = Xsqlite3_mprintf(tls, __ccgo_ts+27598, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) if zSql != 0 { _nodeBlobReset(tls, pRtree) rc = Xsqlite3_exec(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0)) Xsqlite3_free(tls, zSql) } return rc } // C documentation // // /* This routine implements an SQL function that returns the "depth" parameter // ** from the front of a blob that is an r-tree node. For example: // ** // ** SELECT rtreedepth(data) FROM rt_node WHERE nodeno=1; // ** // ** The depth value is 0 for all nodes other than the root node, and the root // ** node always has nodeno=1, so the example above is the primary use for this // ** routine. This routine is intended for testing and analysis only. // */ func _rtreedepth(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { var zBlob uintptr _ = zBlob _ = nArg if Xsqlite3_value_type(tls, **(**uintptr)(__ccgo_up(apArg))) != int32(SQLITE_BLOB) || Xsqlite3_value_bytes(tls, **(**uintptr)(__ccgo_up(apArg))) < int32(2) { Xsqlite3_result_error(tls, ctx, __ccgo_ts+29022, -int32(1)) } else { zBlob = Xsqlite3_value_blob(tls, **(**uintptr)(__ccgo_up(apArg))) if zBlob != 0 { Xsqlite3_result_int(tls, ctx, _readInt16(tls, zBlob)) } else { Xsqlite3_result_error_nomem(tls, ctx) } } } // C documentation // // /* // ** Attempt to apply the change that the iterator passed as the first argument // ** currently points to to the database. If a conflict is encountered, invoke // ** the conflict handler callback. // ** // ** The difference between this function and sessionApplyOne() is that this // ** function handles the case where the conflict-handler is invoked and // ** returns SQLITE_CHANGESET_REPLACE - indicating that the change should be // ** retried in some manner. // */ func _sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply uintptr, __ccgo_fp_xConflict uintptr, pCtx uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var rc int32 var _ /* bReplace at bp+0 */ int32 var _ /* bRetry at bp+4 */ int32 _ = rc **(**int32)(__ccgo_up(bp)) = 0 **(**int32)(__ccgo_up(bp + 4)) = 0 rc = _sessionApplyOneOp(tls, pIter, pApply, __ccgo_fp_xConflict, pCtx, bp, bp+4) if rc == SQLITE_OK { /* If the bRetry flag is set, the change has not been applied due to an ** SQLITE_CHANGESET_DATA problem (i.e. this is an UPDATE or DELETE and ** a row with the correct PK is present in the db, but one or more other ** fields do not contain the expected values) and the conflict handler ** returned SQLITE_CHANGESET_REPLACE. In this case retry the operation, ** but pass NULL as the final argument so that sessionApplyOneOp() ignores ** the SQLITE_CHANGESET_DATA problem. */ if **(**int32)(__ccgo_up(bp + 4)) != 0 { rc = _sessionApplyOneOp(tls, pIter, pApply, __ccgo_fp_xConflict, pCtx, uintptr(0), uintptr(0)) } else { if **(**int32)(__ccgo_up(bp)) != 0 { rc = Xsqlite3_exec(tls, db, __ccgo_ts+36327, uintptr(0), uintptr(0), uintptr(0)) if rc == SQLITE_OK { rc = _sessionBindRow(tls, pIter, __ccgo_fp(Xsqlite3changeset_new), (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FabPK, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) Xsqlite3_bind_int(tls, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FnCol+int32(1), int32(1)) } if rc == SQLITE_OK { Xsqlite3_step(tls, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) rc = Xsqlite3_reset(tls, (*TSessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) } if rc == SQLITE_OK { rc = _sessionApplyOneOp(tls, pIter, pApply, __ccgo_fp_xConflict, pCtx, uintptr(0), uintptr(0)) } if rc == SQLITE_OK { rc = Xsqlite3_exec(tls, db, __ccgo_ts+36348, uintptr(0), uintptr(0), uintptr(0)) } } } } return rc } func _sessionDiffFindModified(tls *libc.TLS, pSession uintptr, pTab uintptr, zFrom uintptr, zExpr uintptr) (r int32) { bp := tls.Alloc(80) defer tls.Free(80) var iRowid Ti64 var pDiffCtx, z1, z2, zExpr2, zStmt uintptr var rc int32 var v1 int64 var _ /* pStmt at bp+0 */ uintptr _, _, _, _, _, _, _, _ = iRowid, pDiffCtx, rc, z1, z2, zExpr2, zStmt, v1 rc = SQLITE_OK zExpr2 = _sessionExprCompareOther(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FnCol, (*Tsqlite3_session)(unsafe.Pointer(pSession)).FzDb, zFrom, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, (*TSessionTable)(unsafe.Pointer(pTab)).FazCol, (*TSessionTable)(unsafe.Pointer(pTab)).FabPK) if zExpr2 == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { z1 = _sessionAllCols(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).FzDb, pTab) z2 = _sessionAllCols(tls, zFrom, pTab) zStmt = Xsqlite3_mprintf(tls, __ccgo_ts+35550, libc.VaList(bp+16, z1, z2, (*Tsqlite3_session)(unsafe.Pointer(pSession)).FzDb, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, zFrom, (*TSessionTable)(unsafe.Pointer(pTab)).FzName, zExpr, zExpr2)) if zStmt == uintptr(0) || z1 == uintptr(0) || z2 == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { rc = Xsqlite3_prepare_v2(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb, zStmt, -int32(1), bp, uintptr(0)) if rc == SQLITE_OK { pDiffCtx = (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx (*TSessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FpStmt = **(**uintptr)(__ccgo_up(bp)) (*TSessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FnOldOff = (*TSessionTable)(unsafe.Pointer(pTab)).FnCol for int32(SQLITE_ROW) == Xsqlite3_step(tls, **(**uintptr)(__ccgo_up(bp))) { if (*TSessionTable)(unsafe.Pointer(pTab)).FbRowid != 0 { v1 = Xsqlite3_column_int64(tls, **(**uintptr)(__ccgo_up(bp)), 0) } else { v1 = 0 } iRowid = v1 _sessionPreupdateOneChange(tls, int32(SQLITE_UPDATE), iRowid, pSession, pTab) } rc = Xsqlite3_finalize(tls, **(**uintptr)(__ccgo_up(bp))) } } Xsqlite3_free(tls, zStmt) Xsqlite3_free(tls, z1) Xsqlite3_free(tls, z2) } return rc } func _sessionSelectFindNew(tls *libc.TLS, zDb1 uintptr, zDb2 uintptr, bRowid int32, zTbl uintptr, zExpr uintptr) (r uintptr) { bp := tls.Alloc(64) defer tls.Free(64) var zRet, zSel, v1 uintptr _, _, _ = zRet, zSel, v1 if bRowid != 0 { v1 = __ccgo_ts + 35441 } else { v1 = __ccgo_ts + 6825 } zSel = v1 zRet = Xsqlite3_mprintf(tls, __ccgo_ts+35452, libc.VaList(bp+8, zSel, zDb1, zTbl, zDb2, zTbl, zExpr)) return zRet } // C documentation // // /* // ** Check if table zTab in the "main" database of db is a WITHOUT ROWID // ** table. // ** // ** If no error occurs, return SQLITE_OK and set output variable (*pbWR) to // ** true if zTab is a WITHOUT ROWID table, or false otherwise. Or, if an // ** error does occur, return an SQLite error code. The final value of (*pbWR) // ** is undefined in this case. // */ func _sessionTableIsWithoutRowid(tls *libc.TLS, db uintptr, zTab uintptr, pbWR uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var rc int32 var zSql uintptr var _ /* pList at bp+0 */ uintptr _, _ = rc, zSql **(**uintptr)(__ccgo_up(bp)) = uintptr(0) zSql = uintptr(0) rc = SQLITE_OK zSql = Xsqlite3_mprintf(tls, __ccgo_ts+36367, libc.VaList(bp+16, zTab)) if zSql == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { rc = Xsqlite3_prepare_v2(tls, db, zSql, -int32(1), bp, uintptr(0)) Xsqlite3_free(tls, zSql) } if rc == SQLITE_OK { Xsqlite3_step(tls, **(**uintptr)(__ccgo_up(bp))) **(**int32)(__ccgo_up(pbWR)) = Xsqlite3_column_int(tls, **(**uintptr)(__ccgo_up(bp)), int32(4)) rc = Xsqlite3_finalize(tls, **(**uintptr)(__ccgo_up(bp))) } return rc } // C documentation // // /* // ** Do an authorization check using the code and arguments given. Return // ** either SQLITE_OK (zero) or SQLITE_IGNORE or SQLITE_DENY. If SQLITE_DENY // ** is returned, then the error count and error message in pParse are // ** modified appropriately. // */ func _sqlite3AuthCheck(tls *libc.TLS, pParse uintptr, code int32, zArg1 uintptr, zArg2 uintptr, zArg3 uintptr) (r int32) { var db uintptr var rc int32 _, _ = db, rc db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Don't do any authorization checks if the database is initializing ** or if the parser is being invoked from within sqlite3_declare_vtab. */ if (*Tsqlite3)(unsafe.Pointer(db)).FxAuth == uintptr(0) || (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 || libc.Int32FromUint8((*TParse)(unsafe.Pointer(pParse)).FeParseMode) != PARSE_MODE_NORMAL { return SQLITE_OK } /* EVIDENCE-OF: R-43249-19882 The third through sixth parameters to the ** callback are either NULL pointers or zero-terminated strings that ** contain additional details about the action to be authorized. ** ** The following testcase() macros show that any of the 3rd through 6th ** parameters can be either NULL or a string. */ rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3)(unsafe.Pointer(db)).FxAuth})))(tls, (*Tsqlite3)(unsafe.Pointer(db)).FpAuthArg, code, zArg1, zArg2, zArg3, (*TParse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == int32(SQLITE_DENY) { _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13675, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_AUTH) } else { if rc != SQLITE_OK && rc != int32(SQLITE_IGNORE) { rc = int32(SQLITE_DENY) _sqliteAuthBadReturnCode(tls, pParse) } } return rc } func _sqlite3CantopenError(tls *libc.TLS, lineno int32) (r int32) { return _sqlite3ReportError(tls, int32(SQLITE_CANTOPEN), lineno, __ccgo_ts+26323) } // C documentation // // /* // ** Close an existing SQLite database // */ func _sqlite3Close(tls *libc.TLS, db uintptr, forceZombie int32) (r int32) { var p uintptr _ = p if !(db != 0) { /* EVIDENCE-OF: R-63257-11740 Calling sqlite3_close() or ** sqlite3_close_v2() with a NULL pointer argument is a harmless no-op. */ return SQLITE_OK } if !(_sqlite3SafetyCheckSickOrOk(tls, db) != 0) { return _sqlite3MisuseError(tls, int32(188636)) } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if libc.Int32FromUint8((*Tsqlite3)(unsafe.Pointer(db)).FmTrace)&int32(SQLITE_TRACE_CLOSE) != 0 { (*(*func(*libc.TLS, Tu32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*uintptr)(unsafe.Pointer(&(*Tsqlite3)(unsafe.Pointer(db)).Ftrace))})))(tls, uint32(SQLITE_TRACE_CLOSE), (*Tsqlite3)(unsafe.Pointer(db)).FpTraceArg, db, uintptr(0)) } /* Force xDisconnect calls on all virtual tables */ _disconnectAllVtab(tls, db) /* If a transaction is open, the disconnectAllVtab() call above ** will not have called the xDisconnect() method on any virtual ** tables in the db->aVTrans[] array. The following sqlite3VtabRollback() ** call will do so. We need to do this before the check for active ** SQL statements below, as the v-table implementation may be storing ** some prepared statements internally. */ _sqlite3VtabRollback(tls, db) /* Legacy behavior (sqlite3_close() behavior) is to return ** SQLITE_BUSY if the connection can not be closed immediately. */ if !(forceZombie != 0) && _connectionIsBusy(tls, db) != 0 { _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_BUSY), __ccgo_ts+25291, 0) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return int32(SQLITE_BUSY) } for (*Tsqlite3)(unsafe.Pointer(db)).FpDbData != 0 { p = (*Tsqlite3)(unsafe.Pointer(db)).FpDbData (*Tsqlite3)(unsafe.Pointer(db)).FpDbData = (*TDbClientData)(unsafe.Pointer(p)).FpNext if (*TDbClientData)(unsafe.Pointer(p)).FxDestructor != 0 { (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TDbClientData)(unsafe.Pointer(p)).FxDestructor})))(tls, (*TDbClientData)(unsafe.Pointer(p)).FpData) } Xsqlite3_free(tls, p) } /* Convert the connection into a zombie and then close it. */ (*Tsqlite3)(unsafe.Pointer(db)).FeOpenState = uint8(SQLITE_STATE_ZOMBIE) _sqlite3LeaveMutexAndCloseZombie(tls, db) return SQLITE_OK } func _sqlite3CorruptError(tls *libc.TLS, lineno int32) (r int32) { return _sqlite3ReportError(tls, int32(SQLITE_CORRUPT), lineno, __ccgo_ts+26296) } // C documentation // // /* // ** Invoke this routine to register the "dbpage" virtual table module // */ func _sqlite3DbpageRegister(tls *libc.TLS, db uintptr) (r int32) { return Xsqlite3_create_module(tls, db, __ccgo_ts+35180, uintptr(unsafe.Pointer(&_dbpage_module)), uintptr(0)) } // C documentation // // /* // ** Invoke this routine to register the "dbstat" virtual table module // */ func _sqlite3DbstatRegister(tls *libc.TLS, db uintptr) (r int32) { return Xsqlite3_create_module(tls, db, __ccgo_ts+34995, uintptr(unsafe.Pointer(&_dbstat_module)), uintptr(0)) } // C documentation // // /* // ** Generate VDBE code for a COMMIT or ROLLBACK statement. // ** Code for ROLLBACK is generated if eType==TK_ROLLBACK. Otherwise // ** code is generated for a COMMIT. // */ func _sqlite3EndTransaction(tls *libc.TLS, pParse uintptr, eType int32) { var isRollback int32 var v, v1 uintptr _, _, _ = isRollback, v, v1 isRollback = libc.BoolInt32(eType == int32(TK_ROLLBACK)) if isRollback != 0 { v1 = __ccgo_ts + 16113 } else { v1 = __ccgo_ts + 16122 } if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_TRANSACTION), v1, uintptr(0), uintptr(0)) != 0 { return } v = _sqlite3GetVdbe(tls, pParse) if v != 0 { _sqlite3VdbeAddOp2(tls, v, int32(OP_AutoCommit), int32(1), isRollback) } } // C documentation // // /* // ** Write code that will raise an error if the table described by // ** zDb and zTab is not empty. // */ func _sqlite3ErrorIfNotEmpty(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zErr uintptr) { bp := tls.Alloc(32) defer tls.Free(32) _sqlite3NestedParse(tls, pParse, __ccgo_ts+10255, libc.VaList(bp+8, zErr, zDb, zTab)) } // C documentation // // /* // ** Check to see if a function is usable according to current access // ** rules: // ** // ** SQLITE_FUNC_DIRECT - Only usable from top-level SQL // ** // ** SQLITE_FUNC_UNSAFE - Usable if TRUSTED_SCHEMA or from // ** top-level SQL // ** // ** If the function is not usable, create an error. // */ func _sqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pDef uintptr) { bp := tls.Alloc(16) defer tls.Free(16) if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&libc.Uint32FromInt32(libc.Int32FromInt32(EP_FromDDL)) != uint32(0) || libc.Int32FromUint8((*TParse)(unsafe.Pointer(pParse)).FprepFlags)&int32(SQLITE_PREPARE_FROM_DDL) != 0 { if (*TFuncDef)(unsafe.Pointer(pDef)).FfuncFlags&uint32(SQLITE_FUNC_DIRECT) != uint32(0) || (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&uint64(SQLITE_TrustedSchema) == uint64(0) { /* Functions prohibited in triggers and views if: ** (1) tagged with SQLITE_DIRECTONLY ** (2) not tagged with SQLITE_INNOCUOUS (which means it ** is tagged with SQLITE_FUNC_UNSAFE) and ** SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning ** that the schema is possibly tainted). */ _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+8043, libc.VaList(bp+8, pExpr)) } } } // C documentation // // /* // ** Report an error when attempting to use an ORDER BY clause within // ** the arguments of a non-aggregate function. // */ func _sqlite3ExprOrderByAggregateError(tls *libc.TLS, pParse uintptr, p uintptr) { bp := tls.Alloc(16) defer tls.Free(16) _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+7993, libc.VaList(bp+8, p)) } // C documentation // // /* // ** Create the shadow table named zPost, with definition zDefn. Return // ** SQLITE_OK if successful, or an SQLite error code otherwise. // */ func _sqlite3Fts5CreateTable(tls *libc.TLS, pConfig uintptr, zPost uintptr, zDefn uintptr, bWithout int32, pzErr uintptr) (r int32) { bp := tls.Alloc(64) defer tls.Free(64) var rc int32 var v1 uintptr var _ /* zErr at bp+0 */ uintptr _, _ = rc, v1 **(**uintptr)(__ccgo_up(bp)) = uintptr(0) if bWithout != 0 { v1 = __ccgo_ts + 32083 } else { v1 = __ccgo_ts + 1704 } rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, bp, __ccgo_ts+41488, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, v1)) if **(**uintptr)(__ccgo_up(bp)) != 0 { **(**uintptr)(__ccgo_up(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+41518, libc.VaList(bp+16, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, **(**uintptr)(__ccgo_up(bp)))) Xsqlite3_free(tls, **(**uintptr)(__ccgo_up(bp))) } return rc } // C documentation // // /* // ** Drop all shadow tables. Return SQLITE_OK if successful or an SQLite error // ** code otherwise. // */ func _sqlite3Fts5DropAll(tls *libc.TLS, pConfig uintptr) (r int32) { bp := tls.Alloc(64) defer tls.Free(64) var rc int32 _ = rc rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+41266, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+41370, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+41408, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } return rc } // C documentation // // /* // ** Apply colset pColset to expression node pExpr and all of its descendents. // */ func _sqlite3Fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pExpr uintptr, pColset uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* pFree at bp+0 */ uintptr **(**uintptr)(__ccgo_up(bp)) = pColset if (*TFts5Config)(unsafe.Pointer((*TFts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail == int32(FTS5_DETAIL_NONE) { _sqlite3Fts5ParseError(tls, pParse, __ccgo_ts+38639, 0) } else { _fts5ParseSetColset(tls, pParse, pExpr, pColset, bp) } Xsqlite3_free(tls, **(**uintptr)(__ccgo_up(bp))) } // C documentation // // /* // ** Delete all entries in the FTS5 index. // */ func _sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var pConfig uintptr var rc int32 _, _ = pConfig, rc pConfig = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig (*TFts5Storage)(unsafe.Pointer(p)).FbTotalsValid = 0 /* Delete the contents of the %_data and %_docsize tables. */ rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+41694, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+41744, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } if rc == SQLITE_OK && (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == int32(FTS5_CONTENT_UNINDEXED) { rc = _fts5ExecPrintf(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), __ccgo_ts+41773, libc.VaList(bp+8, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } /* Reinitialize the %_data table. This call creates the initial structure ** and averages records. */ if rc == SQLITE_OK { rc = _sqlite3Fts5IndexReinit(tls, (*TFts5Storage)(unsafe.Pointer(p)).FpIndex) } if rc == SQLITE_OK { rc = _sqlite3Fts5StorageConfigValue(tls, p, __ccgo_ts+38468, uintptr(0), int32(FTS5_CURRENT_VERSION)) } return rc } func _sqlite3Fts5StorageRename(tls *libc.TLS, pStorage uintptr, zName uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var pConfig uintptr var _ /* rc at bp+0 */ int32 _ = pConfig pConfig = (*TFts5Storage)(unsafe.Pointer(pStorage)).FpConfig **(**int32)(__ccgo_up(bp)) = _sqlite3Fts5StorageSync(tls, pStorage) _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+27408, zName) _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+13048, zName) _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+40600, zName) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+38286, zName) } if (*TFts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { _fts5StorageRenameOne(tls, pConfig, bp, __ccgo_ts+37591, zName) } return **(**int32)(__ccgo_up(bp)) } // C documentation // // /* // ** Return true if the tokenizer described by p->azArg[] is the trigram // ** tokenizer. This tokenizer needs to be loaded before xBestIndex is // ** called for the first time in order to correctly handle LIKE/GLOB. // */ func _sqlite3Fts5TokenizerPreload(tls *libc.TLS, p uintptr) (r int32) { return libc.BoolInt32((*TFts5TokenizerConfig)(unsafe.Pointer(p)).FnArg >= int32(1) && 0 == Xsqlite3_stricmp(tls, **(**uintptr)(__ccgo_up((*TFts5TokenizerConfig)(unsafe.Pointer(p)).FazArg)), __ccgo_ts+42205)) } func _sqlite3Fts5VocabInit(tls *libc.TLS, pGlobal uintptr, db uintptr) (r int32) { var p uintptr _ = p p = pGlobal return Xsqlite3_create_module_v2(tls, db, __ccgo_ts+42529, uintptr(unsafe.Pointer(&_fts5Vocab)), p, uintptr(0)) } // C documentation // // /* // ** This function is responsible for invoking the collation factory callback // ** or substituting a collation sequence of a different encoding when the // ** requested collation sequence is not available in the desired encoding. // ** // ** If it is not NULL, then pColl must point to the database native encoding // ** collation sequence with name zName, length nName. // ** // ** The return value is either the collation sequence to be used in database // ** db for collation type name zName, length nName, or NULL, if no collation // ** sequence can be found. If no collation is found, leave an error message. // ** // ** See also: sqlite3LocateCollSeq(), sqlite3FindCollSeq() // */ func _sqlite3GetCollSeq(tls *libc.TLS, pParse uintptr, enc Tu8, pColl uintptr, zName uintptr) (r uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var db, p uintptr _, _ = db, p db = (*TParse)(unsafe.Pointer(pParse)).Fdb p = pColl if !(p != 0) { p = _sqlite3FindCollSeq(tls, db, enc, zName, 0) } if !(p != 0) || !((*TCollSeq)(unsafe.Pointer(p)).FxCmp != 0) { /* No collation sequence of this type for this encoding is registered. ** Call the collation factory to see if it can supply us with one. */ _callCollNeeded(tls, db, libc.Int32FromUint8(enc), zName) p = _sqlite3FindCollSeq(tls, db, enc, zName, 0) } if p != 0 && !((*TCollSeq)(unsafe.Pointer(p)).FxCmp != 0) && _synthCollSeq(tls, db, p) != 0 { p = uintptr(0) } if p == uintptr(0) { _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16318, libc.VaList(bp+8, zName)) (*TParse)(unsafe.Pointer(pParse)).Frc = libc.Int32FromInt32(SQLITE_ERROR) | libc.Int32FromInt32(1)< generate an error message and return 1. // ** If pTab is writable but other errors have occurred -> return 1. // ** If pTab is writable and no prior errors -> return 0; // */ func _sqlite3IsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr, pTrigger uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if _tabIsReadOnly(tls, pParse, pTab) != 0 { _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16382, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } if libc.Int32FromUint8((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) && (pTrigger == uintptr(0) || (*TTrigger)(unsafe.Pointer(pTrigger)).FbReturning != 0 && (*TTrigger)(unsafe.Pointer(pTrigger)).FpNext == uintptr(0)) { _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+16411, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName)) return int32(1) } return 0 } // C documentation // // /* // ** Return TRUE if the given string is a row-id column name. // */ func _sqlite3IsRowid(tls *libc.TLS, z uintptr) (r int32) { if _sqlite3StrICmp(tls, z, __ccgo_ts+8193) == 0 { return int32(1) } if _sqlite3StrICmp(tls, z, __ccgo_ts+8201) == 0 { return int32(1) } if _sqlite3StrICmp(tls, z, __ccgo_ts+8207) == 0 { return int32(1) } return 0 } // C documentation // // /* // ** Check the input string to see if it is "true" or "false" (in any case). // ** // ** If the string is.... Return // ** "true" EP_IsTrue // ** "false" EP_IsFalse // ** anything else 0 // */ func _sqlite3IsTrueOrFalse(tls *libc.TLS, zIn uintptr) (r Tu32) { if _sqlite3StrICmp(tls, zIn, __ccgo_ts+8182) == 0 { return uint32(EP_IsTrue) } if _sqlite3StrICmp(tls, zIn, __ccgo_ts+8187) == 0 { return uint32(EP_IsFalse) } return uint32(0) } func _sqlite3MisuseError(tls *libc.TLS, lineno int32) (r int32) { return _sqlite3ReportError(tls, int32(SQLITE_MISUSE), lineno, __ccgo_ts+26316) } // C documentation // // /* // ** Open the sqlite_schema table stored in database number iDb for // ** writing. The table is opened using cursor 0. // */ func _sqlite3OpenSchemaTable(tls *libc.TLS, p uintptr, iDb int32) { var v uintptr _ = v v = _sqlite3GetVdbe(tls, p) _sqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), __ccgo_ts+6288) _sqlite3VdbeAddOp4Int(tls, v, int32(OP_OpenWrite), 0, int32(SCHEMA_ROOT), iDb, int32(5)) if (*TParse)(unsafe.Pointer(p)).FnTab == 0 { (*TParse)(unsafe.Pointer(p)).FnTab = int32(1) } } // C documentation // // /* // ** This function is called when the user invokes "PRAGMA wal_checkpoint", // ** "PRAGMA wal_blocking_checkpoint" or calls the sqlite3_wal_checkpoint() // ** or wal_blocking_checkpoint() API functions. // ** // ** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL or RESTART. // */ func _sqlite3PagerCheckpoint(tls *libc.TLS, pPager uintptr, db uintptr, eMode int32, pnLog uintptr, pnCkpt uintptr) (r int32) { var rc int32 var v1 uintptr _, _ = rc, v1 rc = SQLITE_OK if (*TPager)(unsafe.Pointer(pPager)).FpWal == uintptr(0) && libc.Int32FromUint8((*TPager)(unsafe.Pointer(pPager)).FjournalMode) == int32(PAGER_JOURNALMODE_WAL) { /* This only happens when a database file is zero bytes in size opened and ** then "PRAGMA journal_mode=WAL" is run and then sqlite3_wal_checkpoint() ** is invoked without any intervening transactions. We need to start ** a transaction to initialize pWal. The PRAGMA table_list statement is ** used for this since it starts transactions on every database file, ** including all ATTACHed databases. This seems expensive for a single ** sqlite3_wal_checkpoint() call, but it happens very rarely. ** https://sqlite.org/forum/forumpost/fd0f19d229156939 */ Xsqlite3_exec(tls, db, __ccgo_ts+4262, uintptr(0), uintptr(0), uintptr(0)) } if (*TPager)(unsafe.Pointer(pPager)).FpWal != 0 { if eMode <= SQLITE_CHECKPOINT_PASSIVE { v1 = uintptr(0) } else { v1 = (*TPager)(unsafe.Pointer(pPager)).FxBusyHandler } rc = _sqlite3WalCheckpoint(tls, (*TPager)(unsafe.Pointer(pPager)).FpWal, db, eMode, v1, (*TPager)(unsafe.Pointer(pPager)).FpBusyHandlerArg, libc.Int32FromUint8((*TPager)(unsafe.Pointer(pPager)).FwalSyncFlags), int32((*TPager)(unsafe.Pointer(pPager)).FpageSize), (*TPager)(unsafe.Pointer(pPager)).FpTmpSpace, pnLog, pnCkpt) } return rc } // C documentation // // /* // ** Return the preferred table name for system tables. Translate legacy // ** names into the new preferred names, as appropriate. // */ func _sqlite3PreferredTableName(tls *libc.TLS, zName uintptr) (r uintptr) { if Xsqlite3_strnicmp(tls, zName, __ccgo_ts+6760, int32(7)) == 0 { if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6288+7) == 0 { return __ccgo_ts + 6806 } if _sqlite3StrICmp(tls, zName+uintptr(7), __ccgo_ts+6768+7) == 0 { return __ccgo_ts + 6787 } } return zName } // C documentation // // /* // ** Re-register the built-in LIKE functions. The caseSensitive // ** parameter determines whether or not the LIKE operator is case // ** sensitive. // */ func _sqlite3RegisterLikeFunctions(tls *libc.TLS, db uintptr, caseSensitive int32) { var flags, nArg int32 var pDef, pInfo uintptr _, _, _, _ = flags, nArg, pDef, pInfo if caseSensitive != 0 { pInfo = uintptr(unsafe.Pointer(&_likeInfoAlt)) flags = libc.Int32FromInt32(SQLITE_FUNC_LIKE) | libc.Int32FromInt32(SQLITE_FUNC_CASE) } else { pInfo = uintptr(unsafe.Pointer(&_likeInfoNorm)) flags = int32(SQLITE_FUNC_LIKE) } nArg = int32(2) for { if !(nArg <= int32(3)) { break } _sqlite3CreateFunc(tls, db, __ccgo_ts+16609, nArg, int32(SQLITE_UTF8), pInfo, __ccgo_fp(_likeFunc), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) pDef = _sqlite3FindFunction(tls, db, __ccgo_ts+16609, nArg, uint8(SQLITE_UTF8), uint8(0)) /* The sqlite3CreateFunc() call above cannot fail ** because the "like" SQL-function already exists */ **(**Tu32)(__ccgo_up(pDef + 4)) |= libc.Uint32FromInt32(flags) **(**Tu32)(__ccgo_up(pDef + 4)) &= libc.Uint32FromInt32(^libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)) goto _1 _1: ; nArg = nArg + 1 } } // C documentation // // /* // ** This routine does per-connection function registration. Most // ** of the built-in functions above are part of the global function set. // ** This routine only deals with those that are not global. // */ func _sqlite3RegisterPerConnectionBuiltinFunctions(tls *libc.TLS, db uintptr) { var rc int32 _ = rc rc = Xsqlite3_overload_function(tls, db, __ccgo_ts+16603, int32(2)) if rc == int32(SQLITE_NOMEM) { _sqlite3OomFault(tls, db) } } // C documentation // // /* // ** The following routines are substitutes for constants SQLITE_CORRUPT, // ** SQLITE_MISUSE, SQLITE_CANTOPEN, SQLITE_NOMEM and possibly other error // ** constants. They serve two purposes: // ** // ** 1. Serve as a convenient place to set a breakpoint in a debugger // ** to detect when version error conditions occurs. // ** // ** 2. Invoke sqlite3_log() to provide the source code location where // ** a low-level error is first detected. // */ func _sqlite3ReportError(tls *libc.TLS, iErr int32, lineno int32, zType uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) Xsqlite3_log(tls, iErr, __ccgo_ts+26271, libc.VaList(bp+8, zType, lineno, uintptr(20)+Xsqlite3_sourceid(tls))) return iErr } // C documentation // // /* // ** Use the content of the StrAccum passed as the second argument // ** as the result of an SQL function. // */ func _sqlite3ResultStrAccum(tls *libc.TLS, pCtx uintptr, p uintptr) { if (*TStrAccum)(unsafe.Pointer(p)).FaccError != 0 { Xsqlite3_result_error_code(tls, pCtx, libc.Int32FromUint8((*TStrAccum)(unsafe.Pointer(p)).FaccError)) Xsqlite3_str_reset(tls, p) } else { if libc.Int32FromUint8((*TStrAccum)(unsafe.Pointer(p)).FprintfFlags)&int32(SQLITE_PRINTF_MALLOCED) != 0 { Xsqlite3_result_text(tls, pCtx, (*TStrAccum)(unsafe.Pointer(p)).FzText, libc.Int32FromUint32((*TStrAccum)(unsafe.Pointer(p)).FnChar), __ccgo_fp(_sqlite3RowSetClear)) } else { Xsqlite3_result_text(tls, pCtx, __ccgo_ts+1704, 0, libc.UintptrFromInt32(0)) Xsqlite3_str_reset(tls, p) } } } // C documentation // // /* // ** Register the r-tree module with database handle db. This creates the // ** virtual table module "rtree" and the debugging/analysis scalar // ** function "rtreenode". // */ func _sqlite3RtreeInit(tls *libc.TLS, db uintptr) (r int32) { var c, c1 uintptr var rc, utf8 int32 _, _, _, _ = c, c1, rc, utf8 utf8 = int32(SQLITE_UTF8) rc = Xsqlite3_create_function(tls, db, __ccgo_ts+30229, int32(2), utf8, uintptr(0), __ccgo_fp(_rtreenode), uintptr(0), uintptr(0)) if rc == SQLITE_OK { rc = Xsqlite3_create_function(tls, db, __ccgo_ts+30239, int32(1), utf8, uintptr(0), __ccgo_fp(_rtreedepth), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { rc = Xsqlite3_create_function(tls, db, __ccgo_ts+30250, -int32(1), utf8, uintptr(0), __ccgo_fp(_rtreecheck), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { c = libc.UintptrFromInt32(RTREE_COORD_REAL32) rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+29973, uintptr(unsafe.Pointer(&_rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { c1 = libc.UintptrFromInt32(RTREE_COORD_INT32) rc = Xsqlite3_create_module_v2(tls, db, __ccgo_ts+30261, uintptr(unsafe.Pointer(&_rtreeModule)), c1, uintptr(0)) } if rc == SQLITE_OK { rc = _sqlite3_geopoly_init(tls, db) } return rc } // C documentation // // /* // ** 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(). // */ func _sqlite3SafetyCheckOk(tls *libc.TLS, db uintptr) (r int32) { var eOpenState Tu8 _ = eOpenState if db == uintptr(0) { _logBadConnection(tls, __ccgo_ts+1705) return 0 } eOpenState = (*Tsqlite3)(unsafe.Pointer(db)).FeOpenState if libc.Int32FromUint8(eOpenState) != int32(SQLITE_STATE_OPEN) { if _sqlite3SafetyCheckSickOrOk(tls, db) != 0 { _logBadConnection(tls, __ccgo_ts+1897) } return 0 } else { return int32(1) } return r } func _sqlite3SafetyCheckSickOrOk(tls *libc.TLS, db uintptr) (r int32) { var eOpenState Tu8 _ = eOpenState eOpenState = (*Tsqlite3)(unsafe.Pointer(db)).FeOpenState if libc.Int32FromUint8(eOpenState) != int32(SQLITE_STATE_SICK) && libc.Int32FromUint8(eOpenState) != int32(SQLITE_STATE_OPEN) && libc.Int32FromUint8(eOpenState) != int32(SQLITE_STATE_BUSY) { _logBadConnection(tls, __ccgo_ts+1906) return 0 } else { return int32(1) } return r } // C documentation // // /* // ** Name of the connection operator, used for error messages. // */ func _sqlite3SelectOpName(tls *libc.TLS, id int32) (r uintptr) { var z uintptr _ = z switch id { case int32(TK_ALL): z = __ccgo_ts + 20489 case int32(TK_INTERSECT): z = __ccgo_ts + 20499 case int32(TK_EXCEPT): z = __ccgo_ts + 20509 default: z = __ccgo_ts + 20516 break } return z } // C documentation // // /* // ** Error message for when two or more terms of a compound select have different // ** size result sets. // */ func _sqlite3SelectWrongNumTermsError(tls *libc.TLS, pParse uintptr, p uintptr) { bp := tls.Alloc(16) defer tls.Free(16) if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Values) != 0 { _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20868, 0) } else { _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+20914, libc.VaList(bp+8, _sqlite3SelectOpName(tls, libc.Int32FromUint8((*TSelect)(unsafe.Pointer(p)).Fop)))) } } var _sqlite3StdType = [6]uintptr{ 0: __ccgo_ts + 1165, 1: __ccgo_ts + 1169, 2: __ccgo_ts + 1174, 3: __ccgo_ts + 1178, 4: __ccgo_ts + 1186, 5: __ccgo_ts + 1191, } /************** End of global.c **********************************************/ /************** Begin file status.c ******************************************/ /* ** 2008 June 18 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This module implements the sqlite3_status() interface and related ** functionality. */ /* #include "sqliteInt.h" */ /************** Include vdbeInt.h in the middle of status.c ******************/ /************** Begin file vdbeInt.h *****************************************/ /* ** 2003 September 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This is the header file for information that is private to the ** VDBE. This information used to all be at the top of the single ** source code file "vdbe.c". When that file became too big (over ** 6000 lines long) it was split up into several smaller files and ** this header information was factored out. */ /* ** The maximum number of times that a statement will try to reparse ** itself before giving up and returning SQLITE_SCHEMA. */ /* ** VDBE_DISPLAY_P4 is true or false depending on whether or not the ** "explain" P4 display logic is enabled. */ // C documentation // // /* // ** Load the Parse object passed as the first argument with an error // ** message of the form: // ** // ** "sub-select returns N columns - expected M" // */ func _sqlite3SubselectError(tls *libc.TLS, pParse uintptr, nActual int32, nExpect int32) { bp := tls.Alloc(32) defer tls.Free(32) var zFmt uintptr _ = zFmt if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 { zFmt = __ccgo_ts + 8289 _sqlite3ErrorMsg(tls, pParse, zFmt, libc.VaList(bp+8, nActual, nExpect)) } } // C documentation // // /* The table or view or trigger name is passed to this routine via tokens // ** pName1 and pName2. If the table name was fully qualified, for example: // ** // ** CREATE TABLE xxx.yyy (...); // ** // ** Then pName1 is set to "xxx" and pName2 "yyy". On the other hand if // ** the table name is not fully qualified, i.e.: // ** // ** CREATE TABLE yyy(...); // ** // ** Then pName1 is set to "yyy" and pName2 is "". // ** // ** This routine sets the *ppUnqual pointer to point at the token (pName1 or // ** pName2) that stores the unqualified table name. The index of the // ** database "xxx" is returned. // */ func _sqlite3TwoPartName(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintptr, pUnqual uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var db uintptr var iDb int32 _, _ = db, iDb /* Database holding the object */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb if (*TToken)(unsafe.Pointer(pName2)).Fn > uint32(0) { if (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy != 0 { _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13730, 0) return -int32(1) } **(**uintptr)(__ccgo_up(pUnqual)) = pName2 iDb = _sqlite3FindDb(tls, db, pName1) if iDb < 0 { _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13747, libc.VaList(bp+8, pName1)) return -int32(1) } } else { iDb = libc.Int32FromUint8((*Tsqlite3)(unsafe.Pointer(db)).Finit1.FiDb) **(**uintptr)(__ccgo_up(pUnqual)) = pName1 } return iDb } // C documentation // // /* // ** Window *pWin has just been created from a WINDOW clause. Token pBase // ** is the base window. Earlier windows from the same WINDOW clause are // ** stored in the linked list starting at pWin->pNextWin. This function // ** either updates *pWin according to the base specification, or else // ** leaves an error in pParse. // */ func _sqlite3WindowChain(tls *libc.TLS, pParse uintptr, pWin uintptr, pList uintptr) { bp := tls.Alloc(32) defer tls.Free(32) var db, pExist, zErr uintptr _, _, _ = db, pExist, zErr if (*TWindow)(unsafe.Pointer(pWin)).FzBase != 0 { db = (*TParse)(unsafe.Pointer(pParse)).Fdb pExist = _windowFind(tls, pParse, pList, (*TWindow)(unsafe.Pointer(pWin)).FzBase) if pExist != 0 { zErr = uintptr(0) /* Check for errors */ if (*TWindow)(unsafe.Pointer(pWin)).FpPartition != 0 { zErr = __ccgo_ts + 24491 } else { if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 && (*TWindow)(unsafe.Pointer(pWin)).FpOrderBy != 0 { zErr = __ccgo_ts + 24508 } else { if libc.Int32FromUint8((*TWindow)(unsafe.Pointer(pExist)).FbImplicitFrame) == 0 { zErr = __ccgo_ts + 24524 } } } if zErr != 0 { _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+24544, libc.VaList(bp+8, zErr, (*TWindow)(unsafe.Pointer(pWin)).FzBase)) } else { (*TWindow)(unsafe.Pointer(pWin)).FpPartition = _sqlite3ExprListDup(tls, db, (*TWindow)(unsafe.Pointer(pExist)).FpPartition, 0) if (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy != 0 { (*TWindow)(unsafe.Pointer(pWin)).FpOrderBy = _sqlite3ExprListDup(tls, db, (*TWindow)(unsafe.Pointer(pExist)).FpOrderBy, 0) } _sqlite3DbFree(tls, db, (*TWindow)(unsafe.Pointer(pWin)).FzBase) (*TWindow)(unsafe.Pointer(pWin)).FzBase = uintptr(0) } } } } // C documentation // // /* // ** An array of names of all compile-time options. This array should // ** be sorted A-Z. // ** // ** This array looks large, but in a typical installation actually uses // ** only a handful of compile-time options, so most times this array is usually // ** rather short and uses little memory space. // */ var _sqlite3azCompileOpt = [56]uintptr{ 0: __ccgo_ts, 1: __ccgo_ts + 20, 2: __ccgo_ts + 40, 3: __ccgo_ts + 59, 4: __ccgo_ts + 84, 5: __ccgo_ts + 106, 6: __ccgo_ts + 136, 7: __ccgo_ts + 156, 8: __ccgo_ts + 176, 9: __ccgo_ts + 199, 10: __ccgo_ts + 224, 11: __ccgo_ts + 251, 12: __ccgo_ts + 276, 13: __ccgo_ts + 298, 14: __ccgo_ts + 330, 15: __ccgo_ts + 356, 16: __ccgo_ts + 381, 17: __ccgo_ts + 402, 18: __ccgo_ts + 420, 19: __ccgo_ts + 443, 20: __ccgo_ts + 462, 21: __ccgo_ts + 481, 22: __ccgo_ts + 493, 23: __ccgo_ts + 508, 24: __ccgo_ts + 530, 25: __ccgo_ts + 555, 26: __ccgo_ts + 578, 27: __ccgo_ts + 600, 28: __ccgo_ts + 611, 29: __ccgo_ts + 624, 30: __ccgo_ts + 639, 31: __ccgo_ts + 655, 32: __ccgo_ts + 668, 33: __ccgo_ts + 689, 34: __ccgo_ts + 713, 35: __ccgo_ts + 736, 36: __ccgo_ts + 752, 37: __ccgo_ts + 768, 38: __ccgo_ts + 792, 39: __ccgo_ts + 819, 40: __ccgo_ts + 839, 41: __ccgo_ts + 861, 42: __ccgo_ts + 883, 43: __ccgo_ts + 913, 44: __ccgo_ts + 938, 45: __ccgo_ts + 964, 46: __ccgo_ts + 984, 47: __ccgo_ts + 1010, 48: __ccgo_ts + 1033, 49: __ccgo_ts + 1059, 50: __ccgo_ts + 1081, 51: __ccgo_ts + 1102, 52: __ccgo_ts + 1117, 53: __ccgo_ts + 1125, 54: __ccgo_ts + 1139, 55: __ccgo_ts + 1152, } // C documentation // // /* // ** Write an error message into pParse->zErrMsg that explains that the // ** user-supplied authorization function returned an illegal value. // */ func _sqliteAuthBadReturnCode(tls *libc.TLS, pParse uintptr) { _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+13613, 0) (*TParse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_ERROR) } var _statGetFuncdef = TFuncDef{ FnArg: int16(libc.Int32FromInt32(1) + libc.Int32FromInt32(IsStat4)), FfuncFlags: uint32(SQLITE_UTF8), FzName: __ccgo_ts + 13025, } var _statInitFuncdef = TFuncDef{ FnArg: int16(4), FfuncFlags: uint32(SQLITE_UTF8), FzName: __ccgo_ts + 12988, } var _statPushFuncdef = TFuncDef{ FnArg: int16(libc.Int32FromInt32(2) + libc.Int32FromInt32(IsStat4)), FfuncFlags: uint32(SQLITE_UTF8), FzName: __ccgo_ts + 12998, } func _sumFinalize(tls *libc.TLS, context uintptr) { var p uintptr _ = p p = Xsqlite3_aggregate_context(tls, context, 0) if p != 0 && (*TSumCtx)(unsafe.Pointer(p)).Fcnt > 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fapprox != 0 { if (*TSumCtx)(unsafe.Pointer(p)).Fovrfl != 0 { Xsqlite3_result_error(tls, context, __ccgo_ts+16462, -int32(1)) } else { if !(_sqlite3IsOverflow(tls, (*TSumCtx)(unsafe.Pointer(p)).FrErr) != 0) { Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum+(*TSumCtx)(unsafe.Pointer(p)).FrErr) } else { Xsqlite3_result_double(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FrSum) } } } else { Xsqlite3_result_int64(tls, context, (*TSumCtx)(unsafe.Pointer(p)).FiSum) } } } // C documentation // // /* // ** Return true if it is not allowed to drop the given table // */ func _tableMayNotBeDropped(tls *libc.TLS, db uintptr, pTab uintptr) (r int32) { if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+6760, int32(7)) == 0 { if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+3567, int32(4)) == 0 { return 0 } if Xsqlite3_strnicmp(tls, (*TTable)(unsafe.Pointer(pTab)).FzName+uintptr(7), __ccgo_ts+7562, int32(10)) == 0 { return 0 } return int32(1) } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Shadow) != uint32(0) && _sqlite3ReadOnlyShadowTables(tls, db) != 0 { return int32(1) } if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Eponymous) != 0 { return int32(1) } return 0 } var _tkCoalesce = TToken{ Fz: __ccgo_ts + 6965, Fn: uint32(8), } // C documentation // // /* // ** Return a list of all triggers on table pTab if there exists at least // ** one trigger that must be fired when an operation of type 'op' is // ** performed on the table, and, if that operation is an UPDATE, if at // ** least one of the columns in pChanges is being modified. // */ func _triggersReallyExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, pChanges uintptr, pMask uintptr) (r uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var mask int32 var p, pList, v1 uintptr _, _, _, _ = mask, p, pList, v1 mask = 0 pList = uintptr(0) pList = _sqlite3TriggerList(tls, pParse, pTab) if pList != uintptr(0) { p = pList if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).Fflags&uint64(SQLITE_EnableTrigger) == uint64(0) && (*TTable)(unsafe.Pointer(pTab)).FpTrigger != uintptr(0) && _sqlite3SchemaToIndex(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TTrigger)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FpTrigger)).FpSchema) != int32(1) { /* The SQLITE_DBCONFIG_ENABLE_TRIGGER setting is off. That means that ** only TEMP triggers are allowed. Truncate the pList so that it ** includes only TEMP triggers */ if pList == (*TTable)(unsafe.Pointer(pTab)).FpTrigger { pList = uintptr(0) goto exit_triggers_exist } for (*TTrigger)(unsafe.Pointer(p)).FpNext != 0 && (*TTrigger)(unsafe.Pointer(p)).FpNext != (*TTable)(unsafe.Pointer(pTab)).FpTrigger { p = (*TTrigger)(unsafe.Pointer(p)).FpNext } (*TTrigger)(unsafe.Pointer(p)).FpNext = uintptr(0) p = pList } for cond := true; cond; cond = p != 0 { if libc.Int32FromUint8((*TTrigger)(unsafe.Pointer(p)).Fop) == op && _checkColumnOverlap(tls, (*TTrigger)(unsafe.Pointer(p)).FpColumns, pChanges) != 0 { mask = mask | libc.Int32FromUint8((*TTrigger)(unsafe.Pointer(p)).Ftr_tm) } else { if libc.Int32FromUint8((*TTrigger)(unsafe.Pointer(p)).Fop) == int32(TK_RETURNING) { /* The first time a RETURNING trigger is seen, the "op" value tells ** us what time of trigger it should be. */ (*TTrigger)(unsafe.Pointer(p)).Fop = libc.Uint8FromInt32(op) if libc.Int32FromUint8((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { if op != int32(TK_INSERT) { if op == int32(TK_DELETE) { v1 = __ccgo_ts + 22464 } else { v1 = __ccgo_ts + 22471 } _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+22478, libc.VaList(bp+8, v1)) } (*TTrigger)(unsafe.Pointer(p)).Ftr_tm = uint8(TRIGGER_BEFORE) } else { (*TTrigger)(unsafe.Pointer(p)).Ftr_tm = uint8(TRIGGER_AFTER) } mask = mask | libc.Int32FromUint8((*TTrigger)(unsafe.Pointer(p)).Ftr_tm) } else { if (*TTrigger)(unsafe.Pointer(p)).FbReturning != 0 && libc.Int32FromUint8((*TTrigger)(unsafe.Pointer(p)).Fop) == int32(TK_INSERT) && op == int32(TK_UPDATE) && (*TParse)(unsafe.Pointer(pParse)).FpToplevel == uintptr(0) { /* Also fire a RETURNING trigger for an UPSERT */ mask = mask | libc.Int32FromUint8((*TTrigger)(unsafe.Pointer(p)).Ftr_tm) } } } p = (*TTrigger)(unsafe.Pointer(p)).FpNext } } goto exit_triggers_exist exit_triggers_exist: ; if pMask != 0 { **(**int32)(__ccgo_up(pMask)) = mask } if mask != 0 { v1 = pList } else { v1 = uintptr(0) } return v1 } // C documentation // // /* // ** Delete the file at zPath. If the dirSync argument is true, fsync() // ** the directory after deleting the file. // */ func _unixDelete(tls *libc.TLS, NotUsed uintptr, zPath uintptr, dirSync int32) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var rc int32 var _ /* fd at bp+0 */ int32 _ = rc rc = SQLITE_OK _ = NotUsed if (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(16)].FpCurrent})))(tls, zPath) == -int32(1) { if **(**int32)(__ccgo_up(libc.X__errno_location(tls))) == int32(ENOENT) { rc = libc.Int32FromInt32(SQLITE_IOERR) | libc.Int32FromInt32(23)< 0 { nByte = (nByte + int64((*TunixFile)(unsafe.Pointer(pFile)).FszChunk) - int64(1)) / int64((*TunixFile)(unsafe.Pointer(pFile)).FszChunk) * int64((*TunixFile)(unsafe.Pointer(pFile)).FszChunk) } rc = _robust_ftruncate(tls, (*TunixFile)(unsafe.Pointer(pFile)).Fh, nByte) if rc != 0 { _storeLastErrno(tls, pFile, **(**int32)(__ccgo_up(libc.X__errno_location(tls)))) return _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(6)< nMax { rx = _sqlite3OsTruncate(tls, (*TWal)(unsafe.Pointer(pWal)).FpWalFd, nMax) } _sqlite3EndBenignMalloc(tls) if rx != 0 { Xsqlite3_log(tls, rx, __ccgo_ts+4317, libc.VaList(bp+16, (*TWal)(unsafe.Pointer(pWal)).FzWalName)) } } // C documentation // // /* // ** A "PRECEDING " (eCond==0) or "FOLLOWING " (eCond==1) or the // ** value of the second argument to nth_value() (eCond==2) has just been // ** evaluated and the result left in register reg. This function generates VM // ** code to check that the value is a non-negative integer and throws an // ** exception if it is not. // */ func _windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { var regString, regZero int32 var v uintptr _, _, _ = regString, regZero, v v = _sqlite3GetVdbe(tls, pParse) regZero = _sqlite3GetTempReg(tls, pParse) _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, regZero) if eCond >= int32(WINDOW_STARTING_NUM) { regString = _sqlite3GetTempReg(tls, pParse) _sqlite3VdbeAddOp4(tls, v, int32(OP_String8), 0, regString, 0, __ccgo_ts+1704, -int32(1)) _sqlite3VdbeAddOp3(tls, v, int32(OP_Ge), regString, _sqlite3VdbeCurrentAddr(tls, v)+int32(2), reg) _sqlite3VdbeChangeP5(tls, v, libc.Uint16FromInt32(libc.Int32FromInt32(SQLITE_AFF_NUMERIC)|libc.Int32FromInt32(SQLITE_JUMPIFNULL))) } else { _sqlite3VdbeAddOp2(tls, v, int32(OP_MustBeInt), reg, _sqlite3VdbeCurrentAddr(tls, v)+int32(2)) } _sqlite3VdbeAddOp3(tls, v, _aOp1[eCond], regZero, _sqlite3VdbeCurrentAddr(tls, v)+int32(2), reg) _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_AFF_NUMERIC)) /* NULL case captured by */ /* the OP_MustBeInt */ /* NULL case caught by */ /* the OP_Ge */ _sqlite3MayAbort(tls, pParse) _sqlite3VdbeAddOp2(tls, v, int32(OP_Halt), int32(SQLITE_ERROR), int32(OE_Abort)) _sqlite3VdbeAppendP4(tls, v, _azErr[eCond], -int32(1)) _sqlite3ReleaseTempReg(tls, pParse, regZero) } func _windowFind(tls *libc.TLS, pParse uintptr, pList uintptr, zName uintptr) (r uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var p uintptr _ = p p = pList for { if !(p != 0) { break } if _sqlite3StrICmp(tls, (*TWindow)(unsafe.Pointer(p)).FzName, zName) == 0 { break } goto _1 _1: ; p = (*TWindow)(unsafe.Pointer(p)).FpNextWin } if p == uintptr(0) { _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+24280, libc.VaList(bp+8, zName)) } return p } // C documentation // // /* // ** The following routine is called if the stack overflows. // */ func _yyStackOverflow(tls *libc.TLS, yypParser uintptr) { var pParse uintptr _ = pParse pParse = (*TyyParser)(unsafe.Pointer(yypParser)).FpParse for (*TyyParser)(unsafe.Pointer(yypParser)).Fyytos > (*TyyParser)(unsafe.Pointer(yypParser)).Fyystack { _yy_pop_parser_stack(tls, yypParser) } /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ if (*TParse)(unsafe.Pointer(pParse)).FnErr == 0 { _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+24983, 0) } /******** End %stack_overflow code ********************************************/ /* Suppress warning about unused %extra_argument var */ (*TyyParser)(unsafe.Pointer(yypParser)).FpParse = pParse } /* ** Print tracing information for a SHIFT action */