// Code generated by modernc.org/undup from the per-target sqlite_*.go files; DO NOT EDIT. //go:build (freebsd && 386) || (freebsd && arm) package sqlite3 import ( "unsafe" "modernc.org/libc" ) const RSIZE_MAX = 2147483647 type Tcap_ioctl_t = uint32 type Tcritical_t = int32 type Tfd_set = struct { F__fds_bits [32]t__fd_mask } type Tsyscallarg_t = int32 type Tu_register_t = uint32 type Tvm_offset_t = uint32 type Tvm_size_t = uint32 // C documentation // // /* // ** Create an sqlite3_backup process to copy the contents of zSrcDb from // ** connection handle pSrcDb to zDestDb in pDestDb. If successful, return // ** a pointer to the new sqlite3_backup object. // ** // ** If an error occurs, NULL is returned and an error code and error message // ** stored in database handle pDestDb. // */ func Xsqlite3_backup_init(tls *libc.TLS, pDestDb uintptr, zDestDb uintptr, pSrcDb uintptr, zSrcDb uintptr) (r uintptr) { var nDest int32 var p, pDest uintptr _, _, _ = nDest, p, pDest /* Value to return */ /* Lock the source database handle. The destination database ** handle is not locked in this routine, but it is locked in ** sqlite3_backup_step(). The user is required to ensure that no ** other thread accesses the destination handle for the duration ** of the backup operation. Any attempt to use the destination ** database connection while a backup is in progress may cause ** a malfunction or a deadlock. */ Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(pSrcDb)).Fmutex) Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(pDestDb)).Fmutex) if pSrcDb == pDestDb { _sqlite3ErrorWithMsg(tls, pDestDb, int32(SQLITE_ERROR), __ccgo_ts+5178, 0) p = uintptr(0) } else { nDest = _sqlite3Strlen30(tls, zDestDb) /* Allocate space for a new sqlite3_backup object... ** EVIDENCE-OF: R-64852-21591 The sqlite3_backup object is created by a ** call to sqlite3_backup_init() and is destroyed by a call to ** sqlite3_backup_finish(). */ p = _sqlite3MallocZero(tls, uint64(uint32(52)+libc.Uint32FromInt32(nDest)+uint32(1))) if !(p != 0) { _sqlite3Error(tls, pDestDb, int32(SQLITE_NOMEM)) } else { (*Tsqlite3_backup)(unsafe.Pointer(p)).FzDestDb = p + 1*52 libc.Xmemcpy(tls, (*Tsqlite3_backup)(unsafe.Pointer(p)).FzDestDb, zDestDb, libc.Uint32FromInt32(nDest)) } } /* If the allocation succeeded, populate the new object. */ if p != 0 { /* Do not store the pointer to the destination b-tree at this point. ** This is because there is nothing preventing it from being detached ** or otherwise freed before the first call to sqlite3_backup_step() ** on this object. The source b-tree does not have this problem, as ** incrementing Btree.nBackup (see below) effectively locks the object. */ pDest = _findBtree(tls, pDestDb, pDestDb, zDestDb) (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc = _findBtree(tls, pDestDb, pSrcDb, zSrcDb) (*Tsqlite3_backup)(unsafe.Pointer(p)).FpDestDb = pDestDb (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrcDb = pSrcDb (*Tsqlite3_backup)(unsafe.Pointer(p)).FiNext = uint32(1) (*Tsqlite3_backup)(unsafe.Pointer(p)).FisAttached = 0 if uintptr(0) == (*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc || uintptr(0) == pDest || _checkReadTransaction(tls, pDestDb, pDest) != SQLITE_OK { /* One (or both) of the named databases did not exist or an OOM ** error was hit. Or there is a transaction open on the destination ** database. The error has already been written into the pDestDb ** handle. All that is left to do here is free the sqlite3_backup ** structure. */ Xsqlite3_free(tls, p) p = uintptr(0) } } if p != 0 { (*TBtree)(unsafe.Pointer((*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc)).FnBackup = (*TBtree)(unsafe.Pointer((*Tsqlite3_backup)(unsafe.Pointer(p)).FpSrc)).FnBackup + 1 } Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(pDestDb)).Fmutex) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(pSrcDb)).Fmutex) return p } // C documentation // // /* // ** Open a blob handle. // */ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, zColumn uintptr, iRow Tsqlite_int64, wrFlag int32, ppBlob uintptr) (r int32) { bp := tls.Alloc(304) defer tls.Free(304) var aOp, pBlob, pFKey, pIdx, pTab, v, zFault, v8 uintptr var iCol, iDb, j, j1, nAttempt, rc, v1 int32 var v2 bool var _ /* sParse at bp+4 */ TParse var _ /* zErr at bp+0 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aOp, iCol, iDb, j, j1, nAttempt, pBlob, pFKey, pIdx, pTab, rc, v, zFault, v1, v2, v8 nAttempt = 0 /* Index of zColumn in row-record */ rc = SQLITE_OK **(**uintptr)(__ccgo_up(bp)) = uintptr(0) pBlob = uintptr(0) **(**uintptr)(__ccgo_up(ppBlob)) = uintptr(0) wrFlag = libc.BoolInt32(!!(wrFlag != 0)) /* wrFlag = (wrFlag ? 1 : 0); */ Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) pBlob = _sqlite3DbMallocZero(tls, db, uint64(32)) for int32(1) != 0 { _sqlite3ParseObjectInit(tls, bp+4, db) if !(pBlob != 0) { goto blob_open_out } _sqlite3DbFree(tls, db, **(**uintptr)(__ccgo_up(bp))) **(**uintptr)(__ccgo_up(bp)) = uintptr(0) _sqlite3BtreeEnterAll(tls, db) pTab = _sqlite3LocateTable(tls, bp+4, uint32(0), zTable, zDb) if pTab != 0 && libc.Int32FromUint8((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VTAB) { pTab = uintptr(0) _sqlite3ErrorMsg(tls, bp+4, __ccgo_ts+6551, libc.VaList(bp+296, zTable)) } if pTab != 0 && !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) { pTab = uintptr(0) _sqlite3ErrorMsg(tls, bp+4, __ccgo_ts+6581, libc.VaList(bp+296, zTable)) } if pTab != 0 && (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_HasGenerated) != uint32(0) { pTab = uintptr(0) _sqlite3ErrorMsg(tls, bp+4, __ccgo_ts+6617, libc.VaList(bp+296, zTable)) } if pTab != 0 && libc.Int32FromUint8((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { pTab = uintptr(0) _sqlite3ErrorMsg(tls, bp+4, __ccgo_ts+6662, libc.VaList(bp+296, zTable)) } if v2 = pTab == uintptr(0); !v2 { v1 = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) iDb = v1 } if v2 || v1 == int32(1) && _sqlite3OpenTempDatabase(tls, bp+4) != 0 { if (**(**TParse)(__ccgo_up(bp + 4))).FzErrMsg != 0 { _sqlite3DbFree(tls, db, **(**uintptr)(__ccgo_up(bp))) **(**uintptr)(__ccgo_up(bp)) = (**(**TParse)(__ccgo_up(bp + 4))).FzErrMsg (**(**TParse)(__ccgo_up(bp + 4))).FzErrMsg = uintptr(0) } rc = int32(SQLITE_ERROR) _sqlite3BtreeLeaveAll(tls, db) goto blob_open_out } (*TIncrblob)(unsafe.Pointer(pBlob)).FpTab = pTab (*TIncrblob)(unsafe.Pointer(pBlob)).FzDb = (**(**TDb)(__ccgo_up((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName /* Now search pTab for the exact column. */ iCol = _sqlite3ColumnIndex(tls, pTab, zColumn) if iCol < 0 { _sqlite3DbFree(tls, db, **(**uintptr)(__ccgo_up(bp))) **(**uintptr)(__ccgo_up(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6683, libc.VaList(bp+296, zColumn)) rc = int32(SQLITE_ERROR) _sqlite3BtreeLeaveAll(tls, db) goto blob_open_out } /* If the value is being opened for writing, check that the ** column is not indexed, and that it is not part of a foreign key. */ if wrFlag != 0 { zFault = uintptr(0) if (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_ForeignKeys) != 0 { pFKey = (*(*struct { FaddColOffset int32 FpFKey uintptr FpDfltList uintptr })(unsafe.Pointer(pTab + 44))).FpFKey for { if !(pFKey != 0) { break } j = 0 for { if !(j < (*TFKey)(unsafe.Pointer(pFKey)).FnCol) { break } if (*(*TsColMap)(unsafe.Pointer(pFKey + 36 + uintptr(j)*8))).FiFrom == iCol { zFault = __ccgo_ts + 6704 } goto _4 _4: ; j = j + 1 } goto _3 _3: ; pFKey = (*TFKey)(unsafe.Pointer(pFKey)).FpNextFrom } } pIdx = (*TTable)(unsafe.Pointer(pTab)).FpIndex for { if !(pIdx != 0) { break } j1 = 0 for { if !(j1 < libc.Int32FromUint16((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol)) { break } /* FIXME: Be smarter about indexes that use expressions */ if int32(**(**Ti16)(__ccgo_up((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == iCol || int32(**(**Ti16)(__ccgo_up((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == -int32(2) { zFault = __ccgo_ts + 6716 } goto _6 _6: ; j1 = j1 + 1 } goto _5 _5: ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } if zFault != 0 { _sqlite3DbFree(tls, db, **(**uintptr)(__ccgo_up(bp))) **(**uintptr)(__ccgo_up(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+6724, libc.VaList(bp+296, zFault)) rc = int32(SQLITE_ERROR) _sqlite3BtreeLeaveAll(tls, db) goto blob_open_out } } (*TIncrblob)(unsafe.Pointer(pBlob)).FpStmt = _sqlite3VdbeCreate(tls, bp+4) if (*TIncrblob)(unsafe.Pointer(pBlob)).FpStmt != 0 { v = (*TIncrblob)(unsafe.Pointer(pBlob)).FpStmt _sqlite3VdbeAddOp4Int(tls, v, int32(OP_Transaction), iDb, wrFlag, (*TSchema)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FpSchema)).Fschema_cookie, (*TSchema)(unsafe.Pointer((*TTable)(unsafe.Pointer(pTab)).FpSchema)).FiGeneration) _sqlite3VdbeChangeP5(tls, v, uint16(1)) aOp = _sqlite3VdbeAddOpList(tls, v, libc.Int32FromUint32(libc.Uint32FromInt64(24)/libc.Uint32FromInt64(4)), uintptr(unsafe.Pointer(&_openBlob)), _iLn) /* Make sure a mutex is held on the table to be accessed */ _sqlite3VdbeUsesBtree(tls, v, iDb) if libc.Int32FromUint8((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { /* Configure the OP_TableLock instruction */ (**(**TVdbeOp)(__ccgo_up(aOp))).Fp1 = iDb (**(**TVdbeOp)(__ccgo_up(aOp))).Fp2 = libc.Int32FromUint32((*TTable)(unsafe.Pointer(pTab)).Ftnum) (**(**TVdbeOp)(__ccgo_up(aOp))).Fp3 = wrFlag _sqlite3VdbeChangeP4(tls, v, int32(2), (*TTable)(unsafe.Pointer(pTab)).FzName, P4_TRANSIENT) } if libc.Int32FromUint8((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { /* Remove either the OP_OpenWrite or OpenRead. Set the P2 ** parameter of the other to pTab->tnum. */ if wrFlag != 0 { (**(**TVdbeOp)(__ccgo_up(aOp + 1*20))).Fopcode = uint8(OP_OpenWrite) } (**(**TVdbeOp)(__ccgo_up(aOp + 1*20))).Fp2 = libc.Int32FromUint32((*TTable)(unsafe.Pointer(pTab)).Ftnum) (**(**TVdbeOp)(__ccgo_up(aOp + 1*20))).Fp3 = iDb /* Configure the number of columns. Configure the cursor to ** think that the table has one more column than it really ** does. An OP_Column to retrieve this imaginary column will ** always return an SQL NULL. This is useful because it means ** we can invoke OP_Column to fill in the vdbe cursors type ** and offset cache without causing any IO. */ (**(**TVdbeOp)(__ccgo_up(aOp + 1*20))).Fp4type = int8(-libc.Int32FromInt32(3)) *(*int32)(unsafe.Pointer(aOp + 1*20 + 16)) = int32((*TTable)(unsafe.Pointer(pTab)).FnCol) + int32(1) (**(**TVdbeOp)(__ccgo_up(aOp + 3*20))).Fp2 = int32((*TTable)(unsafe.Pointer(pTab)).FnCol) (**(**TParse)(__ccgo_up(bp + 4))).FnVar = 0 (**(**TParse)(__ccgo_up(bp + 4))).FnMem = int32(1) (**(**TParse)(__ccgo_up(bp + 4))).FnTab = int32(1) _sqlite3VdbeMakeReady(tls, v, bp+4) } } (*TIncrblob)(unsafe.Pointer(pBlob)).FiCol = libc.Uint16FromInt32(iCol) (*TIncrblob)(unsafe.Pointer(pBlob)).Fdb = db _sqlite3BtreeLeaveAll(tls, db) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { goto blob_open_out } rc = _blobSeekToRow(tls, pBlob, iRow, bp) nAttempt = nAttempt + 1 v1 = nAttempt if v1 >= int32(SQLITE_MAX_SCHEMA_RETRY) || rc != int32(SQLITE_SCHEMA) { break } _sqlite3ParseObjectReset(tls, bp+4) } goto blob_open_out blob_open_out: ; if rc == SQLITE_OK && libc.Int32FromUint8((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { **(**uintptr)(__ccgo_up(ppBlob)) = pBlob } else { if pBlob != 0 && (*TIncrblob)(unsafe.Pointer(pBlob)).FpStmt != 0 { _sqlite3VdbeFinalize(tls, (*TIncrblob)(unsafe.Pointer(pBlob)).FpStmt) } _sqlite3DbFree(tls, db, pBlob) } if **(**uintptr)(__ccgo_up(bp)) != 0 { v8 = __ccgo_ts + 3942 } else { v8 = libc.UintptrFromInt32(0) } _sqlite3ErrorWithMsg(tls, db, rc, v8, libc.VaList(bp+296, **(**uintptr)(__ccgo_up(bp)))) _sqlite3DbFree(tls, db, **(**uintptr)(__ccgo_up(bp))) _sqlite3ParseObjectReset(tls, bp+4) rc = _sqlite3ApiExit(tls, db, rc) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return rc } // C documentation // // /* // ** This function is used to set the schema of a virtual table. It is only // ** valid to call this function from within the xCreate() or xConnect() of a // ** virtual table module. // */ func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) (r int32) { bp := tls.Alloc(304) defer tls.Free(304) var i, initBusy, rc int32 var pCtx, pIdx, pNew, pTab, z, v3 uintptr var v2 Ti16 var _ /* sParse at bp+0 */ TParse var _ /* tokenType at bp+284 */ int32 _, _, _, _, _, _, _, _, _, _ = i, initBusy, pCtx, pIdx, pNew, pTab, rc, z, v2, v3 rc = SQLITE_OK /* Verify that the first two keywords in the CREATE TABLE statement ** really are "CREATE" and "TABLE". If this is not the case, then ** sqlite3_declare_vtab() is being misused. */ z = zCreateTable i = 0 for { if !(_aKeyword1[i] != 0) { break } **(**int32)(__ccgo_up(bp + 284)) = 0 for cond := true; cond; cond = **(**int32)(__ccgo_up(bp + 284)) == int32(TK_SPACE) || **(**int32)(__ccgo_up(bp + 284)) == int32(TK_COMMENT) { z = z + uintptr(_sqlite3GetToken(tls, z, bp+284)) } if **(**int32)(__ccgo_up(bp + 284)) != libc.Int32FromUint8(_aKeyword1[i]) { _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), __ccgo_ts+23607, 0) return int32(SQLITE_ERROR) } goto _1 _1: ; i = i + 1 } Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) pCtx = (*Tsqlite3)(unsafe.Pointer(db)).FpVtabCtx if !(pCtx != 0) || (*TVtabCtx)(unsafe.Pointer(pCtx)).FbDeclared != 0 { _sqlite3Error(tls, db, _sqlite3MisuseError(tls, int32(162730))) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return _sqlite3MisuseError(tls, int32(162732)) } pTab = (*TVtabCtx)(unsafe.Pointer(pCtx)).FpTab _sqlite3ParseObjectInit(tls, bp, db) (**(**TParse)(__ccgo_up(bp))).FeParseMode = uint8(PARSE_MODE_DECLARE_VTAB) libc.SetBitFieldPtr16Uint32(bp+28, libc.Uint32FromInt32(1), 0, 0x1) /* We should never be able to reach this point while loading the ** schema. Nevertheless, defend against that (turn off db->init.busy) ** in case a bug arises. */ initBusy = libc.Int32FromUint8((*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy) (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy = uint8(0) (**(**TParse)(__ccgo_up(bp))).FnQueryLoop = int16(1) if SQLITE_OK == _sqlite3RunParser(tls, bp, zCreateTable) { if !((*TTable)(unsafe.Pointer(pTab)).FaCol != 0) { pNew = (**(**TParse)(__ccgo_up(bp))).FpNewTable (*TTable)(unsafe.Pointer(pTab)).FaCol = (*TTable)(unsafe.Pointer(pNew)).FaCol _sqlite3ExprListDelete(tls, db, (*(*struct { FaddColOffset int32 FpFKey uintptr FpDfltList uintptr })(unsafe.Pointer(pNew + 44))).FpDfltList) v2 = (*TTable)(unsafe.Pointer(pNew)).FnCol (*TTable)(unsafe.Pointer(pTab)).FnCol = v2 (*TTable)(unsafe.Pointer(pTab)).FnNVCol = v2 **(**Tu32)(__ccgo_up(pTab + 28)) |= (*TTable)(unsafe.Pointer(pNew)).FtabFlags & libc.Uint32FromInt32(libc.Int32FromInt32(TF_WithoutRowid)|libc.Int32FromInt32(TF_NoVisibleRowid)) (*TTable)(unsafe.Pointer(pNew)).FnCol = 0 (*TTable)(unsafe.Pointer(pNew)).FaCol = uintptr(0) if !((*TTable)(unsafe.Pointer(pNew)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && (*Tsqlite3_module)(unsafe.Pointer((*TModule)(unsafe.Pointer((*TVTable)(unsafe.Pointer((*TVtabCtx)(unsafe.Pointer(pCtx)).FpVTable)).FpMod)).FpModule)).FxUpdate != uintptr(0) && libc.Int32FromUint16((*TIndex)(unsafe.Pointer(_sqlite3PrimaryKeyIndex(tls, pNew))).FnKeyCol) != int32(1) { /* WITHOUT ROWID virtual tables must either be read-only (xUpdate==0) ** or else must have a single-column PRIMARY KEY */ rc = int32(SQLITE_ERROR) } pIdx = (*TTable)(unsafe.Pointer(pNew)).FpIndex if pIdx != 0 { (*TTable)(unsafe.Pointer(pTab)).FpIndex = pIdx (*TTable)(unsafe.Pointer(pNew)).FpIndex = uintptr(0) (*TIndex)(unsafe.Pointer(pIdx)).FpTable = pTab } } (*TVtabCtx)(unsafe.Pointer(pCtx)).FbDeclared = int32(1) } else { if (**(**TParse)(__ccgo_up(bp))).FzErrMsg != 0 { v3 = __ccgo_ts + 3942 } else { v3 = uintptr(0) } _sqlite3ErrorWithMsg(tls, db, int32(SQLITE_ERROR), v3, libc.VaList(bp+296, (**(**TParse)(__ccgo_up(bp))).FzErrMsg)) _sqlite3DbFree(tls, db, (**(**TParse)(__ccgo_up(bp))).FzErrMsg) rc = int32(SQLITE_ERROR) } (**(**TParse)(__ccgo_up(bp))).FeParseMode = uint8(PARSE_MODE_NORMAL) if (**(**TParse)(__ccgo_up(bp))).FpVdbe != 0 { _sqlite3VdbeFinalize(tls, (**(**TParse)(__ccgo_up(bp))).FpVdbe) } _sqlite3DeleteTable(tls, db, (**(**TParse)(__ccgo_up(bp))).FpNewTable) _sqlite3ParseObjectReset(tls, bp) (*Tsqlite3)(unsafe.Pointer(db)).Finit1.Fbusy = libc.Uint8FromInt32(initBusy) rc = _sqlite3ApiExit(tls, db, rc) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return rc } // C documentation // // /* // ** Query the database. But instead of invoking a callback for each row, // ** malloc() for space to hold the result and return the entire results // ** at the conclusion of the call. // ** // ** The result that is written to ***pazResult is held in memory obtained // ** from malloc(). But the caller cannot free this memory directly. // ** Instead, the entire table should be passed to sqlite3_free_table() when // ** the calling procedure is finished using it. // */ func Xsqlite3_get_table(tls *libc.TLS, db uintptr, zSql uintptr, pazResult uintptr, pnRow uintptr, pnColumn uintptr, pzErrMsg uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var azNew uintptr var rc int32 var _ /* res at bp+0 */ TTabResult _, _ = azNew, rc **(**uintptr)(__ccgo_up(pazResult)) = uintptr(0) if pnColumn != 0 { **(**int32)(__ccgo_up(pnColumn)) = 0 } if pnRow != 0 { **(**int32)(__ccgo_up(pnRow)) = 0 } if pzErrMsg != 0 { **(**uintptr)(__ccgo_up(pzErrMsg)) = uintptr(0) } (**(**TTabResult)(__ccgo_up(bp))).FzErrMsg = uintptr(0) (**(**TTabResult)(__ccgo_up(bp))).FnRow = uint32(0) (**(**TTabResult)(__ccgo_up(bp))).FnColumn = uint32(0) (**(**TTabResult)(__ccgo_up(bp))).FnData = uint32(1) (**(**TTabResult)(__ccgo_up(bp))).FnAlloc = uint32(20) (**(**TTabResult)(__ccgo_up(bp))).Frc = SQLITE_OK (**(**TTabResult)(__ccgo_up(bp))).FazResult = Xsqlite3_malloc64(tls, uint64(uint32(4)*(**(**TTabResult)(__ccgo_up(bp))).FnAlloc)) if (**(**TTabResult)(__ccgo_up(bp))).FazResult == uintptr(0) { (*Tsqlite3)(unsafe.Pointer(db)).FerrCode = int32(SQLITE_NOMEM) return int32(SQLITE_NOMEM) } **(**uintptr)(__ccgo_up((**(**TTabResult)(__ccgo_up(bp))).FazResult)) = uintptr(0) rc = Xsqlite3_exec(tls, db, zSql, __ccgo_fp(_sqlite3_get_table_cb), bp, pzErrMsg) **(**uintptr)(__ccgo_up((**(**TTabResult)(__ccgo_up(bp))).FazResult)) = uintptr(libc.Int32FromUint32((**(**TTabResult)(__ccgo_up(bp))).FnData)) if rc&int32(0xff) == int32(SQLITE_ABORT) { Xsqlite3_free_table(tls, (**(**TTabResult)(__ccgo_up(bp))).FazResult+1*4) if (**(**TTabResult)(__ccgo_up(bp))).FzErrMsg != 0 { if pzErrMsg != 0 { Xsqlite3_free(tls, **(**uintptr)(__ccgo_up(pzErrMsg))) **(**uintptr)(__ccgo_up(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+3942, libc.VaList(bp+40, (**(**TTabResult)(__ccgo_up(bp))).FzErrMsg)) } Xsqlite3_free(tls, (**(**TTabResult)(__ccgo_up(bp))).FzErrMsg) } (*Tsqlite3)(unsafe.Pointer(db)).FerrCode = (**(**TTabResult)(__ccgo_up(bp))).Frc /* Assume 32-bit assignment is atomic */ return (**(**TTabResult)(__ccgo_up(bp))).Frc } Xsqlite3_free(tls, (**(**TTabResult)(__ccgo_up(bp))).FzErrMsg) if rc != SQLITE_OK { Xsqlite3_free_table(tls, (**(**TTabResult)(__ccgo_up(bp))).FazResult+1*4) return rc } if (**(**TTabResult)(__ccgo_up(bp))).FnAlloc > (**(**TTabResult)(__ccgo_up(bp))).FnData { azNew = _sqlite3Realloc(tls, (**(**TTabResult)(__ccgo_up(bp))).FazResult, uint64(uint32(4)*(**(**TTabResult)(__ccgo_up(bp))).FnData)) if azNew == uintptr(0) { Xsqlite3_free_table(tls, (**(**TTabResult)(__ccgo_up(bp))).FazResult+1*4) (*Tsqlite3)(unsafe.Pointer(db)).FerrCode = int32(SQLITE_NOMEM) return int32(SQLITE_NOMEM) } (**(**TTabResult)(__ccgo_up(bp))).FazResult = azNew } **(**uintptr)(__ccgo_up(pazResult)) = (**(**TTabResult)(__ccgo_up(bp))).FazResult + 1*4 if pnColumn != 0 { **(**int32)(__ccgo_up(pnColumn)) = libc.Int32FromUint32((**(**TTabResult)(__ccgo_up(bp))).FnColumn) } if pnRow != 0 { **(**int32)(__ccgo_up(pnRow)) = libc.Int32FromUint32((**(**TTabResult)(__ccgo_up(bp))).FnRow) } return rc } // C documentation // // /* // ** Return the serialization of a database // */ func Xsqlite3_serialize(tls *libc.TLS, db uintptr, zSchema uintptr, piSize uintptr, mFlags uint32) (r uintptr) { bp := tls.Alloc(32) defer tls.Free(32) var iDb, nPage, pgno, rc, szPage, v1 int32 var p, pBt, pOut, pPager, pStore, pTo, zSql uintptr var sz Tsqlite3_int64 var _ /* pPage at bp+4 */ uintptr var _ /* pStmt at bp+0 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _ = iDb, nPage, p, pBt, pOut, pPager, pStore, pTo, pgno, rc, sz, szPage, zSql, v1 szPage = 0 **(**uintptr)(__ccgo_up(bp)) = uintptr(0) pOut = uintptr(0) Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) if zSchema == uintptr(0) { zSchema = (**(**TDb)(__ccgo_up((*Tsqlite3)(unsafe.Pointer(db)).FaDb))).FzDbSName } p = _memdbFromDbSchema(tls, db, zSchema) iDb = _sqlite3FindDbName(tls, db, zSchema) if piSize != 0 { **(**Tsqlite3_int64)(__ccgo_up(piSize)) = int64(-int32(1)) } if iDb < 0 { goto serialize_out } if p != 0 { pStore = (*TMemFile)(unsafe.Pointer(p)).FpStore if piSize != 0 { **(**Tsqlite3_int64)(__ccgo_up(piSize)) = (*TMemStore)(unsafe.Pointer(pStore)).Fsz } if mFlags&uint32(SQLITE_SERIALIZE_NOCOPY) != 0 { pOut = (*TMemStore)(unsafe.Pointer(pStore)).FaData } else { pOut = Xsqlite3_malloc64(tls, libc.Uint64FromInt64((*TMemStore)(unsafe.Pointer(pStore)).Fsz)) if pOut != 0 { libc.Xmemcpy(tls, pOut, (*TMemStore)(unsafe.Pointer(pStore)).FaData, libc.Uint32FromInt64((*TMemStore)(unsafe.Pointer(pStore)).Fsz)) } } goto serialize_out } pBt = (**(**TDb)(__ccgo_up((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FpBt if pBt == uintptr(0) { goto serialize_out } szPage = _sqlite3BtreeGetPageSize(tls, pBt) zSql = Xsqlite3_mprintf(tls, __ccgo_ts+4135, libc.VaList(bp+16, zSchema)) if zSql != 0 { v1 = Xsqlite3_prepare_v2(tls, db, zSql, -int32(1), bp, uintptr(0)) } else { v1 = int32(SQLITE_NOMEM) } rc = v1 Xsqlite3_free(tls, zSql) if rc != 0 { goto serialize_out } rc = Xsqlite3_step(tls, **(**uintptr)(__ccgo_up(bp))) if rc == int32(SQLITE_ROW) { sz = Xsqlite3_column_int64(tls, **(**uintptr)(__ccgo_up(bp)), 0) * int64(szPage) if sz == 0 { Xsqlite3_reset(tls, **(**uintptr)(__ccgo_up(bp))) Xsqlite3_exec(tls, db, __ccgo_ts+4158, uintptr(0), uintptr(0), uintptr(0)) rc = Xsqlite3_step(tls, **(**uintptr)(__ccgo_up(bp))) if rc == int32(SQLITE_ROW) { sz = Xsqlite3_column_int64(tls, **(**uintptr)(__ccgo_up(bp)), 0) * int64(szPage) } } if piSize != 0 { **(**Tsqlite3_int64)(__ccgo_up(piSize)) = sz } if mFlags&uint32(SQLITE_SERIALIZE_NOCOPY) != 0 { pOut = uintptr(0) } else { pOut = Xsqlite3_malloc64(tls, libc.Uint64FromInt64(sz)) if pOut != 0 { nPage = Xsqlite3_column_int(tls, **(**uintptr)(__ccgo_up(bp)), 0) pPager = _sqlite3BtreePager(tls, pBt) pgno = int32(1) for { if !(pgno <= nPage) { break } **(**uintptr)(__ccgo_up(bp + 4)) = uintptr(0) pTo = pOut + uintptr(int64(szPage)*int64(pgno-libc.Int32FromInt32(1))) rc = _sqlite3PagerGet(tls, pPager, libc.Uint32FromInt32(pgno), bp+4, 0) if rc == SQLITE_OK { libc.Xmemcpy(tls, pTo, _sqlite3PagerGetData(tls, **(**uintptr)(__ccgo_up(bp + 4))), libc.Uint32FromInt32(szPage)) } else { libc.Xmemset(tls, pTo, 0, libc.Uint32FromInt32(szPage)) } _sqlite3PagerUnref(tls, **(**uintptr)(__ccgo_up(bp + 4))) goto _2 _2: ; pgno = pgno + 1 } } } } Xsqlite3_finalize(tls, **(**uintptr)(__ccgo_up(bp))) goto serialize_out serialize_out: ; Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return pOut } // C documentation // // /* // ** Return meta information about a specific column of a database table. // ** See comment in sqlite3.h (sqlite.h.in) for details. // */ func Xsqlite3_table_column_metadata(tls *libc.TLS, db uintptr, zDbName uintptr, zTableName uintptr, zColumnName uintptr, pzDataType uintptr, pzCollSeq uintptr, pNotNull uintptr, pPrimaryKey uintptr, pAutoinc uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var autoinc, iCol, notnull, primarykey, rc int32 var pCol, pTab, zCollSeq, zDataType, v1 uintptr var _ /* zErrMsg at bp+0 */ uintptr _, _, _, _, _, _, _, _, _, _ = autoinc, iCol, notnull, pCol, pTab, primarykey, rc, zCollSeq, zDataType, v1 **(**uintptr)(__ccgo_up(bp)) = uintptr(0) pTab = uintptr(0) pCol = uintptr(0) iCol = 0 zDataType = uintptr(0) zCollSeq = uintptr(0) notnull = 0 primarykey = 0 autoinc = 0 /* Ensure the database schema has been loaded */ Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) _sqlite3BtreeEnterAll(tls, db) rc = _sqlite3Init(tls, db, bp) if SQLITE_OK != rc { goto error_out } /* Locate the table in question */ pTab = _sqlite3FindTable(tls, db, zTableName, zDbName) if !(pTab != 0) || libc.Int32FromUint8((*TTable)(unsafe.Pointer(pTab)).FeTabType) == int32(TABTYP_VIEW) { pTab = uintptr(0) goto error_out } /* Find the column for which info is requested */ if zColumnName == uintptr(0) { /* Query for existence of table only */ } else { iCol = _sqlite3ColumnIndex(tls, pTab, zColumnName) if iCol >= 0 { pCol = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*12 } else { if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) && _sqlite3IsRowid(tls, zColumnName) != 0 { iCol = int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) if iCol >= 0 { v1 = (*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*12 } else { v1 = uintptr(0) } pCol = v1 } else { pTab = uintptr(0) goto error_out } } } /* The following block stores the meta information that will be returned ** to the caller in local variables zDataType, zCollSeq, notnull, primarykey ** and autoinc. At this point there are two possibilities: ** ** 1. The specified column name was rowid", "oid" or "_rowid_" ** and there is no explicitly declared IPK column. ** ** 2. The table is not a view and the column name identified an ** explicitly declared column. Copy meta information from *pCol. */ if pCol != 0 { zDataType = _sqlite3ColumnType(tls, pCol, uintptr(0)) zCollSeq = _sqlite3ColumnColl(tls, pCol) notnull = libc.BoolInt32(int32(uint32(*(*uint8)(unsafe.Pointer(pCol + 4))&0xf>>0)) != 0) primarykey = libc.BoolInt32(libc.Int32FromUint16((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_PRIMKEY) != 0) autoinc = libc.BoolInt32(int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) == iCol && (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_Autoincrement) != uint32(0)) } else { zDataType = __ccgo_ts + 1176 primarykey = int32(1) } if !(zCollSeq != 0) { zCollSeq = uintptr(unsafe.Pointer(&_sqlite3StrBINARY)) } goto error_out error_out: ; _sqlite3BtreeLeaveAll(tls, db) /* Whether the function call succeeded or failed, set the output parameters ** to whatever their local counterparts contain. If an error did occur, ** this has the effect of zeroing all output parameters. */ if pzDataType != 0 { **(**uintptr)(__ccgo_up(pzDataType)) = zDataType } if pzCollSeq != 0 { **(**uintptr)(__ccgo_up(pzCollSeq)) = zCollSeq } if pNotNull != 0 { **(**int32)(__ccgo_up(pNotNull)) = notnull } if pPrimaryKey != 0 { **(**int32)(__ccgo_up(pPrimaryKey)) = primarykey } if pAutoinc != 0 { **(**int32)(__ccgo_up(pAutoinc)) = autoinc } if SQLITE_OK == rc && !(pTab != 0) { _sqlite3DbFree(tls, db, **(**uintptr)(__ccgo_up(bp))) **(**uintptr)(__ccgo_up(bp)) = _sqlite3MPrintf(tls, db, __ccgo_ts+26338, libc.VaList(bp+16, zTableName, zColumnName)) rc = int32(SQLITE_ERROR) } if **(**uintptr)(__ccgo_up(bp)) != 0 { v1 = __ccgo_ts + 3942 } else { v1 = uintptr(0) } _sqlite3ErrorWithMsg(tls, db, rc, v1, libc.VaList(bp+16, **(**uintptr)(__ccgo_up(bp)))) _sqlite3DbFree(tls, db, **(**uintptr)(__ccgo_up(bp))) rc = _sqlite3ApiExit(tls, db, rc) Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex) return rc } // C documentation // // /* // ** Begin adding a change to a changegroup object. // */ func Xsqlite3changegroup_change_begin(tls *libc.TLS, pGrp uintptr, eOp int32, zTab uintptr, bIndirect int32, pzErr uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var aBuf uintptr var nReq, rc, v1 int32 var _ /* pTab at bp+0 */ uintptr _, _, _, _ = aBuf, nReq, rc, v1 **(**uintptr)(__ccgo_up(bp)) = uintptr(0) rc = SQLITE_OK if (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FpTab != 0 { rc = int32(SQLITE_MISUSE) } else { if eOp != int32(SQLITE_INSERT) && eOp != int32(SQLITE_UPDATE) && eOp != int32(SQLITE_DELETE) { rc = int32(SQLITE_ERROR) } else { rc = _sessionChangesetFindTable(tls, pGrp, zTab, uintptr(0), bp) } } if rc == SQLITE_OK { if **(**uintptr)(__ccgo_up(bp)) == uintptr(0) { if pzErr != 0 { **(**uintptr)(__ccgo_up(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+21341, libc.VaList(bp+16, zTab)) } rc = int32(SQLITE_ERROR) } else { if eOp == int32(SQLITE_UPDATE) { v1 = int32(2) } else { v1 = int32(1) } nReq = (*TSessionTable)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp)))).FnCol * v1 (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FpTab = **(**uintptr)(__ccgo_up(bp)) (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FeOp = eOp (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FbIndirect = bIndirect if (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FnBufAlloc < nReq { aBuf = Xsqlite3_realloc(tls, (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FaBuf, libc.Int32FromUint32(libc.Uint32FromInt32(nReq)*uint32(12))) if aBuf == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { libc.Xmemset(tls, aBuf+uintptr((*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FnBufAlloc)*12, 0, uint32(12)*libc.Uint32FromInt32(nReq-(*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FnBufAlloc)) (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FaBuf = aBuf (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FnBufAlloc = nReq } } } } return rc } // C documentation // // /* // ** Finish any change currently being constructed by the changegroup object. // */ func Xsqlite3changegroup_change_finish(tls *libc.TLS, pGrp uintptr, bDiscard int32, pzErr uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var aBuf, p, v2, v3 uintptr var eUndef Tu8 var ii, isPK, nBuf, nZero, v7 int32 var _ /* rc at bp+0 */ int32 _, _, _, _, _, _, _, _, _, _ = aBuf, eUndef, ii, isPK, nBuf, nZero, p, v2, v3, v7 **(**int32)(__ccgo_up(bp)) = SQLITE_OK if (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FpTab != 0 { aBuf = (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FaBuf if bDiscard == 0 { nBuf = (*TSessionTable)(unsafe.Pointer((*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FpTab)).FnCol eUndef = uint8(SQLITE_NULL) if (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FeOp == int32(SQLITE_UPDATE) { ii = 0 for { if !(ii < nBuf) { break } if **(**Tu8)(__ccgo_up((*TSessionTable)(unsafe.Pointer((*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FpTab)).FabPK + uintptr(ii))) != 0 { if (**(**TSessionBuffer)(__ccgo_up(aBuf + uintptr(ii)*12))).FnBuf <= int32(1) { if (**(**TSessionBuffer)(__ccgo_up(aBuf + uintptr(ii)*12))).FnBuf == int32(1) { v2 = __ccgo_ts + 1688 } else { v2 = __ccgo_ts + 36828 } **(**uintptr)(__ccgo_up(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+36838, libc.VaList(bp+16, v2)) **(**int32)(__ccgo_up(bp)) = int32(SQLITE_ERROR) break } else { if (**(**TSessionBuffer)(__ccgo_up(aBuf + uintptr(ii+nBuf)*12))).FnBuf > 0 { **(**uintptr)(__ccgo_up(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+36885, 0) **(**int32)(__ccgo_up(bp)) = int32(SQLITE_ERROR) break } } } else { if (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch == 0 && libc.BoolInt32((**(**TSessionBuffer)(__ccgo_up(aBuf + uintptr(ii)*12))).FnBuf > 0) != libc.BoolInt32((**(**TSessionBuffer)(__ccgo_up(aBuf + uintptr(ii+nBuf)*12))).FnBuf > 0) { if (**(**TSessionBuffer)(__ccgo_up(aBuf + uintptr(ii)*12))).FnBuf != 0 { v2 = __ccgo_ts + 1702 } else { v2 = __ccgo_ts + 36937 } if (**(**TSessionBuffer)(__ccgo_up(aBuf + uintptr(ii+nBuf)*12))).FnBuf != 0 { v3 = __ccgo_ts + 1702 } else { v3 = __ccgo_ts + 36937 } **(**uintptr)(__ccgo_up(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+36940, libc.VaList(bp+16, ii, v2, v3)) **(**int32)(__ccgo_up(bp)) = int32(SQLITE_ERROR) break } } goto _1 _1: ; ii = ii + 1 } eUndef = uint8(0x00) if (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch == 0 { nBuf = nBuf * int32(2) } } else { ii = 0 for { if !(ii < nBuf) { break } isPK = libc.Int32FromUint8(**(**Tu8)(__ccgo_up((*TSessionTable)(unsafe.Pointer((*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FpTab)).FabPK + uintptr(ii)))) if ((*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FeOp == int32(SQLITE_INSERT) || (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch == 0 || isPK != 0) && (**(**TSessionBuffer)(__ccgo_up(aBuf + uintptr(ii)*12))).FnBuf == 0 { **(**uintptr)(__ccgo_up(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37016, libc.VaList(bp+16, ii)) **(**int32)(__ccgo_up(bp)) = int32(SQLITE_ERROR) break } if (**(**TSessionBuffer)(__ccgo_up(aBuf + uintptr(ii)*12))).FnBuf == int32(1) && isPK != 0 { **(**uintptr)(__ccgo_up(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37055, 0) **(**int32)(__ccgo_up(bp)) = int32(SQLITE_ERROR) break } goto _5 _5: ; ii = ii + 1 } } (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.Frecord.FnBuf = 0 ii = 0 for { if !(ii < nBuf) { break } p = (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FaBuf + uintptr(ii)*12 if (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch != 0 { if libc.Int32FromUint8(**(**Tu8)(__ccgo_up((*TSessionTable)(unsafe.Pointer((*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FpTab)).FabPK + uintptr(ii)))) == 0 { if (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FeOp == int32(SQLITE_UPDATE) { p = p + uintptr((*TSessionTable)(unsafe.Pointer((*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FpTab)).FnCol)*12 } else { if (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FeOp == int32(SQLITE_DELETE) { goto _6 } } } } if (*TSessionBuffer)(unsafe.Pointer(p)).FnBuf != 0 { v7 = (*TSessionBuffer)(unsafe.Pointer(p)).FnBuf } else { v7 = int32(1) } if 0 == _sessionBufferGrow(tls, pGrp+32+20, int64(v7), bp) { if (*TSessionBuffer)(unsafe.Pointer(p)).FnBuf != 0 { libc.Xmemcpy(tls, (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.Frecord.FaBuf+uintptr((*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.Frecord.FnBuf), (*TSessionBuffer)(unsafe.Pointer(p)).FaBuf, libc.Uint32FromInt32((*TSessionBuffer)(unsafe.Pointer(p)).FnBuf)) (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.Frecord.FnBuf += (*TSessionBuffer)(unsafe.Pointer(p)).FnBuf } else { v2 = pGrp + 32 + 20 + 4 v7 = *(*int32)(unsafe.Pointer(v2)) *(*int32)(unsafe.Pointer(v2)) = *(*int32)(unsafe.Pointer(v2)) + 1 **(**Tu8)(__ccgo_up((*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.Frecord.FaBuf + uintptr(v7))) = eUndef } } goto _6 _6: ; ii = ii + 1 } if **(**int32)(__ccgo_up(bp)) == SQLITE_OK { **(**int32)(__ccgo_up(bp)) = _sessionOneChangeToHash(tls, pGrp, (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FpTab, (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FeOp, (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FbIndirect, (*TSessionTable)(unsafe.Pointer((*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FpTab)).FnCol, (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.Frecord.FaBuf, (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.Frecord.FnBuf, 0) } } /* Reset all aBuf[] entries to "undefined". */ nZero = (*TSessionTable)(unsafe.Pointer((*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FpTab)).FnCol if (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FeOp == int32(SQLITE_UPDATE) { nZero = nZero + nZero } ii = 0 for { if !(ii < nZero) { break } (**(**TSessionBuffer)(__ccgo_up((*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FaBuf + uintptr(ii)*12))).FnBuf = 0 goto _10 _10: ; ii = ii + 1 } (*Tsqlite3_changegroup)(unsafe.Pointer(pGrp)).Fcd.FpTab = uintptr(0) } return **(**int32)(__ccgo_up(bp)) } /************** End of sqlite3session.c **************************************/ /************** Begin file fts5.c ********************************************/ /* ** This, the "fts5.c" source file, is a composite file that is itself ** assembled from the following files: ** ** fts5.h ** fts5Int.h ** fts5parse.h <--- Generated from fts5parse.y by Lemon ** fts5parse.c <--- Generated from fts5parse.y by Lemon ** fts5_aux.c ** fts5_buffer.c ** fts5_config.c ** fts5_expr.c ** fts5_hash.c ** fts5_index.c ** fts5_main.c ** fts5_storage.c ** fts5_tokenize.c ** fts5_unicode2.c ** fts5_varint.c ** fts5_vocab.c */ /* ** 2014 May 31 ** ** 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. ** ****************************************************************************** ** ** Interfaces to extend FTS5. Using the interfaces defined in this file, ** FTS5 may be extended with: ** ** * custom tokenizers, and ** * custom auxiliary functions. */ /* ** 2014 May 31 ** ** 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. ** ****************************************************************************** ** */ /* #include "fts5.h" */ /* #include "sqlite3ext.h" */ /* #include */ /* #include */ /* #include */ /* ** Constants for the largest and smallest possible 32-bit signed integers. */ /* Truncate very long tokens to this many bytes. Hard limit is ** (65536-1-1-4-9)==65521 bytes. The limiting factor is the 16-bit offset ** field that occurs at the start of each leaf page (see fts5_index.c). */ /* ** Maximum number of prefix indexes on single FTS5 table. This must be ** less than 32. If it is set to anything large than that, an #error ** directive in fts5_index.c will cause the build to fail. */ /* ** Maximum segments permitted in a single index */ /* Name of rank and rowid columns */ /* ** The assert_nc() macro is similar to the assert() macro, except that it ** is used for assert() conditions that are true only if it can be ** guranteed that the database is not corrupt. */ /* ** A version of memcmp() that does not cause asan errors if one of the pointer ** parameters is NULL and the number of bytes to compare is zero. */ /* Mark a function parameter as unused, to suppress nuisance compiler ** warnings. */ // C documentation // // /* // ** Open a handle to begin or resume an RBU VACUUM operation. // */ func Xsqlite3rbu_vacuum(tls *libc.TLS, zTarget uintptr, zState uintptr) (r uintptr) { var n Tsize_t _ = n if zTarget == uintptr(0) { return _rbuMisuseError(tls) } if zState != 0 { n = libc.Xstrlen(tls, zState) if n >= uint32(7) && 0 == libc.Xmemcmp(tls, __ccgo_ts+34674, zState+uintptr(n-uint32(7)), uint32(7)) { return _rbuMisuseError(tls) } } /* TODO: Check that both arguments are non-NULL */ return _openRbuHandle(tls, uintptr(0), zTarget, zState) } func Xsqlite3session_diff(tls *libc.TLS, pSession uintptr, zFrom uintptr, zTbl uintptr, pzErrMsg uintptr) (r int32) { bp := tls.Alloc(64) defer tls.Free(64) var bHasPk, bMismatch, i, rc int32 var db, zDb, zDbExists, zExpr, v1 uintptr var _ /* abPK at bp+24 */ uintptr var _ /* azCol at bp+28 */ uintptr var _ /* bRowid at bp+20 */ int32 var _ /* d at bp+0 */ TSessionDiffCtx var _ /* nCol at bp+16 */ int32 var _ /* pDbExists at bp+32 */ uintptr var _ /* pTo at bp+12 */ uintptr _, _, _, _, _, _, _, _, _ = bHasPk, bMismatch, db, i, rc, zDb, zDbExists, zExpr, v1 zDb = (*Tsqlite3_session)(unsafe.Pointer(pSession)).FzDb rc = (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc libc.Xmemset(tls, bp, 0, uint32(12)) _sessionDiffHooks(tls, pSession, bp) Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb)) if pzErrMsg != 0 { **(**uintptr)(__ccgo_up(pzErrMsg)) = uintptr(0) } if rc == SQLITE_OK { zExpr = uintptr(0) db = (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb /* Table zTbl */ /* Locate and if necessary initialize the target table object */ (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach = (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach + 1 rc = _sessionFindTable(tls, pSession, zTbl, bp+12) (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach = (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach - 1 if **(**uintptr)(__ccgo_up(bp + 12)) == uintptr(0) { goto diff_out } if _sessionInitTable(tls, pSession, **(**uintptr)(__ccgo_up(bp + 12)), (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb, (*Tsqlite3_session)(unsafe.Pointer(pSession)).FzDb) != 0 { rc = (*Tsqlite3_session)(unsafe.Pointer(pSession)).Frc goto diff_out } /* Check the table schemas match */ if rc == SQLITE_OK { bHasPk = 0 bMismatch = 0 **(**int32)(__ccgo_up(bp + 16)) = 0 /* Columns in zFrom.zTbl */ **(**int32)(__ccgo_up(bp + 20)) = 0 **(**uintptr)(__ccgo_up(bp + 24)) = uintptr(0) **(**uintptr)(__ccgo_up(bp + 28)) = uintptr(0) zDbExists = uintptr(0) /* Check that database zFrom is attached. */ zDbExists = Xsqlite3_mprintf(tls, __ccgo_ts+35605, libc.VaList(bp+48, zFrom)) if zDbExists == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { **(**uintptr)(__ccgo_up(bp + 32)) = uintptr(0) rc = Xsqlite3_prepare_v2(tls, db, zDbExists, -int32(1), bp+32, uintptr(0)) if rc == int32(SQLITE_ERROR) { rc = SQLITE_OK **(**int32)(__ccgo_up(bp + 16)) = -int32(1) } Xsqlite3_finalize(tls, **(**uintptr)(__ccgo_up(bp + 32))) Xsqlite3_free(tls, zDbExists) } if rc == SQLITE_OK && **(**int32)(__ccgo_up(bp + 16)) == 0 { if (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbImplicitPK != 0 { v1 = bp + 20 } else { v1 = uintptr(0) } rc = _sessionTableInfo(tls, uintptr(0), db, zFrom, zTbl, bp+16, uintptr(0), uintptr(0), bp+28, uintptr(0), uintptr(0), bp+24, v1) } if rc == SQLITE_OK { if (*TSessionTable)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp + 12)))).FnCol != **(**int32)(__ccgo_up(bp + 16)) { if **(**int32)(__ccgo_up(bp + 16)) <= 0 { rc = int32(SQLITE_SCHEMA) if pzErrMsg != 0 { **(**uintptr)(__ccgo_up(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+35636, libc.VaList(bp+48, zFrom, zTbl)) } } else { bMismatch = int32(1) } } else { i = 0 for { if !(i < **(**int32)(__ccgo_up(bp + 16))) { break } if libc.Int32FromUint8(**(**Tu8)(__ccgo_up((*TSessionTable)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp + 12)))).FabPK + uintptr(i)))) != libc.Int32FromUint8(**(**Tu8)(__ccgo_up(**(**uintptr)(__ccgo_up(bp + 24)) + uintptr(i)))) { bMismatch = int32(1) } if Xsqlite3_stricmp(tls, **(**uintptr)(__ccgo_up(**(**uintptr)(__ccgo_up(bp + 28)) + uintptr(i)*4)), **(**uintptr)(__ccgo_up((*TSessionTable)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp + 12)))).FazCol + uintptr(i)*4))) != 0 { bMismatch = int32(1) } if **(**Tu8)(__ccgo_up(**(**uintptr)(__ccgo_up(bp + 24)) + uintptr(i))) != 0 { bHasPk = int32(1) } goto _2 _2: ; i = i + 1 } } } Xsqlite3_free(tls, **(**uintptr)(__ccgo_up(bp + 28))) if bMismatch != 0 { if pzErrMsg != 0 { **(**uintptr)(__ccgo_up(pzErrMsg)) = Xsqlite3_mprintf(tls, __ccgo_ts+35657, 0) } rc = int32(SQLITE_SCHEMA) } if bHasPk == 0 { /* Ignore tables with no primary keys */ goto diff_out } } if rc == SQLITE_OK { zExpr = _sessionExprComparePK(tls, (*TSessionTable)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp + 12)))).FnCol, zDb, zFrom, (*TSessionTable)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp + 12)))).FzName, (*TSessionTable)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp + 12)))).FazCol, (*TSessionTable)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp + 12)))).FabPK) } /* Find new rows */ if rc == SQLITE_OK { rc = _sessionDiffFindNew(tls, int32(SQLITE_INSERT), pSession, **(**uintptr)(__ccgo_up(bp + 12)), zDb, zFrom, zExpr) } /* Find old rows */ if rc == SQLITE_OK { rc = _sessionDiffFindNew(tls, int32(SQLITE_DELETE), pSession, **(**uintptr)(__ccgo_up(bp + 12)), zFrom, zDb, zExpr) } /* Find modified rows */ if rc == SQLITE_OK { rc = _sessionDiffFindModified(tls, pSession, **(**uintptr)(__ccgo_up(bp + 12)), zFrom, zExpr) } Xsqlite3_free(tls, zExpr) } goto diff_out diff_out: ; _sessionPreupdateHooks(tls, pSession) Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Tsqlite3_session)(unsafe.Pointer(pSession)).Fdb)) return rc } const __INTPTR_FMTd__ = "d" const __INTPTR_FMTi__ = "i" const __LONG_BIT = 32 const __LONG_MIN = -2147483648 const __POINTER_WIDTH__ = 32 const __PTRDIFF_FMTd__ = "d" const __PTRDIFF_FMTi__ = "i" const __SIZE_FMTX__ = "X" const __SIZE_FMTo__ = "o" const __SIZE_FMTu__ = "u" const __SIZE_FMTx__ = "x" const __SIZE_T_MAX = 4294967295 const __SSIZE_MAX = 2147483647 const __UINTPTR_FMTX__ = "X" const __UINTPTR_FMTo__ = "o" const __UINTPTR_FMTu__ = "u" const __UINTPTR_FMTx__ = "x" const __UINTPTR_WIDTH__ = 32 const __ULONG_MAX = 4294967295 const __WORDSIZE = 32 var _aBase = [27]Tu64{ 0: libc.Uint64FromUint64(0x8000000000000000), 1: libc.Uint64FromUint64(0xa000000000000000), 2: libc.Uint64FromUint64(0xc800000000000000), 3: libc.Uint64FromUint64(0xfa00000000000000), 4: libc.Uint64FromUint64(0x9c40000000000000), 5: libc.Uint64FromUint64(0xc350000000000000), 6: libc.Uint64FromUint64(0xf424000000000000), 7: libc.Uint64FromUint64(0x9896800000000000), 8: libc.Uint64FromUint64(0xbebc200000000000), 9: libc.Uint64FromUint64(0xee6b280000000000), 10: libc.Uint64FromUint64(0x9502f90000000000), 11: libc.Uint64FromUint64(0xba43b74000000000), 12: libc.Uint64FromUint64(0xe8d4a51000000000), 13: libc.Uint64FromUint64(0x9184e72a00000000), 14: libc.Uint64FromUint64(0xb5e620f480000000), 15: libc.Uint64FromUint64(0xe35fa931a0000000), 16: libc.Uint64FromUint64(0x8e1bc9bf04000000), 17: libc.Uint64FromUint64(0xb1a2bc2ec5000000), 18: libc.Uint64FromUint64(0xde0b6b3a76400000), 19: libc.Uint64FromUint64(0x8ac7230489e80000), 20: libc.Uint64FromUint64(0xad78ebc5ac620000), 21: libc.Uint64FromUint64(0xd8d726b7177a8000), 22: libc.Uint64FromUint64(0x878678326eac9000), 23: libc.Uint64FromUint64(0xa968163f0a57b400), 24: libc.Uint64FromUint64(0xd3c21bcecceda100), 25: libc.Uint64FromUint64(0x84595161401484a0), 26: libc.Uint64FromUint64(0xa56fa5b99019a5c8), } /* ** The following array holds FuncDef structures for all of the functions ** defined in this file. ** ** The array cannot be constant since changes are made to the ** FuncDef.pHash elements at start-time. The elements of this array ** are read-only after initialization is complete. ** ** For peak efficiency, put the most frequently used function last. */ var _aBuiltinFunc = [106]TFuncDef{ 0: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_implies_nonnull_row)), FzName: __ccgo_ts + 16612, }, 1: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_expr_compare)), FzName: __ccgo_ts + 16632, }, 2: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_expr_implies_expr)), FzName: __ccgo_ts + 16645, }, 3: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INTERNAL) | libc.Int32FromInt32(SQLITE_FUNC_TEST) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_affinity)), FzName: __ccgo_ts + 16663, }, 4: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 16672, }, 5: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)), FzName: __ccgo_ts + 16680, }, 6: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DIRECTONLY) | libc.Int32FromInt32(SQLITE_FUNC_UNSAFE)), FzName: __ccgo_ts + 16680, }, 7: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 16695, }, 8: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 16721, }, 9: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_unlikely)), FzName: __ccgo_ts + 16746, }, 10: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_unlikely)), FzName: __ccgo_ts + 16755, }, 11: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_FUNC_UNLIKELY)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_unlikely)), FzName: __ccgo_ts + 16766, }, 12: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_sqlite_offset)), FzName: __ccgo_ts + 16773, }, 13: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(1)), FzName: __ccgo_ts + 16787, }, 14: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(1)), FzName: __ccgo_ts + 16787, }, 15: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(2)), FzName: __ccgo_ts + 16793, }, 16: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(2)), FzName: __ccgo_ts + 16793, }, 17: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(3)), FzName: __ccgo_ts + 16799, }, 18: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(3)), FzName: __ccgo_ts + 16799, }, 19: { FnArg: int16(-int32(3)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 16804, }, 20: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_MINMAX) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), FzName: __ccgo_ts + 16804, }, 21: { FnArg: int16(-int32(3)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(1)), FzName: __ccgo_ts + 16808, }, 22: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_MINMAX) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), FpUserData: uintptr(libc.Int32FromInt32(1)), FzName: __ccgo_ts + 16808, }, 23: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_TYPEOF)), FzName: __ccgo_ts + 16812, }, 24: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_TYPEOF) | libc.Int32FromInt32(SQLITE_SUBTYPE)), FzName: __ccgo_ts + 16819, }, 25: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_LENGTH)), FzName: __ccgo_ts + 16827, }, 26: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_BYTELEN)), FzName: __ccgo_ts + 16834, }, 27: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 16847, }, 28: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 16853, }, 29: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 16860, }, 30: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 16867, }, 31: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 16875, }, 32: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 16880, }, 33: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 16884, }, 34: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 16884, }, 35: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 16890, }, 36: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 16896, }, 37: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 16902, }, 38: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 16906, }, 39: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 16906, }, 40: { FnArg: int16(-int32(3)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 16912, }, 41: { FnArg: int16(-int32(4)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 16919, }, 42: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FzName: __ccgo_ts + 16929, }, 43: { FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 16936, }, 44: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 16943, }, 45: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 16954, }, 46: { FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 16961, }, 47: { FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_SLOCHNG) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 16976, }, 48: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 16993, }, 49: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 17004, }, 50: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 17011, }, 51: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(1)), FzName: __ccgo_ts + 17017, }, 52: { FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 17030, }, 53: { FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 17048, }, 54: { FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 17056, }, 55: { FnArg: int16(3), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 17070, }, 56: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 17078, }, 57: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 17087, }, 58: { FnArg: int16(3), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 17087, }, 59: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 17094, }, 60: { FnArg: int16(3), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 17094, }, 61: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), FzName: __ccgo_ts + 17104, }, 62: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), FzName: __ccgo_ts + 17108, }, 63: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), FzName: __ccgo_ts + 17114, }, 64: { FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_COUNT) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), FzName: __ccgo_ts + 17118, }, 65: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_FUNC_ANYORDER)), FzName: __ccgo_ts + 17118, }, 66: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), FzName: __ccgo_ts + 17124, }, 67: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), FzName: __ccgo_ts + 17124, }, 68: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(0)), FzName: __ccgo_ts + 17137, }, 69: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE) | libc.Int32FromInt32(SQLITE_FUNC_CASE)), FpUserData: uintptr(unsafe.Pointer(&_globInfo)), FzName: __ccgo_ts + 17148, }, 70: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE)), FpUserData: uintptr(unsafe.Pointer(&_likeInfoNorm)), FzName: __ccgo_ts + 16607, }, 71: { FnArg: int16(3), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_LIKE)), FpUserData: uintptr(unsafe.Pointer(&_likeInfoNorm)), FzName: __ccgo_ts + 16607, }, 72: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17153, }, 73: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 1275, }, 74: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 1283, }, 75: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17158, }, 76: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 17164, }, 77: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(1)), FzName: __ccgo_ts + 17167, }, 78: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(1)), FzName: __ccgo_ts + 17171, }, 79: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FpUserData: uintptr(libc.Int32FromInt32(2)), FzName: __ccgo_ts + 17177, }, 80: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 17167, }, 81: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17182, }, 82: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17186, }, 83: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17190, }, 84: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17196, }, 85: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17200, }, 86: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17205, }, 87: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17210, }, 88: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17215, }, 89: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17221, }, 90: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17225, }, 91: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17229, }, 92: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17233, }, 93: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17238, }, 94: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17243, }, 95: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17248, }, 96: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17254, }, 97: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17260, }, 98: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17266, }, 99: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17271, }, 100: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17279, }, 101: { FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8)), FzName: __ccgo_ts + 17287, }, 102: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL)), FzName: __ccgo_ts + 17290, }, 103: { FnArg: int16(-int32(4)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FzName: __ccgo_ts + 6963, }, 104: { FnArg: int16(-int32(4)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_iif)), FzName: __ccgo_ts + 17295, }, 105: { FnArg: int16(-int32(4)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_FUNC_INLINE) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(0)), FpUserData: uintptr(libc.Int32FromInt32(INLINEFUNC_iif)), FzName: __ccgo_ts + 17299, }, } var _aJsonFunc = [36]TFuncDef{ 0: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FzName: __ccgo_ts + 13696, }, 1: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), FzName: __ccgo_ts + 26966, }, 2: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FzName: __ccgo_ts + 26972, }, 3: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), FzName: __ccgo_ts + 26983, }, 4: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(JSON_AINS) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB)), FzName: __ccgo_ts + 26995, }, 5: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(JSON_AINS) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), FzName: __ccgo_ts + 27013, }, 6: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FzName: __ccgo_ts + 27032, }, 7: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FzName: __ccgo_ts + 27032, }, 8: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FzName: __ccgo_ts + 27050, }, 9: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FzName: __ccgo_ts + 27070, }, 10: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), FzName: __ccgo_ts + 27083, }, 11: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(JSON_JSON) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB)), FzName: __ccgo_ts + 27097, }, 12: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(JSON_SQL) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB)), FzName: __ccgo_ts + 27100, }, 13: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FzName: __ccgo_ts + 27104, }, 14: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), FzName: __ccgo_ts + 27116, }, 15: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FzName: __ccgo_ts + 27129, }, 16: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), FzName: __ccgo_ts + 27141, }, 17: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FzName: __ccgo_ts + 27154, }, 18: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), FzName: __ccgo_ts + 27165, }, 19: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FzName: __ccgo_ts + 27177, }, 20: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FzName: __ccgo_ts + 27177, }, 21: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FzName: __ccgo_ts + 27189, }, 22: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FzName: __ccgo_ts + 27200, }, 23: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), FzName: __ccgo_ts + 27212, }, 24: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FzName: __ccgo_ts + 27225, }, 25: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(0) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), FzName: __ccgo_ts + 27238, }, 26: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(JSON_ISSET) | libc.Int32FromInt32(0)*libc.Int32FromInt32(JSON_BLOB)), FzName: __ccgo_ts + 27252, }, 27: { FnArg: int16(-int32(1)), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FpUserData: uintptr(libc.Int32FromInt32(JSON_ISSET) | libc.Int32FromInt32(1)*libc.Int32FromInt32(JSON_BLOB)), FzName: __ccgo_ts + 27261, }, 28: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FzName: __ccgo_ts + 27271, }, 29: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FzName: __ccgo_ts + 27271, }, 30: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FzName: __ccgo_ts + 27281, }, 31: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_DETERMINISTIC) | libc.Int32FromInt32(SQLITE_FUNC_CONSTANT) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(1)*libc.Int32FromInt32(SQLITE_FUNC_RUNONLY) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE)), FzName: __ccgo_ts + 27281, }, 32: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), FzName: __ccgo_ts + 27292, }, 33: { FnArg: int16(1), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), FpUserData: uintptr(libc.Int32FromInt32(JSON_BLOB)), FzName: __ccgo_ts + 27309, }, 34: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), FzName: __ccgo_ts + 27327, }, 35: { FnArg: int16(2), FfuncFlags: libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_FUNC_BUILTIN) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(0)*libc.Int32FromInt32(SQLITE_FUNC_NEEDCOLL) | libc.Int32FromInt32(SQLITE_SUBTYPE) | libc.Int32FromInt32(SQLITE_RESULT_SUBTYPE) | libc.Int32FromInt32(SQLITE_UTF8) | libc.Int32FromInt32(SQLITE_DETERMINISTIC)), FpUserData: uintptr(libc.Int32FromInt32(JSON_BLOB)), FzName: __ccgo_ts + 27345, }, } var _aScale = [26]Tu64{ 0: libc.Uint64FromUint64(0x8049a4ac0c5811ae), 1: libc.Uint64FromUint64(0xcf42894a5dce35ea), 2: libc.Uint64FromUint64(0xa76c582338ed2621), 3: libc.Uint64FromUint64(0x873e4f75e2224e68), 4: libc.Uint64FromUint64(0xda7f5bf590966848), 5: libc.Uint64FromUint64(0xb080392cc4349dec), 6: libc.Uint64FromUint64(0x8e938662882af53e), 7: libc.Uint64FromUint64(0xe65829b3046b0afa), 8: libc.Uint64FromUint64(0xba121a4650e4ddeb), 9: libc.Uint64FromUint64(0x964e858c91ba2655), 10: libc.Uint64FromUint64(0xf2d56790ab41c2a2), 11: libc.Uint64FromUint64(0xc428d05aa4751e4c), 12: libc.Uint64FromUint64(0x9e74d1b791e07e48), 13: libc.Uint64FromUint64(0xcccccccccccccccc), 14: libc.Uint64FromUint64(0xcecb8f27f4200f3a), 15: libc.Uint64FromUint64(0xa70c3c40a64e6c51), 16: libc.Uint64FromUint64(0x86f0ac99b4e8dafd), 17: libc.Uint64FromUint64(0xda01ee641a708de9), 18: libc.Uint64FromUint64(0xb01ae745b101e9e4), 19: libc.Uint64FromUint64(0x8e41ade9fbebc27d), 20: libc.Uint64FromUint64(0xe5d3ef282a242e81), 21: libc.Uint64FromUint64(0xb9a74a0637ce2ee1), 22: libc.Uint64FromUint64(0x95f83d0a1fb69cd9), 23: libc.Uint64FromUint64(0xf24a01a73cf2dccf), 24: libc.Uint64FromUint64(0xc3b8358109e84f07), 25: libc.Uint64FromUint64(0x9e19db92b4e31ba9), } // C documentation // // /* // ** Internal SQL function: // ** // ** sqlite_add_constraint(SQL, CONSTRAINT-TEXT, ICOL) // ** // ** SQL is a CREATE TABLE statement. Return a modified version of // ** SQL that adds CONSTRAINT-TEXT at the end of the ICOL-th column // ** definition. (The left-most column defintion is 0.) // */ func _addConstraintFunc(tls *libc.TLS, ctx uintptr, NotUsed int32, argv uintptr) { bp := tls.Alloc(48) defer tls.Free(48) var db, zCons, zNew, zSql uintptr var iCol, ii, nTok int32 var _ /* iOff at bp+0 */ int32 var _ /* t at bp+4 */ int32 _, _, _, _, _, _, _ = db, iCol, ii, nTok, zCons, zNew, zSql zSql = Xsqlite3_value_text(tls, **(**uintptr)(__ccgo_up(argv))) zCons = Xsqlite3_value_text(tls, **(**uintptr)(__ccgo_up(argv + 1*4))) iCol = Xsqlite3_value_int(tls, **(**uintptr)(__ccgo_up(argv + 2*4))) **(**int32)(__ccgo_up(bp)) = 0 zNew = uintptr(0) **(**int32)(__ccgo_up(bp + 4)) = 0 _ = NotUsed if _skipCreateTable(tls, ctx, zSql, bp) != 0 { return } ii = 0 for { if !(ii <= iCol || iCol < 0 && **(**int32)(__ccgo_up(bp + 4)) != int32(TK_RP)) { break } **(**int32)(__ccgo_up(bp)) = **(**int32)(__ccgo_up(bp)) + _getConstraintToken(tls, zSql+uintptr(**(**int32)(__ccgo_up(bp))), bp+4) for int32(1) != 0 { nTok = _getConstraintToken(tls, zSql+uintptr(**(**int32)(__ccgo_up(bp))), bp+4) if **(**int32)(__ccgo_up(bp + 4)) == int32(TK_COMMA) || **(**int32)(__ccgo_up(bp + 4)) == int32(TK_RP) { break } if **(**int32)(__ccgo_up(bp + 4)) == int32(TK_ILLEGAL) { Xsqlite3_result_error_code(tls, ctx, _sqlite3CorruptError(tls, int32(123226))) return } **(**int32)(__ccgo_up(bp)) = **(**int32)(__ccgo_up(bp)) + nTok } goto _1 _1: ; ii = ii + 1 } **(**int32)(__ccgo_up(bp)) = **(**int32)(__ccgo_up(bp)) + _getWhitespace(tls, zSql+uintptr(**(**int32)(__ccgo_up(bp)))) db = Xsqlite3_context_db_handle(tls, ctx) if iCol < 0 { zNew = _sqlite3MPrintf(tls, db, __ccgo_ts+11887, libc.VaList(bp+16, **(**int32)(__ccgo_up(bp)), zSql, zCons, zSql+uintptr(**(**int32)(__ccgo_up(bp))))) } else { zNew = _sqlite3MPrintf(tls, db, __ccgo_ts+11898, libc.VaList(bp+16, **(**int32)(__ccgo_up(bp)), zSql, zCons, zSql+uintptr(**(**int32)(__ccgo_up(bp))))) } Xsqlite3_result_text(tls, ctx, zNew, -int32(1), __ccgo_fp(_sqlite3RowSetClear)) } // C documentation // // /* // ** Find a column named pCol in table pTab. If successful, set output // ** parameter *piCol to the index of the column in the table and return // ** SQLITE_OK. Otherwise, set *piCol to -1 and return an SQLite error // ** code. // */ func _alterFindCol(tls *libc.TLS, pParse uintptr, pTab uintptr, pCol uintptr, piCol uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var db, zCol, zDb, zName uintptr var iCol, rc int32 _, _, _, _, _, _ = db, iCol, rc, zCol, zDb, zName db = (*TParse)(unsafe.Pointer(pParse)).Fdb zName = _sqlite3NameFromToken(tls, db, pCol) rc = int32(SQLITE_NOMEM) iCol = -int32(1) if zName != 0 { iCol = _sqlite3ColumnIndex(tls, pTab, zName) if iCol < 0 { _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+11908, libc.VaList(bp+8, zName)) rc = int32(SQLITE_ERROR) } else { rc = SQLITE_OK } } if rc == SQLITE_OK { zDb = (**(**TDb)(__ccgo_up((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(_sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema))*16))).FzDbSName zCol = (**(**TColumn)(__ccgo_up((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*12))).FzCnName if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_ALTER_TABLE), zDb, (*TTable)(unsafe.Pointer(pTab)).FzName, zCol) != 0 { pTab = uintptr(0) } } _sqlite3DbFree(tls, db, zName) **(**int32)(__ccgo_up(piCol)) = iCol return rc } // C documentation // // /* // ** Generate code to do an analysis of all indices associated with // ** a single table. // */ func _analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintptr, iStatCur int32, iMem int32, iTab int32) { var aGotoChng, db, pColl, pIdx, pPk, pStat1, pX, v, zIdxName uintptr var addrGotoEnd, addrIsNull, addrNext, addrNextRow, doOnce, endDistinctTest, i, iDb, iIdxCur, iTabCur, j, j1, j2, j3, jZeroRows, k, mxCol, nCol, nColTest, nColX, regChng, regCol, regDLt, regEq, regIdxname, regKey, regLt, regNewRowid, regPrev, regRowid, regSample, regSampleRowid, regStat, regStat1, regTabname, regTemp, regTemp2, v1, v2, v3, v4, v5, v6, v7, v8, v9 int32 var needTableCnt, seekOp Tu8 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aGotoChng, addrGotoEnd, addrIsNull, addrNext, addrNextRow, db, doOnce, endDistinctTest, i, iDb, iIdxCur, iTabCur, j, j1, j2, j3, jZeroRows, k, mxCol, nCol, nColTest, nColX, needTableCnt, pColl, pIdx, pPk, pStat1, pX, regChng, regCol, regDLt, regEq, regIdxname, regKey, regLt, regNewRowid, regPrev, regRowid, regSample, regSampleRowid, regStat, regStat1, regTabname, regTemp, regTemp2, seekOp, v, zIdxName, v1, v2, v3, v4, v5, v6, v7, v8, v9 db = (*TParse)(unsafe.Pointer(pParse)).Fdb /* Loop counter */ jZeroRows = -int32(1) /* Index of database containing pTab */ needTableCnt = uint8(1) v1 = iMem iMem = iMem + 1 /* True to count the table */ regNewRowid = v1 v2 = iMem iMem = iMem + 1 /* Rowid for the inserted record */ regStat = v2 v3 = iMem iMem = iMem + 1 /* Register to hold StatAccum object */ regChng = v3 v4 = iMem iMem = iMem + 1 /* Index of changed index field */ regRowid = v4 v5 = iMem iMem = iMem + 1 /* Rowid argument passed to stat_push() */ regTemp = v5 v6 = iMem iMem = iMem + 1 /* Temporary use register */ regTemp2 = v6 v7 = iMem iMem = iMem + 1 /* Second temporary use register */ regTabname = v7 v8 = iMem iMem = iMem + 1 /* Register containing table name */ regIdxname = v8 v9 = iMem iMem = iMem + 1 /* Register containing index name */ regStat1 = v9 /* Value for the stat column of sqlite_stat1 */ regPrev = iMem /* MUST BE LAST (see below) */ doOnce = int32(1) /* Flag for a one-time computation */ pStat1 = uintptr(0) _sqlite3TouchRegister(tls, pParse, iMem) v = _sqlite3GetVdbe(tls, pParse) if v == uintptr(0) || pTab == uintptr(0) { return } if !(libc.Int32FromUint8((*TTable)(unsafe.Pointer(pTab)).FeTabType) == libc.Int32FromInt32(TABTYP_NORM)) { /* Do not gather statistics on views or virtual tables */ return } if Xsqlite3_strlike(tls, __ccgo_ts+13032, (*TTable)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { /* Do not gather statistics on system tables */ return } iDb = _sqlite3SchemaToIndex(tls, db, (*TTable)(unsafe.Pointer(pTab)).FpSchema) if _sqlite3AuthCheck(tls, pParse, int32(SQLITE_ANALYZE), (*TTable)(unsafe.Pointer(pTab)).FzName, uintptr(0), (**(**TDb)(__ccgo_up((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16))).FzDbSName) != 0 { return } if (*Tsqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { pStat1 = _sqlite3DbMallocZero(tls, db, uint64(libc.Uint32FromInt64(80)+libc.Uint32FromInt32(13))) if pStat1 == uintptr(0) { return } (*TTable)(unsafe.Pointer(pStat1)).FzName = pStat1 + 1*80 libc.Xmemcpy(tls, (*TTable)(unsafe.Pointer(pStat1)).FzName, __ccgo_ts+12835, uint32(13)) (*TTable)(unsafe.Pointer(pStat1)).FnCol = int16(3) (*TTable)(unsafe.Pointer(pStat1)).FiPKey = int16(-int32(1)) _sqlite3VdbeAddOp4(tls, (*TParse)(unsafe.Pointer(pParse)).FpVdbe, int32(OP_Noop), 0, 0, 0, pStat1, -int32(7)) } /* Establish a read-lock on the table at the shared-cache level. ** Open a read-only cursor on the table. Also allocate a cursor number ** to use for scanning indexes (iIdxCur). No index cursor is opened at ** this time though. */ _sqlite3TableLock(tls, pParse, iDb, (*TTable)(unsafe.Pointer(pTab)).Ftnum, uint8(0), (*TTable)(unsafe.Pointer(pTab)).FzName) v1 = iTab iTab = iTab + 1 iTabCur = v1 v1 = iTab iTab = iTab + 1 iIdxCur = v1 if (*TParse)(unsafe.Pointer(pParse)).FnTab > iTab { v1 = (*TParse)(unsafe.Pointer(pParse)).FnTab } else { v1 = iTab } (*TParse)(unsafe.Pointer(pParse)).FnTab = v1 _sqlite3OpenTable(tls, pParse, iTabCur, iDb, pTab, int32(OP_OpenRead)) _sqlite3VdbeLoadString(tls, v, regTabname, (*TTable)(unsafe.Pointer(pTab)).FzName) pIdx = (*TTable)(unsafe.Pointer(pTab)).FpIndex for { if !(pIdx != 0) { break } /* Number of columns to test for changes */ if pOnlyIdx != 0 && pOnlyIdx != pIdx { goto _13 } if (*TIndex)(unsafe.Pointer(pIdx)).FpPartIdxWhere == uintptr(0) { needTableCnt = uint8(0) } if !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 56))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { nCol = libc.Int32FromUint16((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) zIdxName = (*TTable)(unsafe.Pointer(pTab)).FzName nColTest = nCol - int32(1) } else { nCol = libc.Int32FromUint16((*TIndex)(unsafe.Pointer(pIdx)).FnColumn) zIdxName = (*TIndex)(unsafe.Pointer(pIdx)).FzName if int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 56))&0x8>>3)) != 0 { v1 = libc.Int32FromUint16((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) - int32(1) } else { v1 = nCol - int32(1) } nColTest = v1 } /* Populate the register containing the index name. */ _sqlite3VdbeLoadString(tls, v, regIdxname, zIdxName) /* ** Pseudo-code for loop that calls stat_push(): ** ** regChng = 0 ** Rewind csr ** if eof(csr){ ** stat_init() with count = 0; ** goto end_of_scan; ** } ** count() ** stat_init() ** goto chng_addr_0; ** ** next_row: ** regChng = 0 ** if( idx(0) != regPrev(0) ) goto chng_addr_0 ** regChng = 1 ** if( idx(1) != regPrev(1) ) goto chng_addr_1 ** ... ** regChng = N ** goto chng_addr_N ** ** chng_addr_0: ** regPrev(0) = idx(0) ** chng_addr_1: ** regPrev(1) = idx(1) ** ... ** ** endDistinctTest: ** regRowid = idx(rowid) ** stat_push(P, regChng, regRowid) ** Next csr ** if !eof(csr) goto next_row; ** ** end_of_scan: */ /* Make sure there are enough memory cells allocated to accommodate ** the regPrev array and a trailing rowid (the rowid slot is required ** when building a record to insert into the sample column of ** the sqlite_stat4 table. */ _sqlite3TouchRegister(tls, pParse, regPrev+nColTest) /* Open a read-only cursor on the index being analyzed. */ _sqlite3VdbeAddOp3(tls, v, int32(OP_OpenRead), iIdxCur, libc.Int32FromUint32((*TIndex)(unsafe.Pointer(pIdx)).Ftnum), iDb) _sqlite3VdbeSetP4KeyInfo(tls, pParse, pIdx) /* Implementation of the following: ** ** regChng = 0 ** Rewind csr ** if eof(csr){ ** stat_init() with count = 0; ** goto end_of_scan; ** } ** count() ** stat_init() ** goto chng_addr_0; */ _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), (*Tsqlite3)(unsafe.Pointer(db)).FnAnalysisLimit, regTemp2) /* Arguments to stat_init(): ** (1) the number of columns in the index including the rowid ** (or for a WITHOUT ROWID table, the number of PK columns), ** (2) the number of columns in the key without the rowid/pk ** (3) estimated number of rows in the index. */ _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), nCol, regStat+int32(1)) _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), libc.Int32FromUint16((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol), regRowid) _sqlite3VdbeAddOp3(tls, v, int32(OP_Count), iIdxCur, regTemp, libc.BoolInt32((*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_Stat4)) != uint32(0))) _sqlite3VdbeAddFunctionCall(tls, pParse, 0, regStat+int32(1), regStat, int32(4), uintptr(unsafe.Pointer(&_statInitFuncdef)), 0) addrGotoEnd = _sqlite3VdbeAddOp1(tls, v, int32(OP_Rewind), iIdxCur) _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, regChng) addrNextRow = _sqlite3VdbeCurrentAddr(tls, v) if nColTest > 0 { endDistinctTest = _sqlite3VdbeMakeLabel(tls, pParse) /* Array of jump instruction addresses */ aGotoChng = _sqlite3DbMallocRawNN(tls, db, uint64(uint32(4)*libc.Uint32FromInt32(nColTest))) if aGotoChng == uintptr(0) { goto _13 } /* ** next_row: ** regChng = 0 ** if( idx(0) != regPrev(0) ) goto chng_addr_0 ** regChng = 1 ** if( idx(1) != regPrev(1) ) goto chng_addr_1 ** ... ** regChng = N ** goto endDistinctTest */ _sqlite3VdbeAddOp0(tls, v, int32(OP_Goto)) addrNextRow = _sqlite3VdbeCurrentAddr(tls, v) if nColTest == int32(1) && libc.Int32FromUint16((*TIndex)(unsafe.Pointer(pIdx)).FnKeyCol) == int32(1) && libc.Int32FromUint8((*TIndex)(unsafe.Pointer(pIdx)).FonError) != OE_None { /* For a single-column UNIQUE index, once we have found a non-NULL ** row, we know that all the rest will be distinct, so skip ** subsequent distinctness tests. */ _sqlite3VdbeAddOp2(tls, v, int32(OP_NotNull), regPrev, endDistinctTest) } i = 0 for { if !(i < nColTest) { break } pColl = _sqlite3LocateCollSeq(tls, pParse, **(**uintptr)(__ccgo_up((*TIndex)(unsafe.Pointer(pIdx)).FazColl + uintptr(i)*4))) _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), i, regChng) _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, i, regTemp) **(**int32)(__ccgo_up(aGotoChng + uintptr(i)*4)) = _sqlite3VdbeAddOp4(tls, v, int32(OP_Ne), regTemp, 0, regPrev+i, pColl, -int32(2)) _sqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) goto _15 _15: ; i = i + 1 } _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), nColTest, regChng) _sqlite3VdbeGoto(tls, v, endDistinctTest) /* ** chng_addr_0: ** regPrev(0) = idx(0) ** chng_addr_1: ** regPrev(1) = idx(1) ** ... */ _sqlite3VdbeJumpHere(tls, v, addrNextRow-int32(1)) i = 0 for { if !(i < nColTest) { break } _sqlite3VdbeJumpHere(tls, v, **(**int32)(__ccgo_up(aGotoChng + uintptr(i)*4))) _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, i, regPrev+i) goto _16 _16: ; i = i + 1 } _sqlite3VdbeResolveLabel(tls, v, endDistinctTest) _sqlite3DbFree(tls, db, aGotoChng) } /* ** chng_addr_N: ** regRowid = idx(rowid) // STAT4 only ** stat_push(P, regChng, regRowid) // 3rd parameter STAT4 only ** Next csr ** if !eof(csr) goto next_row; */ if (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0) { if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { _sqlite3VdbeAddOp2(tls, v, int32(OP_IdxRowid), iIdxCur, regRowid) } else { pPk = _sqlite3PrimaryKeyIndex(tls, (*TIndex)(unsafe.Pointer(pIdx)).FpTable) regKey = _sqlite3GetTempRange(tls, pParse, libc.Int32FromUint16((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) j = 0 for { if !(j < libc.Int32FromUint16((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) { break } k = _sqlite3TableColumnToIndex(tls, pIdx, int32(**(**Ti16)(__ccgo_up((*TIndex)(unsafe.Pointer(pPk)).FaiColumn + uintptr(j)*2)))) _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), iIdxCur, k, regKey+j) goto _17 _17: ; j = j + 1 } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regKey, libc.Int32FromUint16((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol), regRowid) _sqlite3ReleaseTempRange(tls, pParse, regKey, libc.Int32FromUint16((*TIndex)(unsafe.Pointer(pPk)).FnKeyCol)) } } _sqlite3VdbeAddFunctionCall(tls, pParse, int32(1), regStat, regTemp, libc.Int32FromInt32(2)+libc.Int32FromInt32(IsStat4), uintptr(unsafe.Pointer(&_statPushFuncdef)), 0) if (*Tsqlite3)(unsafe.Pointer(db)).FnAnalysisLimit != 0 { j1 = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), regTemp) j2 = _sqlite3VdbeAddOp1(tls, v, int32(OP_If), regTemp) j3 = _sqlite3VdbeAddOp4Int(tls, v, int32(OP_SeekGT), iIdxCur, 0, regPrev, int32(1)) _sqlite3VdbeJumpHere(tls, v, j1) _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), iIdxCur, addrNextRow) _sqlite3VdbeJumpHere(tls, v, j2) _sqlite3VdbeJumpHere(tls, v, j3) } else { _sqlite3VdbeAddOp2(tls, v, int32(OP_Next), iIdxCur, addrNextRow) } /* Add the entry to the stat1 table. */ if (*TIndex)(unsafe.Pointer(pIdx)).FpPartIdxWhere != 0 { /* Partial indexes might get a zero-entry in sqlite_stat1. But ** an empty table is omitted from sqlite_stat1. */ _sqlite3VdbeJumpHere(tls, v, addrGotoEnd) addrGotoEnd = 0 } _callStatGet(tls, pParse, regStat, STAT_GET_STAT1, regStat1) _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+13042, 0) _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur, regNewRowid) _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur, regTemp, regNewRowid) _sqlite3VdbeChangeP4(tls, v, -int32(1), pStat1, -int32(5)) _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) /* Add the entries to the stat4 table. */ if (*Tsqlite3)(unsafe.Pointer(db)).FdbOptFlags&libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_Stat4)) == uint32(0) && (*Tsqlite3)(unsafe.Pointer(db)).FnAnalysisLimit == 0 { regEq = regStat1 regLt = regStat1 + int32(1) regDLt = regStat1 + int32(2) regSample = regStat1 + int32(3) regCol = regStat1 + int32(4) regSampleRowid = regCol + nCol if (*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) { v1 = int32(OP_NotExists) } else { v1 = int32(OP_NotFound) } seekOp = libc.Uint8FromInt32(v1) /* No STAT4 data is generated if the number of rows is zero */ if addrGotoEnd == 0 { _sqlite3VdbeAddOp2(tls, v, int32(OP_Cast), regStat1, int32(SQLITE_AFF_INTEGER)) addrGotoEnd = _sqlite3VdbeAddOp1(tls, v, int32(OP_IfNot), regStat1) } if doOnce != 0 { mxCol = nCol /* Compute the maximum number of columns in any index */ pX = (*TTable)(unsafe.Pointer(pTab)).FpIndex for { if !(pX != 0) { break } /* Number of columns in pX */ if !((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(TF_WithoutRowid) == libc.Uint32FromInt32(0)) && int32(uint32(*(*uint16)(unsafe.Pointer(pX + 56))&0x3>>0)) == int32(SQLITE_IDXTYPE_PRIMARYKEY) { nColX = libc.Int32FromUint16((*TIndex)(unsafe.Pointer(pX)).FnKeyCol) } else { nColX = libc.Int32FromUint16((*TIndex)(unsafe.Pointer(pX)).FnColumn) } if nColX > mxCol { mxCol = nColX } goto _19 _19: ; pX = (*TIndex)(unsafe.Pointer(pX)).FpNext } /* Allocate space to compute results for the largest index */ _sqlite3TouchRegister(tls, pParse, regCol+mxCol) doOnce = 0 _sqlite3ClearTempRegCache(tls, pParse) /* tag-20230325-1 */ } addrNext = _sqlite3VdbeCurrentAddr(tls, v) _callStatGet(tls, pParse, regStat, int32(STAT_GET_ROWID), regSampleRowid) addrIsNull = _sqlite3VdbeAddOp1(tls, v, int32(OP_IsNull), regSampleRowid) _callStatGet(tls, pParse, regStat, int32(STAT_GET_NEQ), regEq) _callStatGet(tls, pParse, regStat, int32(STAT_GET_NLT), regLt) _callStatGet(tls, pParse, regStat, int32(STAT_GET_NDLT), regDLt) _sqlite3VdbeAddOp4Int(tls, v, libc.Int32FromUint8(seekOp), iTabCur, addrNext, regSampleRowid, 0) i = 0 for { if !(i < nCol) { break } _sqlite3ExprCodeLoadIndexColumn(tls, pParse, pIdx, iTabCur, i, regCol+i) goto _20 _20: ; i = i + 1 } _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regCol, nCol, regSample) _sqlite3VdbeAddOp3(tls, v, int32(OP_MakeRecord), regTabname, int32(6), regTemp) _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur+int32(1), regNewRowid) _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur+int32(1), regTemp, regNewRowid) _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), int32(1), addrNext) /* P1==1 for end-of-loop */ _sqlite3VdbeJumpHere(tls, v, addrIsNull) } /* End of analysis */ if addrGotoEnd != 0 { _sqlite3VdbeJumpHere(tls, v, addrGotoEnd) } goto _13 _13: ; pIdx = (*TIndex)(unsafe.Pointer(pIdx)).FpNext } /* Create a single sqlite_stat1 entry containing NULL as the index ** name and the row count as the content. */ if pOnlyIdx == uintptr(0) && needTableCnt != 0 { _sqlite3VdbeAddOp2(tls, v, int32(OP_Count), iTabCur, regStat1) jZeroRows = _sqlite3VdbeAddOp1(tls, v, int32(OP_IfNot), regStat1) _sqlite3VdbeAddOp2(tls, v, int32(OP_Null), 0, regIdxname) _sqlite3VdbeAddOp4(tls, v, int32(OP_MakeRecord), regTabname, int32(3), regTemp, __ccgo_ts+13042, 0) _sqlite3VdbeAddOp2(tls, v, int32(OP_NewRowid), iStatCur, regNewRowid) _sqlite3VdbeAddOp3(tls, v, int32(OP_Insert), iStatCur, regTemp, regNewRowid) _sqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) _sqlite3VdbeChangeP4(tls, v, -int32(1), pStat1, -int32(5)) _sqlite3VdbeJumpHere(tls, v, jZeroRows) } } // C documentation // // /* // ** Generate code that will do an analysis of a single table in // ** a database. If pOnlyIdx is not NULL then it is a single index // ** in pTab that should be analyzed. // */ func _analyzeTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintptr) { var iDb, iStatCur int32 _, _ = iDb, iStatCur iDb = _sqlite3SchemaToIndex(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, (*TTable)(unsafe.Pointer(pTab)).FpSchema) _sqlite3BeginWriteOperation(tls, pParse, 0, iDb) iStatCur = (*TParse)(unsafe.Pointer(pParse)).FnTab **(**int32)(__ccgo_up(pParse + 44)) += int32(3) if pOnlyIdx != 0 { _openStatTable(tls, pParse, iDb, iStatCur, (*TIndex)(unsafe.Pointer(pOnlyIdx)).FzName, __ccgo_ts+13046) } else { _openStatTable(tls, pParse, iDb, iStatCur, (*TTable)(unsafe.Pointer(pTab)).FzName, __ccgo_ts+13050) } _analyzeOneTable(tls, pParse, pTab, pOnlyIdx, iStatCur, (*TParse)(unsafe.Pointer(pParse)).FnMem+int32(1), (*TParse)(unsafe.Pointer(pParse)).FnTab) _loadAnalysis(tls, pParse, iDb) } // C documentation // // /* // ** This function is used by both blob_open() and blob_reopen(). It seeks // ** the b-tree cursor associated with blob handle p to point to row iRow. // ** If successful, SQLITE_OK is returned and subsequent calls to // ** sqlite3_blob_read() or sqlite3_blob_write() access the specified row. // ** // ** If an error occurs, or if the specified row does not exist or does not // ** contain a value of type TEXT or BLOB in the column nominated when the // ** blob handle was opened, then an error code is returned and *pzErr may // ** be set to point to a buffer containing an error message. It is the // ** responsibility of the caller to free the error message buffer using // ** sqlite3DbFree(). // ** // ** If an error does occur, then the b-tree cursor is closed. All subsequent // ** calls to sqlite3_blob_read(), blob_write() or blob_reopen() will // ** immediately return SQLITE_ABORT. // */ func _blobSeekToRow(tls *libc.TLS, p uintptr, iRow Tsqlite3_int64, pzErr uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var pC, v, zErr, v2, v3 uintptr var rc int32 var type1 Tu32 var v1 uint32 _, _, _, _, _, _, _, _ = pC, rc, type1, v, zErr, v1, v2, v3 /* Error code */ zErr = uintptr(0) /* Error message */ v = (*TIncrblob)(unsafe.Pointer(p)).FpStmt /* Set the value of register r[1] in the SQL statement to integer iRow. ** This is done directly as a performance optimization */ _sqlite3VdbeMemSetInt64(tls, (*TVdbe)(unsafe.Pointer(v)).FaMem+1*40, iRow) /* If the statement has been run before (and is paused at the OP_ResultRow) ** then back it up to the point where it does the OP_NotExists. This could ** have been down with an extra OP_Goto, but simply setting the program ** counter is faster. */ if (*TVdbe)(unsafe.Pointer(v)).Fpc > int32(4) { (*TVdbe)(unsafe.Pointer(v)).Fpc = int32(4) rc = _sqlite3VdbeExec(tls, v) } else { rc = Xsqlite3_step(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) } if rc == int32(SQLITE_ROW) { pC = **(**uintptr)(__ccgo_up((*TVdbe)(unsafe.Pointer(v)).FapCsr)) if libc.Int32FromUint16((*TVdbeCursor)(unsafe.Pointer(pC)).FnHdrParsed) > libc.Int32FromUint16((*TIncrblob)(unsafe.Pointer(p)).FiCol) { v1 = *(*Tu32)(unsafe.Pointer(pC + 84 + uintptr((*TIncrblob)(unsafe.Pointer(p)).FiCol)*4)) } else { v1 = uint32(0) } type1 = v1 if type1 < uint32(12) { if type1 == uint32(0) { v2 = __ccgo_ts + 1688 } else { if type1 == uint32(7) { v3 = __ccgo_ts + 6489 } else { v3 = __ccgo_ts + 6494 } v2 = v3 } zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6502, libc.VaList(bp+8, v2)) rc = int32(SQLITE_ERROR) Xsqlite3_finalize(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) (*TIncrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) } else { (*TIncrblob)(unsafe.Pointer(p)).FiOffset = libc.Int32FromUint32(*(*Tu32)(unsafe.Pointer(pC + 84 + uintptr(libc.Int32FromUint16((*TIncrblob)(unsafe.Pointer(p)).FiCol)+int32((*TVdbeCursor)(unsafe.Pointer(pC)).FnField))*4))) (*TIncrblob)(unsafe.Pointer(p)).FnByte = libc.Int32FromUint32(_sqlite3VdbeSerialTypeLen(tls, type1)) (*TIncrblob)(unsafe.Pointer(p)).FpCsr = *(*uintptr)(unsafe.Pointer(pC + 36)) _sqlite3BtreeIncrblobCursor(tls, (*TIncrblob)(unsafe.Pointer(p)).FpCsr) } } if rc == int32(SQLITE_ROW) { rc = SQLITE_OK } else { if (*TIncrblob)(unsafe.Pointer(p)).FpStmt != 0 { rc = Xsqlite3_finalize(tls, (*TIncrblob)(unsafe.Pointer(p)).FpStmt) (*TIncrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) if rc == SQLITE_OK { zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+6531, libc.VaList(bp+8, iRow)) rc = int32(SQLITE_ERROR) } else { zErr = _sqlite3MPrintf(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb, __ccgo_ts+3942, libc.VaList(bp+8, Xsqlite3_errmsg(tls, (*TIncrblob)(unsafe.Pointer(p)).Fdb))) } } } **(**uintptr)(__ccgo_up(pzErr)) = zErr return rc } // C documentation // // /* // ** Check to see if the FROM clause term pFrom has table-valued function // ** arguments. If it does, leave an error message in pParse and return // ** non-zero, since pFrom is not allowed to be a table-valued function. // */ func _cannotBeFunction(tls *libc.TLS, pParse uintptr, pFrom uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) if int32(*(*uint32)(unsafe.Pointer(pFrom + 12 + 4))&0x8>>3) != 0 { _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+21034, libc.VaList(bp+8, (*TSrcItem)(unsafe.Pointer(pFrom)).FzName)) return int32(1) } return 0 } // C documentation // // /* // ** Append a message to the error message string. // */ func _checkAppendMsg(tls *libc.TLS, pCheck uintptr, zFormat uintptr, va uintptr) { bp := tls.Alloc(32) defer tls.Free(32) var ap Tva_list _ = ap _checkProgress(tls, pCheck) if !((*TIntegrityCk)(unsafe.Pointer(pCheck)).FmxErr != 0) { return } (*TIntegrityCk)(unsafe.Pointer(pCheck)).FmxErr = (*TIntegrityCk)(unsafe.Pointer(pCheck)).FmxErr - 1 (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr = (*TIntegrityCk)(unsafe.Pointer(pCheck)).FnErr + 1 ap = va if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FerrMsg.FnChar != 0 { Xsqlite3_str_append(tls, pCheck+48, __ccgo_ts+4354, int32(1)) } if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx != 0 { Xsqlite3_str_appendf(tls, pCheck+48, (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx, libc.VaList(bp+8, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv0, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1, (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv2)) } Xsqlite3_str_vappendf(tls, pCheck+48, zFormat, ap) _ = ap if libc.Int32FromUint8((*TIntegrityCk)(unsafe.Pointer(pCheck)).FerrMsg.FaccError) == int32(SQLITE_NOMEM) { _checkOom(tls, pCheck) } } // C documentation // // /* // ** Do various sanity checks on a single page of a tree. Return // ** the tree depth. Root pages return 0. Parents of root pages // ** return 1, and so forth. // ** // ** These checks are done: // ** // ** 1. Make sure that cells and freeblocks do not overlap // ** but combine to completely cover the page. // ** 2. Make sure integer cell keys are in order. // ** 3. Check the integrity of overflow pages. // ** 4. Recursively call checkTreePage on all children. // ** 5. Verify that the depth of all children is the same. // */ func _checkTreePage(tls *libc.TLS, pCheck uintptr, iPage TPgno, piMinKey uintptr, _maxKey Ti64) (r int32) { bp := tls.Alloc(80) defer tls.Free(80) *(*Ti64)(unsafe.Pointer(bp)) = _maxKey var cellStart, d2, depth, doCoverageCheck, hdr, i, j, keyCanBeEqual, nCell, nFrag, pgno, rc, saved_v1, saved_v2, size1, v1 int32 var contentOffset, nPage, pc, prev, size, usableSize Tu32 var data, heap, pBt, pCell, pCellIdx, saved_zPfx uintptr var pgnoOvfl TPgno var savedIsInit Tu8 var _ /* info at bp+16 */ TCellInfo var _ /* pPage at bp+8 */ uintptr var _ /* x at bp+12 */ Tu32 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = cellStart, contentOffset, d2, data, depth, doCoverageCheck, hdr, heap, i, j, keyCanBeEqual, nCell, nFrag, nPage, pBt, pCell, pCellIdx, pc, pgno, pgnoOvfl, prev, rc, savedIsInit, saved_v1, saved_v2, saved_zPfx, size, size1, usableSize, v1 **(**uintptr)(__ccgo_up(bp + 8)) = uintptr(0) /* Result code from subroutine call */ depth = -int32(1) /* Number of cells */ doCoverageCheck = int32(1) /* True if cell coverage checking should be done */ keyCanBeEqual = int32(1) /* Offset to the start of the cell content area */ heap = uintptr(0) prev = uint32(0) /* Next and previous entry on the min-heap */ saved_zPfx = (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx saved_v1 = libc.Int32FromUint32((*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1) saved_v2 = (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv2 savedIsInit = uint8(0) /* Check that the page exists */ _checkProgress(tls, pCheck) if (*TIntegrityCk)(unsafe.Pointer(pCheck)).FmxErr == 0 { goto end_of_check } pBt = (*TIntegrityCk)(unsafe.Pointer(pCheck)).FpBt usableSize = (*TBtShared)(unsafe.Pointer(pBt)).FusableSize if iPage == uint32(0) { return 0 } if _checkRef(tls, pCheck, iPage) != 0 { return 0 } (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = __ccgo_ts + 4600 (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = iPage v1 = _btreeGetPage(tls, pBt, iPage, bp+8, 0) rc = v1 if v1 != 0 { _checkAppendMsg(tls, pCheck, __ccgo_ts+4618, libc.VaList(bp+48, rc)) if rc == libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(12)<= 0 && (*TIntegrityCk)(unsafe.Pointer(pCheck)).FmxErr != 0) { break } /* Check cell size */ (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv2 = i pc = libc.Uint32FromInt32(libc.Int32FromUint8(**(**Tu8)(__ccgo_up(pCellIdx)))< usableSize-uint32(4) { _checkAppendMsg(tls, pCheck, __ccgo_ts+4772, libc.VaList(bp+48, pc, contentOffset, usableSize-uint32(4))) doCoverageCheck = 0 goto _4 } pCell = data + uintptr(pc) (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TMemPage)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp + 8)))).FxParseCell})))(tls, **(**uintptr)(__ccgo_up(bp + 8)), pCell, bp+16) if pc+uint32((**(**TCellInfo)(__ccgo_up(bp + 16))).FnSize) > usableSize { _checkAppendMsg(tls, pCheck, __ccgo_ts+4802, 0) doCoverageCheck = 0 goto _4 } /* Check for integer primary key out of range */ if (*TMemPage)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp + 8)))).FintKey != 0 { if keyCanBeEqual != 0 { v1 = libc.BoolInt32((**(**TCellInfo)(__ccgo_up(bp + 16))).FnKey > **(**Ti64)(__ccgo_up(bp))) } else { v1 = libc.BoolInt32((**(**TCellInfo)(__ccgo_up(bp + 16))).FnKey >= **(**Ti64)(__ccgo_up(bp))) } if v1 != 0 { _checkAppendMsg(tls, pCheck, __ccgo_ts+4826, libc.VaList(bp+48, (**(**TCellInfo)(__ccgo_up(bp + 16))).FnKey)) } **(**Ti64)(__ccgo_up(bp)) = (**(**TCellInfo)(__ccgo_up(bp + 16))).FnKey keyCanBeEqual = 0 /* Only the first key on the page may ==maxKey */ } /* Check the content overflow list */ if (**(**TCellInfo)(__ccgo_up(bp + 16))).FnPayload > uint32((**(**TCellInfo)(__ccgo_up(bp + 16))).FnLocal) { /* First page of the overflow chain */ nPage = ((**(**TCellInfo)(__ccgo_up(bp + 16))).FnPayload - uint32((**(**TCellInfo)(__ccgo_up(bp + 16))).FnLocal) + usableSize - uint32(5)) / (usableSize - uint32(4)) pgnoOvfl = _sqlite3Get4byte(tls, pCell+uintptr(libc.Int32FromUint16((**(**TCellInfo)(__ccgo_up(bp + 16))).FnSize)-int32(4))) if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { _checkPtrmap(tls, pCheck, pgnoOvfl, uint8(PTRMAP_OVERFLOW1), iPage) } _checkList(tls, pCheck, 0, pgnoOvfl, nPage) } if !((*TMemPage)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp + 8)))).Fleaf != 0) { /* Check sanity of left child page for internal pages */ pgno = libc.Int32FromUint32(_sqlite3Get4byte(tls, pCell)) if (*TBtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { _checkPtrmap(tls, pCheck, libc.Uint32FromInt32(pgno), uint8(PTRMAP_BTREE), iPage) } d2 = _checkTreePage(tls, pCheck, libc.Uint32FromInt32(pgno), bp, **(**Ti64)(__ccgo_up(bp))) keyCanBeEqual = 0 if d2 != depth { _checkAppendMsg(tls, pCheck, __ccgo_ts+4850, 0) depth = d2 } } else { /* Populate the coverage-checking heap for leaf pages */ _btreeHeapInsert(tls, heap, pc< 0 { /* For leaf pages, the min-heap has already been initialized and the ** cells have already been inserted. But for internal pages, that has ** not yet been done, so do it now */ if !((*TMemPage)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp + 8)))).Fleaf != 0) { heap = (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fheap **(**Tu32)(__ccgo_up(heap)) = uint32(0) i = nCell - int32(1) for { if !(i >= 0) { break } pc = libc.Uint32FromInt32(libc.Int32FromUint8(**(**Tu8)(__ccgo_up(data + uintptr(cellStart+i*int32(2)))))< 0 { /* Enforced by btreeComputeFreeSpace() */ size1 = libc.Int32FromUint8(**(**Tu8)(__ccgo_up(data + uintptr(i+int32(2)))))<= **(**Tu32)(__ccgo_up(bp + 12))>>libc.Int32FromInt32(16) { _checkAppendMsg(tls, pCheck, __ccgo_ts+4875, libc.VaList(bp+48, **(**Tu32)(__ccgo_up(bp + 12))>>int32(16), iPage)) break } else { nFrag = libc.Int32FromUint32(uint32(nFrag) + (**(**Tu32)(__ccgo_up(bp + 12))>>libc.Int32FromInt32(16) - prev&libc.Uint32FromInt32(0xffff) - libc.Uint32FromInt32(1))) prev = **(**Tu32)(__ccgo_up(bp + 12)) } } nFrag = libc.Int32FromUint32(uint32(nFrag) + (usableSize - prev&libc.Uint32FromInt32(0xffff) - libc.Uint32FromInt32(1))) /* EVIDENCE-OF: R-43263-13491 The total number of bytes in all fragments ** is stored in the fifth field of the b-tree page header. ** EVIDENCE-OF: R-07161-27322 The one-byte integer at offset 7 gives the ** number of fragmented free bytes within the cell content area. */ if **(**Tu32)(__ccgo_up(heap)) == uint32(0) && nFrag != libc.Int32FromUint8(**(**Tu8)(__ccgo_up(data + uintptr(hdr+int32(7))))) { _checkAppendMsg(tls, pCheck, __ccgo_ts+4912, libc.VaList(bp+48, nFrag, libc.Int32FromUint8(**(**Tu8)(__ccgo_up(data + uintptr(hdr+int32(7))))), iPage)) } } goto end_of_check end_of_check: ; if !(doCoverageCheck != 0) { (*TMemPage)(unsafe.Pointer(**(**uintptr)(__ccgo_up(bp + 8)))).FisInit = savedIsInit } _releasePage(tls, **(**uintptr)(__ccgo_up(bp + 8))) (*TIntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = saved_zPfx (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = libc.Uint32FromInt32(saved_v1) (*TIntegrityCk)(unsafe.Pointer(pCheck)).Fv2 = saved_v2 return depth + int32(1) } // C documentation // // /* // ** Generate an instruction that will put the integer describe by // ** text z[0..n-1] into register iMem. // ** // ** Expr.u.zToken is always UTF8 and zero-terminated. // */ func _codeInteger(tls *libc.TLS, pParse uintptr, pExpr uintptr, negFlag int32, iMem int32) { bp := tls.Alloc(32) defer tls.Free(32) var c, i int32 var v, z, v1 uintptr var v2 int64 var _ /* value at bp+0 */ Ti64 _, _, _, _, _, _ = c, i, v, z, v1, v2 v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&uint32(EP_IntValue) != 0 { i = *(*int32)(unsafe.Pointer(pExpr + 8)) if negFlag != 0 { i = -i } _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), i, iMem) } else { z = *(*uintptr)(unsafe.Pointer(pExpr + 8)) c = _sqlite3DecOrHexToI64(tls, z, bp) if c == int32(3) && !(negFlag != 0) || c == int32(2) || negFlag != 0 && **(**Ti64)(__ccgo_up(bp)) == int64(-libc.Int32FromInt32(1))-(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)<op==TK_IS: op==TK_EQ and p5==SQLITE_NULLEQ // ** if pExpr->op==TK_ISNOT: op==TK_NE and p5==SQLITE_NULLEQ // ** otherwise: op==pExpr->op and p5==0 // */ func _codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32, op Tu8, p5 Tu8) { bp := tls.Alloc(16) defer tls.Free(16) var addrCmp, addrDone, i, isCommuted, nLeft, r1, r2, regLeft, regRight int32 var opx Tu8 var pLeft, pRight, v uintptr var _ /* pL at bp+8 */ uintptr var _ /* pR at bp+12 */ uintptr var _ /* regFree1 at bp+0 */ int32 var _ /* regFree2 at bp+4 */ int32 _, _, _, _, _, _, _, _, _, _, _, _, _ = addrCmp, addrDone, i, isCommuted, nLeft, opx, pLeft, pRight, r1, r2, regLeft, regRight, v v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe pLeft = (*TExpr)(unsafe.Pointer(pExpr)).FpLeft pRight = (*TExpr)(unsafe.Pointer(pExpr)).FpRight nLeft = _sqlite3ExprVectorSize(tls, pLeft) regLeft = 0 regRight = 0 opx = op addrCmp = 0 addrDone = _sqlite3VdbeMakeLabel(tls, pParse) isCommuted = libc.BoolInt32((*TExpr)(unsafe.Pointer(pExpr)).Fflags&libc.Uint32FromInt32(libc.Int32FromInt32(EP_Commuted)) != uint32(0)) if (*TParse)(unsafe.Pointer(pParse)).FnErr != 0 { return } if nLeft != _sqlite3ExprVectorSize(tls, pRight) { _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+6910, 0) return } if libc.Int32FromUint8(op) == int32(TK_LE) { opx = uint8(TK_LT) } if libc.Int32FromUint8(op) == int32(TK_GE) { opx = uint8(TK_GT) } if libc.Int32FromUint8(op) == int32(TK_NE) { opx = uint8(TK_EQ) } regLeft = _exprCodeSubselect(tls, pParse, pLeft) regRight = _exprCodeSubselect(tls, pParse, pRight) _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), int32(1), dest) i = 0 for { if !(int32(1) != 0) { break } **(**int32)(__ccgo_up(bp)) = 0 **(**int32)(__ccgo_up(bp + 4)) = 0 **(**uintptr)(__ccgo_up(bp + 8)) = uintptr(0) **(**uintptr)(__ccgo_up(bp + 12)) = uintptr(0) if addrCmp != 0 { _sqlite3VdbeJumpHere(tls, v, addrCmp) } r1 = _exprVectorRegister(tls, pParse, pLeft, i, regLeft, bp+8, bp) r2 = _exprVectorRegister(tls, pParse, pRight, i, regRight, bp+12, bp+4) addrCmp = _sqlite3VdbeCurrentAddr(tls, v) _codeCompare(tls, pParse, **(**uintptr)(__ccgo_up(bp + 8)), **(**uintptr)(__ccgo_up(bp + 12)), libc.Int32FromUint8(opx), r1, r2, addrDone, libc.Int32FromUint8(p5), isCommuted) _sqlite3ReleaseTempReg(tls, pParse, **(**int32)(__ccgo_up(bp))) _sqlite3ReleaseTempReg(tls, pParse, **(**int32)(__ccgo_up(bp + 4))) if (libc.Int32FromUint8(opx) == int32(TK_LT) || libc.Int32FromUint8(opx) == int32(TK_GT)) && i < nLeft-int32(1) { addrCmp = _sqlite3VdbeAddOp0(tls, v, int32(OP_ElseEq)) } if libc.Int32FromUint8(p5) == int32(SQLITE_NULLEQ) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Integer), 0, dest) } else { _sqlite3VdbeAddOp3(tls, v, int32(OP_ZeroOrNull), r1, dest, r2) } if i == nLeft-int32(1) { break } if libc.Int32FromUint8(opx) == int32(TK_EQ) { _sqlite3VdbeAddOp2(tls, v, int32(OP_NotNull), dest, addrDone) } else { _sqlite3VdbeAddOp2(tls, v, int32(OP_Goto), 0, addrDone) if i == nLeft-int32(2) { opx = op } } goto _1 _1: ; i = i + 1 } _sqlite3VdbeJumpHere(tls, v, addrCmp) _sqlite3VdbeResolveLabel(tls, v, addrDone) if libc.Int32FromUint8(op) == int32(TK_NE) { _sqlite3VdbeAddOp2(tls, v, int32(OP_Not), dest, dest) } } // C documentation // // /* // ** Return a pointer to a string containing the 'declaration type' of the // ** expression pExpr. The string may be treated as static by the caller. // ** // ** The declaration type is the exact datatype definition extracted from the // ** original CREATE TABLE statement if the expression is a column. The // ** declaration type for a ROWID field is INTEGER. Exactly when an expression // ** is considered a column can be complex in the presence of subqueries. The // ** result-set expression in all of the following SELECT statements is // ** considered a column by this function. // ** // ** SELECT col FROM tbl; // ** SELECT (SELECT col FROM tbl; // ** SELECT (SELECT col FROM tbl); // ** SELECT abc FROM (SELECT col AS abc FROM tbl); // ** // ** The declaration type for any expression other than a column is NULL. // ** // ** This routine has either 3 or 6 parameters depending on whether or not // ** the SQLITE_ENABLE_COLUMN_METADATA compile-time option is used. // */ func _columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr, pzOrigTab uintptr, pzOrigCol uintptr) (r uintptr) { bp := tls.Alloc(96) defer tls.Free(96) var iCol, iDb, j int32 var p, p1, pS, pS1, pTab, pTabList, zType uintptr var _ /* sNC at bp+12 */ TNameContext var _ /* sNC at bp+48 */ TNameContext var _ /* zOrigCol at bp+8 */ uintptr var _ /* zOrigDb at bp+0 */ uintptr var _ /* zOrigTab at bp+4 */ uintptr _, _, _, _, _, _, _, _, _, _ = iCol, iDb, j, p, p1, pS, pS1, pTab, pTabList, zType zType = uintptr(0) **(**uintptr)(__ccgo_up(bp)) = uintptr(0) **(**uintptr)(__ccgo_up(bp + 4)) = uintptr(0) **(**uintptr)(__ccgo_up(bp + 8)) = uintptr(0) switch libc.Int32FromUint8((*TExpr)(unsafe.Pointer(pExpr)).Fop) { case int32(TK_COLUMN): /* The expression is a column. Locate the table the column is being ** extracted from in NameContext.pSrcList. This table may be real ** database table or a subquery. */ pTab = uintptr(0) /* Table structure column is extracted from */ pS = uintptr(0) /* Select the column is extracted from */ iCol = int32((*TExpr)(unsafe.Pointer(pExpr)).FiColumn) /* Index of column in pTab */ for pNC != 0 && !(pTab != 0) { pTabList = (*TNameContext)(unsafe.Pointer(pNC)).FpSrcList j = 0 for { if !(j < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc && (*(*TSrcItem)(unsafe.Pointer(pTabList + 8 + uintptr(j)*48))).FiCursor != (*TExpr)(unsafe.Pointer(pExpr)).FiTable) { break } goto _1 _1: ; j = j + 1 } if j < (*TSrcList)(unsafe.Pointer(pTabList)).FnSrc { pTab = (*(*TSrcItem)(unsafe.Pointer(pTabList + 8 + uintptr(j)*48))).FpSTab if int32(*(*uint32)(unsafe.Pointer(pTabList + 8 + uintptr(j)*48 + 12 + 4))&0x4>>2) != 0 { pS = (*TSubquery)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pTabList + 8 + uintptr(j)*48 + 44)))).FpSelect } else { pS = uintptr(0) } } else { pNC = (*TNameContext)(unsafe.Pointer(pNC)).FpNext } } if pTab == uintptr(0) { /* At one time, code such as "SELECT new.x" within a trigger would ** cause this condition to run. Since then, we have restructured how ** trigger code is generated and so this condition is no longer ** possible. However, it can still be true for statements like ** the following: ** ** CREATE TABLE t1(col INTEGER); ** SELECT (SELECT t1.col) FROM FROM t1; ** ** when columnType() is called on the expression "t1.col" in the ** sub-select. In this case, set the column type to NULL, even ** though it should really be "INTEGER". ** ** This is not a problem, as the column type of "t1.col" is never ** used. When columnType() is called on the expression ** "(SELECT t1.col)", the correct type is returned (see the TK_SELECT ** branch below. */ break } if pS != 0 { /* The "table" is actually a sub-select or a view in the FROM clause ** of the SELECT statement. Return the declaration type and origin ** data for the result-set column of the sub-select. */ if iCol < (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList)).FnExpr && libc.Bool(libc.Bool(!(libc.Int32FromInt32(ViewCanHaveRowid) != 0)) || iCol >= 0) { p = (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS)).FpEList + 8 + uintptr(iCol)*20))).FpExpr (**(**TNameContext)(__ccgo_up(bp + 12))).FpSrcList = (*TSelect)(unsafe.Pointer(pS)).FpSrc (**(**TNameContext)(__ccgo_up(bp + 12))).FpNext = pNC (**(**TNameContext)(__ccgo_up(bp + 12))).FpParse = (*TNameContext)(unsafe.Pointer(pNC)).FpParse zType = _columnTypeImpl(tls, bp+12, p, bp, bp+4, bp+8) } } else { /* A real table or a CTE table */ if iCol < 0 { iCol = int32((*TTable)(unsafe.Pointer(pTab)).FiPKey) } if iCol < 0 { zType = __ccgo_ts + 1176 **(**uintptr)(__ccgo_up(bp + 8)) = __ccgo_ts + 17965 } else { **(**uintptr)(__ccgo_up(bp + 8)) = (**(**TColumn)(__ccgo_up((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*12))).FzCnName zType = _sqlite3ColumnType(tls, (*TTable)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*12, uintptr(0)) } **(**uintptr)(__ccgo_up(bp + 4)) = (*TTable)(unsafe.Pointer(pTab)).FzName if (*TNameContext)(unsafe.Pointer(pNC)).FpParse != 0 && (*TTable)(unsafe.Pointer(pTab)).FpSchema != 0 { iDb = _sqlite3SchemaToIndex(tls, (*TParse)(unsafe.Pointer((*TNameContext)(unsafe.Pointer(pNC)).FpParse)).Fdb, (*TTable)(unsafe.Pointer(pTab)).FpSchema) **(**uintptr)(__ccgo_up(bp)) = (**(**TDb)(__ccgo_up((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer((*TNameContext)(unsafe.Pointer(pNC)).FpParse)).Fdb)).FaDb + uintptr(iDb)*16))).FzDbSName } } case int32(TK_SELECT): pS1 = *(*uintptr)(unsafe.Pointer(pExpr + 20)) p1 = (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pS1)).FpEList + 8))).FpExpr (**(**TNameContext)(__ccgo_up(bp + 48))).FpSrcList = (*TSelect)(unsafe.Pointer(pS1)).FpSrc (**(**TNameContext)(__ccgo_up(bp + 48))).FpNext = pNC (**(**TNameContext)(__ccgo_up(bp + 48))).FpParse = (*TNameContext)(unsafe.Pointer(pNC)).FpParse zType = _columnTypeImpl(tls, bp+48, p1, bp, bp+4, bp+8) break } if pzOrigDb != 0 { **(**uintptr)(__ccgo_up(pzOrigDb)) = **(**uintptr)(__ccgo_up(bp)) **(**uintptr)(__ccgo_up(pzOrigTab)) = **(**uintptr)(__ccgo_up(bp + 4)) **(**uintptr)(__ccgo_up(pzOrigCol)) = **(**uintptr)(__ccgo_up(bp + 8)) } return zType } // C documentation // // /* // ** Attempt to transform a query of the form // ** // ** SELECT count(*) FROM (SELECT x FROM t1 UNION ALL SELECT y FROM t2) // ** // ** Into this: // ** // ** SELECT (SELECT count(*) FROM t1)+(SELECT count(*) FROM t2) // ** // ** The transformation only works if all of the following are true: // ** // ** * The subquery is a UNION ALL of two or more terms // ** * The subquery does not have a LIMIT clause // ** * There is no WHERE or GROUP BY or HAVING clauses on the subqueries // ** * The outer query is a simple count(*) with no WHERE clause or other // ** extraneous syntax. // ** * None of the subqueries are DISTINCT (forumpost/a860f5fb2e 2025-03-10) // ** // ** Return TRUE if the optimization is undertaken. // */ func _countOfViewOptimization(tls *libc.TLS, pParse uintptr, p uintptr) (r int32) { var db, pCount, pExpr, pFrom, pPrior, pSub, pTerm, v1 uintptr _, _, _, _, _, _, _, _ = db, pCount, pExpr, pFrom, pPrior, pSub, pTerm, v1 if (*TSelect)(unsafe.Pointer(p)).FselFlags&uint32(SF_Aggregate) == uint32(0) { return 0 } /* This is an aggregate */ if (*TExprList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList)).FnExpr != int32(1) { return 0 } /* Single result column */ if (*TSelect)(unsafe.Pointer(p)).FpWhere != 0 { return 0 } if (*TSelect)(unsafe.Pointer(p)).FpHaving != 0 { return 0 } if (*TSelect)(unsafe.Pointer(p)).FpGroupBy != 0 { return 0 } if (*TSelect)(unsafe.Pointer(p)).FpOrderBy != 0 { return 0 } pExpr = (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList + 8))).FpExpr if libc.Int32FromUint8((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_AGG_FUNCTION) { return 0 } /* Result is an aggregate */ if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8)), __ccgo_ts+17118) != 0 { return 0 } /* Is count() */ if *(*uintptr)(unsafe.Pointer(pExpr + 20)) != uintptr(0) { return 0 } /* Must be count(*) */ if (*TSrcList)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpSrc)).FnSrc != int32(1) { return 0 } /* One table in FROM */ if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&libc.Uint32FromInt32(libc.Int32FromInt32(EP_WinFunc)) != uint32(0) { return 0 } /* Not a window function */ pFrom = (*TSelect)(unsafe.Pointer(p)).FpSrc + 8 if int32(*(*uint32)(unsafe.Pointer(pFrom + 12 + 4))&0x4>>2) == 0 { return 0 } /* FROM is a subquery */ pSub = (*TSubquery)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pFrom + 44)))).FpSelect if (*TSelect)(unsafe.Pointer(pSub)).FpPrior == uintptr(0) { return 0 } /* Must be a compound */ if (*TSelect)(unsafe.Pointer(pSub)).FselFlags&uint32(SF_CopyCte) != 0 { return 0 } /* Not a CTE */ for cond := true; cond; cond = pSub != 0 { if libc.Int32FromUint8((*TSelect)(unsafe.Pointer(pSub)).Fop) != int32(TK_ALL) && (*TSelect)(unsafe.Pointer(pSub)).FpPrior != 0 { return 0 } /* Must be UNION ALL */ if (*TSelect)(unsafe.Pointer(pSub)).FpWhere != 0 { return 0 } /* No WHERE clause */ if (*TSelect)(unsafe.Pointer(pSub)).FpLimit != 0 { return 0 } /* No LIMIT clause */ if (*TSelect)(unsafe.Pointer(pSub)).FselFlags&libc.Uint32FromInt32(libc.Int32FromInt32(SF_Aggregate)|libc.Int32FromInt32(SF_Distinct)) != 0 { return 0 /* Not an aggregate nor DISTINCT */ } /* Due to the previous */ pSub = (*TSelect)(unsafe.Pointer(pSub)).FpPrior /* Repeat over compound */ } /* If we reach this point then it is OK to perform the transformation */ db = (*TParse)(unsafe.Pointer(pParse)).Fdb pCount = pExpr pExpr = uintptr(0) pSub = _sqlite3SubqueryDetach(tls, db, pFrom) _sqlite3SrcListDelete(tls, db, (*TSelect)(unsafe.Pointer(p)).FpSrc) (*TSelect)(unsafe.Pointer(p)).FpSrc = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(uint32(libc.UintptrFromInt32(0)+8)+libc.Uint32FromInt64(48))) for pSub != 0 { pPrior = (*TSelect)(unsafe.Pointer(pSub)).FpPrior (*TSelect)(unsafe.Pointer(pSub)).FpPrior = uintptr(0) (*TSelect)(unsafe.Pointer(pSub)).FpNext = uintptr(0) **(**Tu32)(__ccgo_up(pSub + 4)) |= uint32(SF_Aggregate) **(**Tu32)(__ccgo_up(pSub + 4)) &= ^libc.Uint32FromInt32(SF_Compound) (*TSelect)(unsafe.Pointer(pSub)).FnSelectRow = 0 _sqlite3ParserAddCleanup(tls, pParse, __ccgo_fp(_sqlite3ExprListDeleteGeneric), (*TSelect)(unsafe.Pointer(pSub)).FpEList) if pPrior != 0 { v1 = _sqlite3ExprDup(tls, db, pCount, 0) } else { v1 = pCount } pTerm = v1 (*TSelect)(unsafe.Pointer(pSub)).FpEList = _sqlite3ExprListAppend(tls, pParse, uintptr(0), pTerm) pTerm = _sqlite3PExpr(tls, pParse, int32(TK_SELECT), uintptr(0), uintptr(0)) _sqlite3PExprAddSelect(tls, pParse, pTerm, pSub) if pExpr == uintptr(0) { pExpr = pTerm } else { pExpr = _sqlite3PExpr(tls, pParse, int32(TK_PLUS), pTerm, pExpr) } pSub = pPrior } (*(*TExprList_item)(unsafe.Pointer((*TSelect)(unsafe.Pointer(p)).FpEList + 8))).FpExpr = pExpr **(**Tu32)(__ccgo_up(p + 4)) &= ^libc.Uint32FromInt32(SF_Aggregate) return int32(1) } // C documentation // // /* // ** Connect to or create a dbpagevfs virtual table. // */ func _dbpageConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) (r int32) { var pTab uintptr var rc int32 _, _ = pTab, rc pTab = uintptr(0) rc = SQLITE_OK _ = pAux _ = argc _ = argv _ = pzErr Xsqlite3_vtab_config(tls, db, int32(SQLITE_VTAB_DIRECTONLY), 0) Xsqlite3_vtab_config(tls, db, int32(SQLITE_VTAB_USES_ALL_SCHEMAS), 0) rc = Xsqlite3_declare_vtab(tls, db, __ccgo_ts+35000) if rc == SQLITE_OK { pTab = Xsqlite3_malloc64(tls, uint64(24)) if pTab == uintptr(0) { rc = int32(SQLITE_NOMEM) } } if rc == SQLITE_OK { libc.Xmemset(tls, pTab, 0, uint32(24)) (*TDbpageTable)(unsafe.Pointer(pTab)).Fdb = db } **(**uintptr)(__ccgo_up(ppVtab)) = pTab return rc } func _dbpageUpdate(tls *libc.TLS, pVtab uintptr, argc int32, argv uintptr, pRowid uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var aPage, pBt, pData, pPager, pTab, zErr, zSchema uintptr var iDb, isInsert, rc, szPage, v1 int32 var pgno TPgno var _ /* pDbPage at bp+0 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _ = aPage, iDb, isInsert, pBt, pData, pPager, pTab, pgno, rc, szPage, zErr, zSchema, v1 pTab = pVtab **(**uintptr)(__ccgo_up(bp)) = uintptr(0) rc = SQLITE_OK zErr = uintptr(0) _ = pRowid if (*Tsqlite3)(unsafe.Pointer((*TDbpageTable)(unsafe.Pointer(pTab)).Fdb)).Fflags&uint64(SQLITE_Defensive) != 0 { zErr = __ccgo_ts + 35067 goto update_fail } if argc == int32(1) { zErr = __ccgo_ts + 35077 goto update_fail } if Xsqlite3_value_type(tls, **(**uintptr)(__ccgo_up(argv))) == int32(SQLITE_NULL) { pgno = libc.Uint32FromInt64(Xsqlite3_value_int64(tls, **(**uintptr)(__ccgo_up(argv + 2*4)))) isInsert = int32(1) } else { pgno = libc.Uint32FromInt64(Xsqlite3_value_int64(tls, **(**uintptr)(__ccgo_up(argv)))) if libc.Uint32FromInt32(Xsqlite3_value_int(tls, **(**uintptr)(__ccgo_up(argv + 1*4)))) != pgno { zErr = __ccgo_ts + 35091 goto update_fail } isInsert = 0 } if Xsqlite3_value_type(tls, **(**uintptr)(__ccgo_up(argv + 4*4))) == int32(SQLITE_NULL) { iDb = 0 } else { zSchema = Xsqlite3_value_text(tls, **(**uintptr)(__ccgo_up(argv + 4*4))) iDb = _sqlite3FindDbName(tls, (*TDbpageTable)(unsafe.Pointer(pTab)).Fdb, zSchema) if iDb < 0 { zErr = __ccgo_ts + 35105 goto update_fail } } pBt = (**(**TDb)(__ccgo_up((*Tsqlite3)(unsafe.Pointer((*TDbpageTable)(unsafe.Pointer(pTab)).Fdb)).FaDb + uintptr(iDb)*16))).FpBt if pgno < uint32(1) || pBt == uintptr(0) { zErr = __ccgo_ts + 35120 goto update_fail } szPage = _sqlite3BtreeGetPageSize(tls, pBt) if Xsqlite3_value_type(tls, **(**uintptr)(__ccgo_up(argv + 3*4))) != int32(SQLITE_BLOB) || Xsqlite3_value_bytes(tls, **(**uintptr)(__ccgo_up(argv + 3*4))) != szPage { if Xsqlite3_value_type(tls, **(**uintptr)(__ccgo_up(argv + 3*4))) == int32(SQLITE_NULL) && isInsert != 0 && pgno > uint32(1) { /* "INSERT INTO dbpage($PGNO,NULL)" causes page number $PGNO and ** all subsequent pages to be deleted. */ (*TDbpageTable)(unsafe.Pointer(pTab)).FiDbTrunc = iDb (*TDbpageTable)(unsafe.Pointer(pTab)).FpgnoTrunc = pgno - uint32(1) pgno = uint32(1) } else { zErr = __ccgo_ts + 35136 goto update_fail } } if _dbpageBeginTrans(tls, pTab) != SQLITE_OK { zErr = __ccgo_ts + 35151 goto update_fail } pPager = _sqlite3BtreePager(tls, pBt) rc = _sqlite3PagerGet(tls, pPager, pgno, bp, 0) if rc == SQLITE_OK { pData = Xsqlite3_value_blob(tls, **(**uintptr)(__ccgo_up(argv + 3*4))) v1 = _sqlite3PagerWrite(tls, **(**uintptr)(__ccgo_up(bp))) rc = v1 if v1 == SQLITE_OK && pData != 0 { aPage = _sqlite3PagerGetData(tls, **(**uintptr)(__ccgo_up(bp))) libc.Xmemcpy(tls, aPage, pData, libc.Uint32FromInt32(szPage)) (*TDbpageTable)(unsafe.Pointer(pTab)).FpgnoTrunc = uint32(0) } } if rc != SQLITE_OK { (*TDbpageTable)(unsafe.Pointer(pTab)).FpgnoTrunc = uint32(0) } _sqlite3PagerUnref(tls, **(**uintptr)(__ccgo_up(bp))) return rc goto update_fail update_fail: ; (*TDbpageTable)(unsafe.Pointer(pTab)).FpgnoTrunc = uint32(0) Xsqlite3_free(tls, (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) (*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+3942, libc.VaList(bp+16, zErr)) return int32(SQLITE_ERROR) } // C documentation // // /* // ** Write code to erase the table with root-page iTable from database iDb. // ** Also write code to modify the sqlite_schema table and internal schema // ** if a root-page of another table is moved by the btree-layer whilst // ** erasing iTable (this can happen with an auto-vacuum database). // */ func _destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { bp := tls.Alloc(48) defer tls.Free(48) var r1 int32 var v uintptr _, _ = r1, v v = _sqlite3GetVdbe(tls, pParse) r1 = _sqlite3GetTempReg(tls, pParse) if iTable < int32(2) { _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+14871, 0) } _sqlite3VdbeAddOp3(tls, v, int32(OP_Destroy), iTable, r1, iDb) _sqlite3MayAbort(tls, pParse) /* OP_Destroy stores an in integer r1. If this integer ** is non-zero, then it is the root page number of a table moved to ** location iTable. The following code modifies the sqlite_schema table to ** reflect this. ** ** The "#NNN" in the SQL is a special constant that means whatever value ** is in register NNN. See grammar rules associated with the TK_REGISTER ** token for additional information. */ _sqlite3NestedParse(tls, pParse, __ccgo_ts+14886, libc.VaList(bp+8, (**(**TDb)(__ccgo_up((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*16))).FzDbSName, iTable, r1, r1)) _sqlite3ReleaseTempReg(tls, pParse, r1) } // C documentation // // /* // ** The implementation of internal UDF sqlite_drop_column(). // ** // ** Arguments: // ** // ** argv[0]: An integer - the index of the schema containing the table // ** argv[1]: CREATE TABLE statement to modify. // ** argv[2]: An integer - the index of the column to remove. // ** // ** The value returned is a string containing the CREATE TABLE statement // ** with column argv[2] removed. // */ func _dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { bp := tls.Alloc(320) defer tls.Free(320) var db, pCol, pEnd, pTab, zDb, zEnd, zNew, zSql uintptr var iCol, iSchema, rc int32 var xAuth Tsqlite3_xauth var _ /* eTok at bp+284 */ int32 var _ /* sParse at bp+0 */ TParse _, _, _, _, _, _, _, _, _, _, _, _ = db, iCol, iSchema, pCol, pEnd, pTab, rc, xAuth, zDb, zEnd, zNew, zSql db = Xsqlite3_context_db_handle(tls, context) iSchema = Xsqlite3_value_int(tls, **(**uintptr)(__ccgo_up(argv))) zSql = Xsqlite3_value_text(tls, **(**uintptr)(__ccgo_up(argv + 1*4))) iCol = Xsqlite3_value_int(tls, **(**uintptr)(__ccgo_up(argv + 2*4))) zDb = (**(**TDb)(__ccgo_up((*Tsqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iSchema)*16))).FzDbSName zNew = uintptr(0) xAuth = (*Tsqlite3)(unsafe.Pointer(db)).FxAuth (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) _ = NotUsed rc = _renameParseSql(tls, bp, zDb, db, zSql, libc.BoolInt32(iSchema == int32(1))) if rc != SQLITE_OK { goto drop_column_done } pTab = (**(**TParse)(__ccgo_up(bp))).FpNewTable if pTab == uintptr(0) || int32((*TTable)(unsafe.Pointer(pTab)).FnCol) == int32(1) || iCol >= int32((*TTable)(unsafe.Pointer(pTab)).FnCol) { /* This can happen if the sqlite_schema table is corrupt */ rc = _sqlite3CorruptError(tls, int32(122753)) goto drop_column_done } if iCol < int32((*TTable)(unsafe.Pointer(pTab)).FnCol)-int32(1) { pCol = _renameTokenFind(tls, bp, uintptr(0), (**(**TColumn)(__ccgo_up((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*12))).FzCnName) pEnd = _renameTokenFind(tls, bp, uintptr(0), (**(**TColumn)(__ccgo_up((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol+int32(1))*12))).FzCnName) zEnd = (*TRenameToken)(unsafe.Pointer(pEnd)).Ft.Fz } else { /* Point pCol->t.z at the "," immediately preceding the definition of ** the column being dropped. To do this, start at the name of the ** previous column, and tokenize until the next ",". */ pCol = _renameTokenFind(tls, bp, uintptr(0), (**(**TColumn)(__ccgo_up((*TTable)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol-int32(1))*12))).FzCnName) for cond := true; cond; cond = **(**int32)(__ccgo_up(bp + 284)) != int32(TK_COMMA) { (*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz += uintptr(_getConstraintToken(tls, (*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz, bp+284)) } (*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz = (*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz - 1 zEnd = zSql + uintptr((*(*struct { FaddColOffset int32 FpFKey uintptr FpDfltList uintptr })(unsafe.Pointer(pTab + 44))).FaddColOffset) } zNew = _sqlite3MPrintf(tls, db, __ccgo_ts+11587, libc.VaList(bp+296, int32((*TRenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int32(zSql), zSql, zEnd)) Xsqlite3_result_text(tls, context, zNew, -int32(1), uintptr(-libc.Int32FromInt32(1))) Xsqlite3_free(tls, zNew) goto drop_column_done drop_column_done: ; _renameParseCleanup(tls, bp) (*Tsqlite3)(unsafe.Pointer(db)).FxAuth = xAuth if rc != SQLITE_OK { Xsqlite3_result_error_code(tls, context, rc) } } // C documentation // // /* // ** Internal SQL function sqlite3_drop_constraint(): Given an input // ** CREATE TABLE statement, return a revised CREATE TABLE statement // ** with a constraint removed. Two forms, depending on the datatype // ** of argv[2]: // ** // ** sqlite_drop_constraint(SQL, INT) -- Omit NOT NULL from the INT-th column // ** sqlite_drop_constraint(SQL, TEXT) -- OMIT constraint with name TEXT // ** // ** In the first case, the left-most column is 0. // */ func _dropConstraintFunc(tls *libc.TLS, ctx uintptr, NotUsed int32, argv uintptr) { bp := tls.Alloc(64) defer tls.Free(64) var db, zCons, zNew, zSpace, zSql uintptr var iEnd, iNotNull, iStart, ii, nTok int32 var _ /* cmp at bp+8 */ int32 var _ /* iOff at bp+0 */ int32 var _ /* t at bp+4 */ int32 _, _, _, _, _, _, _, _, _, _ = db, iEnd, iNotNull, iStart, ii, nTok, zCons, zNew, zSpace, zSql zSql = Xsqlite3_value_text(tls, **(**uintptr)(__ccgo_up(argv))) zCons = uintptr(0) iNotNull = -int32(1) **(**int32)(__ccgo_up(bp)) = 0 iStart = 0 iEnd = 0 zNew = uintptr(0) **(**int32)(__ccgo_up(bp + 4)) = 0 _ = NotUsed if zSql == uintptr(0) { return } /* Jump past the "CREATE TABLE" bit. */ if _skipCreateTable(tls, ctx, zSql, bp) != 0 { return } if Xsqlite3_value_type(tls, **(**uintptr)(__ccgo_up(argv + 1*4))) == int32(SQLITE_INTEGER) { iNotNull = Xsqlite3_value_int(tls, **(**uintptr)(__ccgo_up(argv + 1*4))) } else { zCons = Xsqlite3_value_text(tls, **(**uintptr)(__ccgo_up(argv + 1*4))) } /* Search for the named constraint within column definitions. */ ii = 0 for { if !(iEnd == 0) { break } /* Now parse the column or table constraint definition. Search ** for the token CONSTRAINT if this is a DROP CONSTRAINT command, or ** NOT in the right column if this is a DROP NOT NULL. */ for int32(1) != 0 { iStart = **(**int32)(__ccgo_up(bp)) **(**int32)(__ccgo_up(bp)) = **(**int32)(__ccgo_up(bp)) + _getConstraintToken(tls, zSql+uintptr(**(**int32)(__ccgo_up(bp))), bp+4) if **(**int32)(__ccgo_up(bp + 4)) == int32(TK_CONSTRAINT) && (zCons != 0 || iNotNull == ii) { /* Check if this is the constraint we are searching for. */ nTok = 0 **(**int32)(__ccgo_up(bp + 8)) = int32(1) /* Skip past any whitespace. */ **(**int32)(__ccgo_up(bp)) = **(**int32)(__ccgo_up(bp)) + _getWhitespace(tls, zSql+uintptr(**(**int32)(__ccgo_up(bp)))) /* Compare the next token - which may be quoted - with the name of ** the constraint being dropped. */ nTok = _getConstraintToken(tls, zSql+uintptr(**(**int32)(__ccgo_up(bp))), bp+4) if zCons != 0 { if _quotedCompare(tls, ctx, **(**int32)(__ccgo_up(bp + 4)), zSql+uintptr(**(**int32)(__ccgo_up(bp))), nTok, zCons, bp+8) != 0 { return } } **(**int32)(__ccgo_up(bp)) = **(**int32)(__ccgo_up(bp)) + nTok /* The next token is usually the first token of the constraint ** definition. This is enough to tell the type of the constraint - ** TK_NOT means it is a NOT NULL, TK_CHECK a CHECK constraint etc. ** ** There is also the chance that the next token is TK_CONSTRAINT ** (or TK_DEFAULT or TK_COLLATE), for example if a table has been ** created as follows: ** ** CREATE TABLE t1(cols, CONSTRAINT one CONSTRAINT two NOT NULL); ** ** In this case, allow the "CONSTRAINT one" bit to be dropped by ** this command if that is what is requested, or to advance to ** the next iteration of the loop with &zSql[iOff] still pointing ** to the CONSTRAINT keyword. */ nTok = _getConstraintToken(tls, zSql+uintptr(**(**int32)(__ccgo_up(bp))), bp+4) if **(**int32)(__ccgo_up(bp + 4)) == int32(TK_CONSTRAINT) || **(**int32)(__ccgo_up(bp + 4)) == int32(TK_DEFAULT) || **(**int32)(__ccgo_up(bp + 4)) == int32(TK_COLLATE) || **(**int32)(__ccgo_up(bp + 4)) == int32(TK_COMMA) || **(**int32)(__ccgo_up(bp + 4)) == int32(TK_RP) || **(**int32)(__ccgo_up(bp + 4)) == int32(TK_GENERATED) || **(**int32)(__ccgo_up(bp + 4)) == int32(TK_AS) { **(**int32)(__ccgo_up(bp + 4)) = int32(TK_CHECK) } else { **(**int32)(__ccgo_up(bp)) = **(**int32)(__ccgo_up(bp)) + nTok **(**int32)(__ccgo_up(bp)) = **(**int32)(__ccgo_up(bp)) + _getConstraint(tls, zSql+uintptr(**(**int32)(__ccgo_up(bp)))) } if **(**int32)(__ccgo_up(bp + 8)) == 0 || iNotNull >= 0 && **(**int32)(__ccgo_up(bp + 4)) == int32(TK_NOT) { if **(**int32)(__ccgo_up(bp + 4)) != int32(TK_NOT) && **(**int32)(__ccgo_up(bp + 4)) != int32(TK_CHECK) { _errorMPrintf(tls, ctx, __ccgo_ts+11821, libc.VaList(bp+24, zCons)) return } iEnd = **(**int32)(__ccgo_up(bp)) break } } else { if **(**int32)(__ccgo_up(bp + 4)) == int32(TK_NOT) && iNotNull == ii { iEnd = **(**int32)(__ccgo_up(bp)) + _getConstraint(tls, zSql+uintptr(**(**int32)(__ccgo_up(bp)))) break } else { if **(**int32)(__ccgo_up(bp + 4)) == int32(TK_RP) || **(**int32)(__ccgo_up(bp + 4)) == int32(TK_ILLEGAL) { iEnd = -int32(1) break } else { if **(**int32)(__ccgo_up(bp + 4)) == int32(TK_COMMA) { break } } } } } goto _1 _1: ; ii = ii + 1 } /* If the constraint has not been found it is an error. */ if iEnd <= 0 { if zCons != 0 { _errorMPrintf(tls, ctx, __ccgo_ts+11855, libc.VaList(bp+24, zCons)) } else { /* SQLite follows postgres in that a DROP NOT NULL on a column that is ** not NOT NULL is not an error. So just return the original SQL here. */ Xsqlite3_result_text(tls, ctx, zSql, -int32(1), uintptr(-libc.Int32FromInt32(1))) } } else { /* Figure out if an extra space should be inserted after the constraint ** is removed. And if an additional comma preceding the constraint ** should be removed. */ zSpace = __ccgo_ts + 11543 iEnd = iEnd + _getWhitespace(tls, zSql+uintptr(iEnd)) _sqlite3GetToken(tls, zSql+uintptr(iEnd), bp+4) if **(**int32)(__ccgo_up(bp + 4)) == int32(TK_RP) || **(**int32)(__ccgo_up(bp + 4)) == int32(TK_COMMA) { zSpace = __ccgo_ts + 1702 if libc.Int32FromUint8(**(**Tu8)(__ccgo_up(zSql + uintptr(iStart-int32(1))))) == int32(',') { iStart = iStart - 1 } } db = Xsqlite3_context_db_handle(tls, ctx) zNew = _sqlite3MPrintf(tls, db, __ccgo_ts+11878, libc.VaList(bp+24, iStart, zSql, zSpace, zSql+uintptr(iEnd))) Xsqlite3_result_text(tls, ctx, zNew, -int32(1), __ccgo_fp(_sqlite3RowSetClear)) } } // C documentation // // /* // ** Implementation of the sqlite_log() function. This is a wrapper around // ** sqlite3_log(). The return value is NULL. The function exists purely for // ** its side-effects. // */ func _errlogFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { bp := tls.Alloc(16) defer tls.Free(16) _ = argc _ = context Xsqlite3_log(tls, Xsqlite3_value_int(tls, **(**uintptr)(__ccgo_up(argv))), __ccgo_ts+3942, libc.VaList(bp+8, Xsqlite3_value_text(tls, **(**uintptr)(__ccgo_up(argv + 1*4))))) } // C documentation // // /* // ** Execute zSql on database db. // ** // ** If zSql returns rows, then each row will have exactly one // ** column. (This will only happen if zSql begins with "SELECT".) // ** Take each row of result and call execSql() again recursively. // ** // ** The execSqlF() routine does the same thing, except it accepts // ** a format string as its third argument // */ func _execSql(tls *libc.TLS, db uintptr, pzErrMsg uintptr, zSql uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var rc, v1 int32 var zSubSql uintptr var _ /* pStmt at bp+0 */ uintptr _, _, _ = rc, zSubSql, v1 /* printf("SQL: [%s]\n", zSql); fflush(stdout); */ rc = Xsqlite3_prepare_v2(tls, db, zSql, -int32(1), bp, uintptr(0)) if rc != SQLITE_OK { return rc } for { v1 = Xsqlite3_step(tls, **(**uintptr)(__ccgo_up(bp))) rc = v1 if !(int32(SQLITE_ROW) == v1) { break } zSubSql = Xsqlite3_column_text(tls, **(**uintptr)(__ccgo_up(bp)), 0) /* The secondary SQL must be one of CREATE TABLE, CREATE INDEX, ** or INSERT. Historically there have been attacks that first ** corrupt the sqlite_schema.sql field with other kinds of statements ** then run VACUUM to get those statements to execute at inappropriate ** times. */ if zSubSql != 0 && (libc.Xstrncmp(tls, zSubSql, __ccgo_ts+22731, uint32(3)) == 0 || libc.Xstrncmp(tls, zSubSql, __ccgo_ts+22735, uint32(3)) == 0) { rc = _execSql(tls, db, pzErrMsg, zSubSql) if rc != SQLITE_OK { break } } } if rc == int32(SQLITE_DONE) { rc = SQLITE_OK } if rc != 0 { _sqlite3SetString(tls, pzErrMsg, db, Xsqlite3_errmsg(tls, db)) } Xsqlite3_finalize(tls, **(**uintptr)(__ccgo_up(bp))) return rc } // C documentation // // /* // ** Return the name of the i-th column of the pIdx index. // */ func _explainIndexColumnName(tls *libc.TLS, pIdx uintptr, i int32) (r uintptr) { i = int32(**(**Ti16)(__ccgo_up((*TIndex)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if i == -int32(2) { return __ccgo_ts + 23620 } if i == -int32(1) { return __ccgo_ts + 17965 } return (**(**TColumn)(__ccgo_up((*TTable)(unsafe.Pointer((*TIndex)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(i)*12))).FzCnName } // C documentation // // /* // ** Add a single OP_Explain instruction to the VDBE to explain a simple // ** count(*) query ("SELECT count(*) FROM pTab"). // */ func _explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintptr) { bp := tls.Alloc(32) defer tls.Free(32) var bCover int32 var v1, v2 uintptr _, _, _ = bCover, v1, v2 if libc.Int32FromUint8((*TParse)(unsafe.Pointer(pParse)).Fexplain) == int32(2) { bCover = libc.BoolInt32(pIdx != uintptr(0) && ((*TTable)(unsafe.Pointer(pTab)).FtabFlags&uint32(TF_WithoutRowid) == uint32(0) || !(int32(uint32(*(*uint16)(unsafe.Pointer(pIdx + 56))&0x3>>0)) == libc.Int32FromInt32(SQLITE_IDXTYPE_PRIMARYKEY)))) if bCover != 0 { v1 = __ccgo_ts + 21527 } else { v1 = __ccgo_ts + 1702 } if bCover != 0 { v2 = (*TIndex)(unsafe.Pointer(pIdx)).FzName } else { v2 = __ccgo_ts + 1702 } _sqlite3VdbeExplain(tls, pParse, uint8(0), __ccgo_ts+21550, libc.VaList(bp+8, (*TTable)(unsafe.Pointer(pTab)).FzName, v1, v2)) } } // C documentation // // /* // ** Initialize the contents of the unixFile structure pointed to by pId. // */ func _fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilename uintptr, ctrlFlags int32) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var nFilename, rc int32 var pLockingStyle, pNew, zLockFile, v1, v2 uintptr _, _, _, _, _, _, _ = nFilename, pLockingStyle, pNew, rc, zLockFile, v1, v2 pNew = pId rc = SQLITE_OK /* No locking occurs in temporary files */ (*TunixFile)(unsafe.Pointer(pNew)).Fh = h (*TunixFile)(unsafe.Pointer(pNew)).FpVfs = pVfs (*TunixFile)(unsafe.Pointer(pNew)).FzPath = zFilename (*TunixFile)(unsafe.Pointer(pNew)).FctrlFlags = uint16(libc.Uint8FromInt32(ctrlFlags)) (*TunixFile)(unsafe.Pointer(pNew)).FmmapSizeMax = _sqlite3Config.FszMmap if ctrlFlags&int32(UNIXFILE_URI) != 0 { v1 = zFilename } else { v1 = uintptr(0) } if Xsqlite3_uri_boolean(tls, v1, __ccgo_ts+3976, int32(SQLITE_POWERSAFE_OVERWRITE)) != 0 { v2 = pNew + 18 *(*uint16)(unsafe.Pointer(v2)) = uint16(int32(*(*uint16)(unsafe.Pointer(v2))) | libc.Int32FromInt32(UNIXFILE_PSOW)) } if libc.Xstrcmp(tls, (*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FzName, __ccgo_ts+3981) == 0 { v1 = pNew + 18 *(*uint16)(unsafe.Pointer(v1)) = uint16(int32(*(*uint16)(unsafe.Pointer(v1))) | libc.Int32FromInt32(UNIXFILE_EXCL)) } if ctrlFlags&int32(UNIXFILE_NOLOCK) != 0 { pLockingStyle = uintptr(unsafe.Pointer(&_nolockIoMethods)) } else { pLockingStyle = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{*(*uintptr)(unsafe.Pointer((*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData))})))(tls, zFilename, pNew) } if pLockingStyle == uintptr(unsafe.Pointer(&_posixIoMethods)) { _unixEnterMutex(tls) rc = _findInodeInfo(tls, pNew, pNew+8) if rc != SQLITE_OK { /* If an error occurred in findInodeInfo(), close the file descriptor ** immediately, before releasing the mutex. findInodeInfo() may fail ** in two scenarios: ** ** (a) A call to fstat() failed. ** (b) A malloc failed. ** ** Scenario (b) may only occur if the process is holding no other ** file descriptors open on the same file. If there were other file ** descriptors on this file, then no malloc would be required by ** findInodeInfo(). If this is the case, it is quite safe to close ** handle h - as it is guaranteed that no posix locks will be released ** by doing so. ** ** If scenario (a) caused the error then things are not so safe. The ** implicit assumption here is that if fstat() fails, things are in ** such bad shape that dropping a lock or two doesn't matter much. */ _robust_close(tls, pNew, h, int32(46355)) h = -int32(1) } _unixLeaveMutex(tls) } else { if pLockingStyle == uintptr(unsafe.Pointer(&_dotlockIoMethods)) { nFilename = libc.Int32FromUint32(libc.Xstrlen(tls, zFilename)) + int32(6) zLockFile = Xsqlite3_malloc64(tls, libc.Uint64FromInt32(nFilename)) if zLockFile == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { Xsqlite3_snprintf(tls, nFilename, zLockFile, __ccgo_ts+3991, libc.VaList(bp+8, zFilename)) } (*TunixFile)(unsafe.Pointer(pNew)).FlockingContext = zLockFile } } _storeLastErrno(tls, pNew, 0) if rc != SQLITE_OK { if h >= 0 { _robust_close(tls, pNew, h, int32(46447)) } } else { (*Tsqlite3_file)(unsafe.Pointer(pId)).FpMethods = pLockingStyle _verifyDbFile(tls, pNew) } return rc } // C documentation // // /* // ** Return a pointer corresponding to database zDb (i.e. "main", "temp") // ** in connection handle pDb. If such a database cannot be found, return // ** a NULL pointer and write an error message to pErrorDb. // ** // ** If the "temp" database is requested, it may need to be opened by this // ** function. If an error occurs while doing so, return 0 and write an // ** error message to pErrorDb. // */ func _findBtree(tls *libc.TLS, pErrorDb uintptr, pDb uintptr, zDb uintptr) (r uintptr) { bp := tls.Alloc(304) defer tls.Free(304) var i, rc int32 var _ /* sParse at bp+0 */ TParse _, _ = i, rc i = _sqlite3FindDbName(tls, pDb, zDb) if i == int32(1) { rc = 0 _sqlite3ParseObjectInit(tls, bp, pDb) if _sqlite3OpenTempDatabase(tls, bp) != 0 { _sqlite3ErrorWithMsg(tls, pErrorDb, (**(**TParse)(__ccgo_up(bp))).Frc, __ccgo_ts+3942, libc.VaList(bp+296, (**(**TParse)(__ccgo_up(bp))).FzErrMsg)) rc = int32(SQLITE_ERROR) } _sqlite3DbFree(tls, pErrorDb, (**(**TParse)(__ccgo_up(bp))).FzErrMsg) _sqlite3ParseObjectReset(tls, bp) if rc != 0 { return uintptr(0) } } if i < 0 { _sqlite3ErrorWithMsg(tls, pErrorDb, int32(SQLITE_ERROR), __ccgo_ts+5127, libc.VaList(bp+296, zDb)) return uintptr(0) } return (**(**TDb)(__ccgo_up((*Tsqlite3)(unsafe.Pointer(pDb)).FaDb + uintptr(i)*16))).FpBt } // C documentation // // /* // ** Expression callback used by sqlite3FixAAAA() routines. // */ func _fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var pFix uintptr _ = pFix pFix = *(*uintptr)(unsafe.Pointer(p + 24)) if !((*TDbFixer)(unsafe.Pointer(pFix)).FbTemp != 0) { **(**Tu32)(__ccgo_up(pExpr + 4)) |= libc.Uint32FromInt32(libc.Int32FromInt32(EP_FromDDL)) } if libc.Int32FromUint8((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_VARIABLE) { if (*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer((*TDbFixer)(unsafe.Pointer(pFix)).FpParse)).Fdb)).Finit1.Fbusy != 0 { (*TExpr)(unsafe.Pointer(pExpr)).Fop = uint8(TK_NULL) } else { _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+13541, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType)) return int32(WRC_Abort) } } return WRC_Continue } // C documentation // // /* // ** Select callback used by sqlite3FixAAAA() routines. // */ func _fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var db, pFix, pItem, pList uintptr var i, iDb int32 _, _, _, _, _, _ = db, i, iDb, pFix, pItem, pList pFix = *(*uintptr)(unsafe.Pointer(p + 24)) db = (*TParse)(unsafe.Pointer((*TDbFixer)(unsafe.Pointer(pFix)).FpParse)).Fdb iDb = _sqlite3FindDbName(tls, db, (*TDbFixer)(unsafe.Pointer(pFix)).FzDb) pList = (*TSelect)(unsafe.Pointer(pSelect)).FpSrc if pList == uintptr(0) { return WRC_Continue } i = 0 pItem = pList + 8 for { if !(i < (*TSrcList)(unsafe.Pointer(pList)).FnSrc) { break } if libc.Int32FromUint8((*TDbFixer)(unsafe.Pointer(pFix)).FbTemp) == 0 && int32(*(*uint32)(unsafe.Pointer(pItem + 12 + 4))&0x4>>2) == 0 { if int32(*(*uint32)(unsafe.Pointer(pItem + 12 + 4))&0x10000>>16) == 0 && *(*uintptr)(unsafe.Pointer(pItem + 44)) != uintptr(0) { if iDb != _sqlite3FindDbName(tls, db, *(*uintptr)(unsafe.Pointer(pItem + 44))) { _sqlite3ErrorMsg(tls, (*TDbFixer)(unsafe.Pointer(pFix)).FpParse, __ccgo_ts+13565, libc.VaList(bp+8, (*TDbFixer)(unsafe.Pointer(pFix)).FzType, (*TDbFixer)(unsafe.Pointer(pFix)).FpName, *(*uintptr)(unsafe.Pointer(pItem + 44)))) return int32(WRC_Abort) } _sqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(pItem + 44))) libc.SetBitFieldPtr32Uint32(pItem+12+4, libc.Uint32FromInt32(1), 10, 0x400) libc.SetBitFieldPtr32Uint32(pItem+12+4, libc.Uint32FromInt32(1), 17, 0x20000) } *(*uintptr)(unsafe.Pointer(pItem + 44)) = (*TDbFixer)(unsafe.Pointer(pFix)).FpSchema libc.SetBitFieldPtr32Uint32(pItem+12+4, libc.Uint32FromInt32(1), 8, 0x100) libc.SetBitFieldPtr32Uint32(pItem+12+4, libc.Uint32FromInt32(1), 16, 0x10000) } if int32(*(*uint32)(unsafe.Pointer(pList + 8 + uintptr(i)*48 + 12 + 4))&0x800>>11) == 0 && _sqlite3WalkExpr(tls, pFix+4, *(*uintptr)(unsafe.Pointer(pList + 8 + uintptr(i)*48 + 40))) != 0 { return int32(WRC_Abort) } goto _1 _1: ; i = i + 1 pItem += 48 } if (*TSelect)(unsafe.Pointer(pSelect)).FpWith != 0 { i = 0 for { if !(i < (*TWith)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSelect)).FpWith)).FnCte) { break } if _sqlite3WalkSelect(tls, p, (*(*TCte)(unsafe.Pointer((*TSelect)(unsafe.Pointer(pSelect)).FpWith + 12 + uintptr(i)*24))).FpSelect) != 0 { return int32(WRC_Abort) } goto _2 _2: ; i = i + 1 } } return WRC_Continue } func _fts5ApiCallback(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var iCsrId Ti64 var pAux, pCsr, pTab uintptr _, _, _, _ = iCsrId, pAux, pCsr, pTab pAux = Xsqlite3_user_data(tls, context) iCsrId = Xsqlite3_value_int64(tls, **(**uintptr)(__ccgo_up(argv))) pCsr = _fts5CursorFromCsrid(tls, (*TFts5Auxiliary)(unsafe.Pointer(pAux)).FpGlobal, iCsrId) if pCsr == uintptr(0) || ((*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan == 0 || (*TFts5Cursor)(unsafe.Pointer(pCsr)).FePlan == int32(FTS5_PLAN_SPECIAL)) { _fts5ResultError(tls, context, __ccgo_ts+40420, libc.VaList(bp+8, iCsrId)) } else { pTab = (*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab _fts5ApiInvoke(tls, pAux, pCsr, context, argc-int32(1), argv+1*4) Xsqlite3_free(tls, (*Tsqlite3_vtab)(unsafe.Pointer(pTab)).FzErrMsg) (*Tsqlite3_vtab)(unsafe.Pointer(pTab)).FzErrMsg = uintptr(0) } } // C documentation // // /* // ** Create an "ascii" tokenizer. // */ func _fts5AsciiCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, ppOut uintptr) (r int32) { var i, rc int32 var p, zArg uintptr _, _, _, _ = i, p, rc, zArg rc = SQLITE_OK p = uintptr(0) _ = pUnused if nArg%int32(2) != 0 { rc = int32(SQLITE_ERROR) } else { p = Xsqlite3_malloc64(tls, uint64(128)) if p == uintptr(0) { rc = int32(SQLITE_NOMEM) } else { libc.Xmemset(tls, p, 0, uint32(128)) libc.Xmemcpy(tls, p, uintptr(unsafe.Pointer(&_aAsciiTokenChar)), uint32(128)) i = 0 for { if !(rc == SQLITE_OK && i < nArg) { break } zArg = **(**uintptr)(__ccgo_up(azArg + uintptr(i+int32(1))*4)) if 0 == Xsqlite3_stricmp(tls, **(**uintptr)(__ccgo_up(azArg + uintptr(i)*4)), __ccgo_ts+41832) { _fts5AsciiAddExceptions(tls, p, zArg, int32(1)) } else { if 0 == Xsqlite3_stricmp(tls, **(**uintptr)(__ccgo_up(azArg + uintptr(i)*4)), __ccgo_ts+41843) { _fts5AsciiAddExceptions(tls, p, zArg, 0) } else { rc = int32(SQLITE_ERROR) } } goto _1 _1: ; i = i + int32(2) } if rc != SQLITE_OK { _fts5AsciiDelete(tls, p) p = uintptr(0) } } } **(**uintptr)(__ccgo_up(ppOut)) = p return rc } // C documentation // // /* // ** Populate the Fts5Config.zContentExprlist string. // */ func _fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var i int32 var _ /* buf at bp+4 */ TFts5Buffer var _ /* rc at bp+0 */ int32 _ = i **(**int32)(__ccgo_up(bp)) = SQLITE_OK **(**TFts5Buffer)(__ccgo_up(bp + 4)) = TFts5Buffer{} _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+4, __ccgo_ts+38042, libc.VaList(bp+24, (*TFts5Config)(unsafe.Pointer(p)).FzContentRowid)) if (*TFts5Config)(unsafe.Pointer(p)).FeContent != int32(FTS5_CONTENT_NONE) { i = 0 for { if !(i < (*TFts5Config)(unsafe.Pointer(p)).FnCol) { break } if (*TFts5Config)(unsafe.Pointer(p)).FeContent == int32(FTS5_CONTENT_EXTERNAL) { _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+4, __ccgo_ts+38047, libc.VaList(bp+24, **(**uintptr)(__ccgo_up((*TFts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*4)))) } else { if (*TFts5Config)(unsafe.Pointer(p)).FeContent == FTS5_CONTENT_NORMAL || **(**Tu8)(__ccgo_up((*TFts5Config)(unsafe.Pointer(p)).FabUnindexed + uintptr(i))) != 0 { _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+4, __ccgo_ts+38054, libc.VaList(bp+24, i)) } else { _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+4, __ccgo_ts+38062, 0) } } goto _1 _1: ; i = i + 1 } } if (*TFts5Config)(unsafe.Pointer(p)).FeContent == FTS5_CONTENT_NORMAL && (*TFts5Config)(unsafe.Pointer(p)).FbLocale != 0 { i = 0 for { if !(i < (*TFts5Config)(unsafe.Pointer(p)).FnCol) { break } if libc.Int32FromUint8(**(**Tu8)(__ccgo_up((*TFts5Config)(unsafe.Pointer(p)).FabUnindexed + uintptr(i)))) == 0 { _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+4, __ccgo_ts+38069, libc.VaList(bp+24, i)) } else { _sqlite3Fts5BufferAppendPrintf(tls, bp, bp+4, __ccgo_ts+38062, 0) } goto _2 _2: ; i = i + 1 } } (*TFts5Config)(unsafe.Pointer(p)).FzContentExprlist = (**(**TFts5Buffer)(__ccgo_up(bp + 4))).Fp return **(**int32)(__ccgo_up(bp)) } func _fts5ConfigParseColumn(tls *libc.TLS, p uintptr, zCol uintptr, zArg uintptr, pzErr uintptr, pbUnindexed uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var rc, v1 int32 var v2 uintptr _, _, _ = rc, v1, v2 rc = SQLITE_OK if 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+37966) || 0 == Xsqlite3_stricmp(tls, zCol, __ccgo_ts+17965) { **(**uintptr)(__ccgo_up(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+37971, libc.VaList(bp+8, zCol)) rc = int32(SQLITE_ERROR) } else { if zArg != 0 { if 0 == Xsqlite3_stricmp(tls, zArg, __ccgo_ts+38001) { **(**Tu8)(__ccgo_up((*TFts5Config)(unsafe.Pointer(p)).FabUnindexed + uintptr((*TFts5Config)(unsafe.Pointer(p)).FnCol))) = uint8(1) **(**int32)(__ccgo_up(pbUnindexed)) = int32(1) } else { **(**uintptr)(__ccgo_up(pzErr)) = Xsqlite3_mprintf(tls, __ccgo_ts+38011, libc.VaList(bp+8, zArg)) rc = int32(SQLITE_ERROR) } } } v2 = p + 16 v1 = *(*int32)(unsafe.Pointer(v2)) *(*int32)(unsafe.Pointer(v2)) = *(*int32)(unsafe.Pointer(v2)) + 1 **(**uintptr)(__ccgo_up((*TFts5Config)(unsafe.Pointer(p)).FazCol + uintptr(v1)*4)) = zCol return rc } // C documentation // // /* // ** // ** This function is called when the user attempts an UPDATE on a contentless // ** table. Parameter bRowidModified is true if the UPDATE statement modifies // ** the rowid value. Parameter apVal[] contains the new values for each user // ** defined column of the fts5 table. pConfig is the configuration object of the // ** table being updated (guaranteed to be contentless). The contentless_delete=1 // ** and contentless_unindexed=1 options may or may not be set. // ** // ** This function returns SQLITE_OK if the UPDATE can go ahead, or an SQLite // ** error code if it cannot. In this case an error message is also loaded into // ** pConfig. Output parameter (*pbContent) is set to true if the caller should // ** update the %_content table only - not the FTS index or any other shadow // ** table. This occurs when an UPDATE modifies only UNINDEXED columns of the // ** table. // ** // ** An UPDATE may proceed if: // ** // ** * The only columns modified are UNINDEXED columns, or // ** // ** * The contentless_delete=1 option was specified and all of the indexed // ** columns (not a subset) have been modified. // */ func _fts5ContentlessUpdate(tls *libc.TLS, pConfig uintptr, apVal uintptr, bRowidModified int32, pbContent uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var bSeenIndex, bSeenIndexNC, ii, rc int32 var v2 uintptr _, _, _, _, _ = bSeenIndex, bSeenIndexNC, ii, rc, v2 bSeenIndex = 0 /* Have seen modified indexed column */ bSeenIndexNC = 0 /* Have seen unmodified indexed column */ rc = SQLITE_OK ii = 0 for { if !(ii < (*TFts5Config)(unsafe.Pointer(pConfig)).FnCol) { break } if libc.Int32FromUint8(**(**Tu8)(__ccgo_up((*TFts5Config)(unsafe.Pointer(pConfig)).FabUnindexed + uintptr(ii)))) == 0 { if Xsqlite3_value_nochange(tls, **(**uintptr)(__ccgo_up(apVal + uintptr(ii)*4))) != 0 { bSeenIndexNC = bSeenIndexNC + 1 } else { bSeenIndex = bSeenIndex + 1 } } goto _1 _1: ; ii = ii + 1 } if bSeenIndex == 0 && bRowidModified == 0 { **(**int32)(__ccgo_up(pbContent)) = int32(1) } else { if bSeenIndexNC != 0 || (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete == 0 { rc = int32(SQLITE_ERROR) if (*TFts5Config)(unsafe.Pointer(pConfig)).FbContentlessDelete != 0 { v2 = __ccgo_ts + 40179 } else { v2 = __ccgo_ts + 40239 } _sqlite3Fts5ConfigErrmsg(tls, pConfig, v2, libc.VaList(bp+8, __ccgo_ts+40269, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName)) } } return rc } // C documentation // // /* // ** Argument pVal is the text of a full-text search expression. It may or // ** may not have been wrapped by fts5_locale(). This function extracts // ** the text of the expression, and sets output variable (*pzText) to // ** point to a nul-terminated buffer containing the expression. // ** // ** If pVal was an fts5_locale() value, then sqlite3Fts5SetLocale() is called // ** to set the tokenizer to use the specified locale. // ** // ** If output variable (*pbFreeAndReset) is set to true, then the caller // ** is required to (a) call sqlite3Fts5ClearLocale() to reset the tokenizer // ** locale, and (b) call sqlite3_free() to free (*pzText). // */ func _fts5ExtractExprText(tls *libc.TLS, pConfig uintptr, pVal uintptr, pzText uintptr, pbFreeAndReset uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* nLoc at bp+16 */ int32 var _ /* nText at bp+8 */ int32 var _ /* pLoc at bp+12 */ uintptr var _ /* pText at bp+4 */ uintptr var _ /* rc at bp+0 */ int32 **(**int32)(__ccgo_up(bp)) = SQLITE_OK if _sqlite3Fts5IsLocaleValue(tls, pConfig, pVal) != 0 { **(**uintptr)(__ccgo_up(bp + 4)) = uintptr(0) **(**int32)(__ccgo_up(bp + 8)) = 0 **(**uintptr)(__ccgo_up(bp + 12)) = uintptr(0) **(**int32)(__ccgo_up(bp + 16)) = 0 **(**int32)(__ccgo_up(bp)) = _sqlite3Fts5DecodeLocaleValue(tls, pVal, bp+4, bp+8, bp+12, bp+16) **(**uintptr)(__ccgo_up(pzText)) = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+12048, libc.VaList(bp+32, **(**int32)(__ccgo_up(bp + 8)), **(**uintptr)(__ccgo_up(bp + 4)))) if **(**int32)(__ccgo_up(bp)) == SQLITE_OK { _sqlite3Fts5SetLocale(tls, pConfig, **(**uintptr)(__ccgo_up(bp + 12)), **(**int32)(__ccgo_up(bp + 16))) } **(**int32)(__ccgo_up(pbFreeAndReset)) = int32(1) } else { **(**uintptr)(__ccgo_up(pzText)) = Xsqlite3_value_text(tls, pVal) **(**int32)(__ccgo_up(pbFreeAndReset)) = 0 } return **(**int32)(__ccgo_up(bp)) } func _fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) (r int32) { bp := tls.Alloc(32) defer tls.Free(32) var i int32 var nByte Tsqlite3_int64 var pAux, pConfig, pTab, zRank, zRankArgs, zSql uintptr var _ /* pStmt at bp+4 */ uintptr var _ /* rc at bp+0 */ int32 _, _, _, _, _, _, _, _ = i, nByte, pAux, pConfig, pTab, zRank, zRankArgs, zSql pTab = (*TFts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab pConfig = (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig **(**int32)(__ccgo_up(bp)) = SQLITE_OK pAux = uintptr(0) zRank = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRank zRankArgs = (*TFts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs if zRankArgs != 0 { zSql = _sqlite3Fts5Mprintf(tls, bp, __ccgo_ts+39851, libc.VaList(bp+16, zRankArgs)) if zSql != 0 { **(**uintptr)(__ccgo_up(bp + 4)) = uintptr(0) **(**int32)(__ccgo_up(bp)) = Xsqlite3_prepare_v3(tls, (*TFts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -int32(1), uint32(SQLITE_PREPARE_PERSISTENT), bp+4, uintptr(0)) Xsqlite3_free(tls, zSql) if **(**int32)(__ccgo_up(bp)) == SQLITE_OK { if int32(SQLITE_ROW) == Xsqlite3_step(tls, **(**uintptr)(__ccgo_up(bp + 4))) { (*TFts5Cursor)(unsafe.Pointer(pCsr)).FnRankArg = Xsqlite3_column_count(tls, **(**uintptr)(__ccgo_up(bp + 4))) nByte = libc.Int64FromUint32(uint32(4) * libc.Uint32FromInt32((*TFts5Cursor)(unsafe.Pointer(pCsr)).FnRankArg)) (*TFts5Cursor)(unsafe.Pointer(pCsr)).FapRankArg = _sqlite3Fts5MallocZero(tls, bp, nByte) if **(**int32)(__ccgo_up(bp)) == SQLITE_OK { i = 0 for { if !(i < (*TFts5Cursor)(unsafe.Pointer(pCsr)).FnRankArg) { break } **(**uintptr)(__ccgo_up((*TFts5Cursor)(unsafe.Pointer(pCsr)).FapRankArg + uintptr(i)*4)) = Xsqlite3_column_value(tls, **(**uintptr)(__ccgo_up(bp + 4)), i) goto _1 _1: ; i = i + 1 } } (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpRankArgStmt = **(**uintptr)(__ccgo_up(bp + 4)) } else { **(**int32)(__ccgo_up(bp)) = Xsqlite3_finalize(tls, **(**uintptr)(__ccgo_up(bp + 4))) } } } } if **(**int32)(__ccgo_up(bp)) == SQLITE_OK { pAux = _fts5FindAuxiliary(tls, pTab, zRank) if pAux == uintptr(0) { (*TFts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+39861, libc.VaList(bp+16, zRank)) **(**int32)(__ccgo_up(bp)) = int32(SQLITE_ERROR) } } (*TFts5Cursor)(unsafe.Pointer(pCsr)).FpRank = pAux return **(**int32)(__ccgo_up(bp)) } // C documentation // // /* // ** Implementation of fts5_get_locale() function. // */ func _fts5GetLocaleFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, nVal int32, apVal uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var eType, iCol, rc int32 var z, z1 uintptr var _ /* nLocale at bp+4 */ int32 var _ /* zLocale at bp+0 */ uintptr _, _, _, _, _ = eType, iCol, rc, z, z1 iCol = 0 eType = 0 rc = SQLITE_OK **(**uintptr)(__ccgo_up(bp)) = uintptr(0) **(**int32)(__ccgo_up(bp + 4)) = 0 /* xColumnLocale() must be available */ if nVal != int32(1) { z = __ccgo_ts + 37252 Xsqlite3_result_error(tls, pCtx, z, -int32(1)) return } eType = Xsqlite3_value_numeric_type(tls, **(**uintptr)(__ccgo_up(apVal))) if eType != int32(SQLITE_INTEGER) { z1 = __ccgo_ts + 37308 Xsqlite3_result_error(tls, pCtx, z1, -int32(1)) return } iCol = Xsqlite3_value_int(tls, **(**uintptr)(__ccgo_up(apVal))) if iCol < 0 || iCol >= (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxColumnCount})))(tls, pFts) { Xsqlite3_result_error_code(tls, pCtx, int32(SQLITE_RANGE)) return } rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxColumnLocale})))(tls, pFts, iCol, bp, bp+4) if rc != SQLITE_OK { Xsqlite3_result_error_code(tls, pCtx, rc) return } Xsqlite3_result_text(tls, pCtx, **(**uintptr)(__ccgo_up(bp)), **(**int32)(__ccgo_up(bp + 4)), uintptr(-libc.Int32FromInt32(1))) } // C documentation // // /* // ** Append text to the HighlightContext output string - p->zOut. Argument // ** z points to a buffer containing n bytes of text to append. If n is // ** negative, everything up until the first '\0' is appended to the output. // ** // ** If *pRc is set to any value other than SQLITE_OK when this function is // ** called, it is a no-op. If an error (i.e. an OOM condition) is encountered, // ** *pRc is set to an error code before returning. // */ func _fts5HighlightAppend(tls *libc.TLS, pRc uintptr, p uintptr, z uintptr, n int32) { bp := tls.Alloc(32) defer tls.Free(32) if **(**int32)(__ccgo_up(pRc)) == SQLITE_OK && z != 0 { if n < 0 { n = libc.Int32FromUint32(libc.Xstrlen(tls, z)) } (*THighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, __ccgo_ts+37147, libc.VaList(bp+8, (*THighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) if (*THighlightContext)(unsafe.Pointer(p)).FzOut == uintptr(0) { **(**int32)(__ccgo_up(pRc)) = int32(SQLITE_NOMEM) } } } // C documentation // // /* // ** Implementation of highlight() function. // */ func _fts5HighlightFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, nVal int32, apVal uintptr) { bp := tls.Alloc(80) defer tls.Free(80) var iCol int32 var zErr uintptr var _ /* ctx at bp+0 */ THighlightContext var _ /* nLoc at bp+76 */ int32 var _ /* pLoc at bp+72 */ uintptr var _ /* rc at bp+68 */ int32 _, _ = iCol, zErr if nVal != int32(3) { zErr = __ccgo_ts + 37154 Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) return } iCol = Xsqlite3_value_int(tls, **(**uintptr)(__ccgo_up(apVal))) libc.Xmemset(tls, bp, 0, uint32(68)) (**(**THighlightContext)(__ccgo_up(bp))).FzOpen = Xsqlite3_value_text(tls, **(**uintptr)(__ccgo_up(apVal + 1*4))) (**(**THighlightContext)(__ccgo_up(bp))).FzClose = Xsqlite3_value_text(tls, **(**uintptr)(__ccgo_up(apVal + 2*4))) (**(**THighlightContext)(__ccgo_up(bp))).FiRangeEnd = -int32(1) **(**int32)(__ccgo_up(bp + 68)) = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxColumnText})))(tls, pFts, iCol, bp+16, bp+20) if **(**int32)(__ccgo_up(bp + 68)) == int32(SQLITE_RANGE) { Xsqlite3_result_text(tls, pCtx, __ccgo_ts+1702, -int32(1), libc.UintptrFromInt32(0)) **(**int32)(__ccgo_up(bp + 68)) = SQLITE_OK } else { if (**(**THighlightContext)(__ccgo_up(bp))).FzIn != 0 { **(**uintptr)(__ccgo_up(bp + 72)) = uintptr(0) /* Locale of column iCol */ **(**int32)(__ccgo_up(bp + 76)) = 0 /* Size of pLoc in bytes */ if **(**int32)(__ccgo_up(bp + 68)) == SQLITE_OK { **(**int32)(__ccgo_up(bp + 68)) = _fts5CInstIterInit(tls, pApi, pFts, iCol, bp+24) } if **(**int32)(__ccgo_up(bp + 68)) == SQLITE_OK { **(**int32)(__ccgo_up(bp + 68)) = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxColumnLocale})))(tls, pFts, iCol, bp+72, bp+76) } if **(**int32)(__ccgo_up(bp + 68)) == SQLITE_OK { **(**int32)(__ccgo_up(bp + 68)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxTokenize_v2})))(tls, pFts, (**(**THighlightContext)(__ccgo_up(bp))).FzIn, (**(**THighlightContext)(__ccgo_up(bp))).FnIn, **(**uintptr)(__ccgo_up(bp + 72)), **(**int32)(__ccgo_up(bp + 76)), bp, __ccgo_fp(_fts5HighlightCb)) } if (**(**THighlightContext)(__ccgo_up(bp))).FbOpen != 0 { _fts5HighlightAppend(tls, bp+68, bp, (**(**THighlightContext)(__ccgo_up(bp))).FzClose, -int32(1)) } _fts5HighlightAppend(tls, bp+68, bp, (**(**THighlightContext)(__ccgo_up(bp))).FzIn+uintptr((**(**THighlightContext)(__ccgo_up(bp))).FiOff), (**(**THighlightContext)(__ccgo_up(bp))).FnIn-(**(**THighlightContext)(__ccgo_up(bp))).FiOff) if **(**int32)(__ccgo_up(bp + 68)) == SQLITE_OK { Xsqlite3_result_text(tls, pCtx, (**(**THighlightContext)(__ccgo_up(bp))).FzOut, -int32(1), uintptr(-libc.Int32FromInt32(1))) } Xsqlite3_free(tls, (**(**THighlightContext)(__ccgo_up(bp))).FzOut) } } if **(**int32)(__ccgo_up(bp + 68)) != SQLITE_OK { Xsqlite3_result_error_code(tls, pCtx, **(**int32)(__ccgo_up(bp + 68))) } } /* ** End of highlight() implementation. **************************************************************************/ func _fts5IndexIntegrityCheckSegment(tls *libc.TLS, p uintptr, pSeg uintptr) { bp := tls.Alloc(48) defer tls.Free(48) var bIdxDlidx, bSecureDelete, iDlidxPrevLeaf, iIdxLeaf, iIdxPrevLeaf, iOff, iPg, iPrevLeaf, iRowidOff, iRowidOff1, iSegid, nIdxTerm, rc2, res, v1, v2, v3 int32 var iDlRowid, iKey, iRow Ti64 var pConfig, pDlidx, pLeaf, zIdxTerm uintptr var _ /* iRowid at bp+8 */ Ti64 var _ /* nTerm at bp+4 */ int32 var _ /* pStmt at bp+0 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bIdxDlidx, bSecureDelete, iDlRowid, iDlidxPrevLeaf, iIdxLeaf, iIdxPrevLeaf, iKey, iOff, iPg, iPrevLeaf, iRow, iRowidOff, iRowidOff1, iSegid, nIdxTerm, pConfig, pDlidx, pLeaf, rc2, res, zIdxTerm, v1, v2, v3 pConfig = (*TFts5Index)(unsafe.Pointer(p)).FpConfig bSecureDelete = libc.BoolInt32((*TFts5Config)(unsafe.Pointer(pConfig)).FiVersion == int32(FTS5_CURRENT_VERSION_SECUREDELETE)) **(**uintptr)(__ccgo_up(bp)) = uintptr(0) iIdxPrevLeaf = (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst - int32(1) iDlidxPrevLeaf = (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoLast if (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst == 0 { return } _fts5IndexPrepareStmt(tls, p, bp, Xsqlite3_mprintf(tls, __ccgo_ts+39584, libc.VaList(bp+24, (*TFts5Config)(unsafe.Pointer(pConfig)).FzDb, (*TFts5Config)(unsafe.Pointer(pConfig)).FzName, (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid))) /* Iterate through the b-tree hierarchy. */ for (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && int32(SQLITE_ROW) == Xsqlite3_step(tls, **(**uintptr)(__ccgo_up(bp))) { /* Data for this leaf */ zIdxTerm = Xsqlite3_column_blob(tls, **(**uintptr)(__ccgo_up(bp)), int32(1)) nIdxTerm = Xsqlite3_column_bytes(tls, **(**uintptr)(__ccgo_up(bp)), int32(1)) iIdxLeaf = Xsqlite3_column_int(tls, **(**uintptr)(__ccgo_up(bp)), int32(2)) bIdxDlidx = Xsqlite3_column_int(tls, **(**uintptr)(__ccgo_up(bp)), int32(3)) /* If the leaf in question has already been trimmed from the segment, ** ignore this b-tree entry. Otherwise, load it into memory. */ if iIdxLeaf < (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst { continue } iRow = int64((*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid)<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B)+libc.Int32FromInt32(FTS5_DATA_DLI_B)) + int64(libc.Int32FromInt32(0))<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B)) + int64(libc.Int32FromInt32(0))<= iOff || iOff >= (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { _fts5IndexCorruptRowid(tls, p, iRow) } else { iOff = iOff + _sqlite3Fts5GetVarint32(tls, (*TFts5Data)(unsafe.Pointer(pLeaf)).Fp+uintptr(iOff), bp+4) if iOff+**(**int32)(__ccgo_up(bp + 4)) > (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { _fts5IndexCorruptRowid(tls, p, iRow) } else { if **(**int32)(__ccgo_up(bp + 4)) < nIdxTerm { v2 = **(**int32)(__ccgo_up(bp + 4)) } else { v2 = nIdxTerm } if v2 <= 0 { v1 = 0 } else { if **(**int32)(__ccgo_up(bp + 4)) < nIdxTerm { v3 = **(**int32)(__ccgo_up(bp + 4)) } else { v3 = nIdxTerm } v1 = libc.Xmemcmp(tls, (*TFts5Data)(unsafe.Pointer(pLeaf)).Fp+uintptr(iOff), zIdxTerm, libc.Uint32FromInt32(v3)) } res = v1 if res == 0 { res = **(**int32)(__ccgo_up(bp + 4)) - nIdxTerm } if res < 0 { _fts5IndexCorruptRowid(tls, p, iRow) } } } _fts5IntegrityCheckPgidx(tls, p, iRow, pLeaf) } _fts5DataRelease(tls, pLeaf) if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { break } /* Now check that the iter.nEmpty leaves following the current leaf ** (a) exist and (b) contain no terms. */ _fts5IndexIntegrityCheckEmpty(tls, p, pSeg, iIdxPrevLeaf+int32(1), iDlidxPrevLeaf+int32(1), iIdxLeaf-int32(1)) if (*TFts5Index)(unsafe.Pointer(p)).Frc != 0 { break } /* If there is a doclist-index, check that it looks right. */ if bIdxDlidx != 0 { pDlidx = uintptr(0) /* For iterating through doclist index */ iPrevLeaf = iIdxLeaf iSegid = (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid iPg = 0 pDlidx = _fts5DlidxIterInit(tls, p, 0, iSegid, iIdxLeaf) for { if !(_fts5DlidxIterEof(tls, p, pDlidx) == 0) { break } /* Check any rowid-less pages that occur before the current leaf. */ iPg = iPrevLeaf + int32(1) for { if !(iPg < _fts5DlidxIterPgno(tls, pDlidx)) { break } iKey = int64(iSegid)<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B)+libc.Int32FromInt32(FTS5_DATA_DLI_B)) + int64(libc.Int32FromInt32(0))<<(libc.Int32FromInt32(FTS5_DATA_PAGE_B)+libc.Int32FromInt32(FTS5_DATA_HEIGHT_B)) + int64(libc.Int32FromInt32(0))<= (*TFts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { _fts5IndexCorruptRowid(tls, p, iKey) } else { if bSecureDelete == 0 || iRowidOff1 > 0 { iDlRowid = _fts5DlidxIterRowid(tls, pDlidx) _sqlite3Fts5GetVarint(tls, (*TFts5Data)(unsafe.Pointer(pLeaf)).Fp+uintptr(iRowidOff1), bp+8) if **(**Ti64)(__ccgo_up(bp + 8)) < iDlRowid || bSecureDelete == 0 && **(**Ti64)(__ccgo_up(bp + 8)) != iDlRowid { _fts5IndexCorruptRowid(tls, p, iKey) } } } _fts5DataRelease(tls, pLeaf) } goto _4 _4: ; _fts5DlidxIterNext(tls, p, pDlidx) } iDlidxPrevLeaf = iPg _fts5DlidxIterFree(tls, pDlidx) } else { iDlidxPrevLeaf = (*TFts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoLast /* TODO: Check there is no doclist index */ } iIdxPrevLeaf = iIdxLeaf } rc2 = Xsqlite3_finalize(tls, **(**uintptr)(__ccgo_up(bp))) if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*TFts5Index)(unsafe.Pointer(p)).Frc = rc2 } /* Page iter.iLeaf must now be the rightmost leaf-page in the segment */ } // C documentation // // /* // ** Create a "porter" tokenizer. // */ func _fts5PorterCreate(tls *libc.TLS, pCtx uintptr, azArg uintptr, nArg int32, ppOut uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var az2, pApi, pRet, zBase, v2 uintptr var nArg2, rc, v1 int32 var _ /* pUserdata at bp+0 */ uintptr var _ /* pV2 at bp+4 */ uintptr _, _, _, _, _, _, _, _ = az2, nArg2, pApi, pRet, rc, zBase, v1, v2 pApi = pCtx rc = SQLITE_OK **(**uintptr)(__ccgo_up(bp)) = uintptr(0) zBase = __ccgo_ts + 41892 **(**uintptr)(__ccgo_up(bp + 4)) = uintptr(0) for nArg > 0 { if Xsqlite3_stricmp(tls, **(**uintptr)(__ccgo_up(azArg)), __ccgo_ts+41902) == 0 { nArg = nArg - 1 azArg += 4 } else { zBase = **(**uintptr)(__ccgo_up(azArg)) break } } pRet = Xsqlite3_malloc64(tls, uint64(148)) if pRet != 0 { libc.Xmemset(tls, pRet, 0, uint32(148)) rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tfts5_api)(unsafe.Pointer(pApi)).FxFindTokenizer_v2})))(tls, pApi, zBase, bp, bp+4) } else { rc = int32(SQLITE_NOMEM) } if rc == SQLITE_OK { if nArg > 0 { v1 = nArg - int32(1) } else { v1 = 0 } nArg2 = v1 if nArg2 != 0 { v2 = azArg + 1*4 } else { v2 = uintptr(0) } az2 = v2 libc.Xmemcpy(tls, pRet, **(**uintptr)(__ccgo_up(bp + 4)), uint32(16)) rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPorterTokenizer)(unsafe.Pointer(pRet)).Ftokenizer_v2.FxCreate})))(tls, **(**uintptr)(__ccgo_up(bp)), az2, nArg2, pRet+16) } if rc != SQLITE_OK { _fts5PorterDelete(tls, pRet) pRet = uintptr(0) } **(**uintptr)(__ccgo_up(ppOut)) = pRet return rc } // C documentation // // /* // ** Implementation of snippet() function. // */ func _fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, nVal int32, apVal uintptr) { bp := tls.Alloc(144) defer tls.Free(144) var aSeen, zEllips, zErr uintptr var i, iBestCol, iBestStart, iCol, ii, jj, nBestScore, nCol, nPhrase, v4 int32 var nToken Ti64 var v1, v2, v3 int64 var _ /* ctx at bp+0 */ THighlightContext var _ /* iAdj at bp+128 */ int32 var _ /* ic at bp+120 */ int32 var _ /* io at bp+124 */ int32 var _ /* ip at bp+116 */ int32 var _ /* nColSize at bp+76 */ int32 var _ /* nDoc at bp+108 */ int32 var _ /* nDocsize at bp+112 */ int32 var _ /* nInst at bp+72 */ int32 var _ /* nLoc at bp+104 */ int32 var _ /* nLoc at bp+140 */ int32 var _ /* nScore at bp+132 */ int32 var _ /* pLoc at bp+100 */ uintptr var _ /* pLoc at bp+136 */ uintptr var _ /* rc at bp+68 */ int32 var _ /* sFinder at bp+80 */ TFts5SFinder _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = aSeen, i, iBestCol, iBestStart, iCol, ii, jj, nBestScore, nCol, nPhrase, nToken, zEllips, zErr, v1, v2, v3, v4 **(**int32)(__ccgo_up(bp + 68)) = SQLITE_OK /* 5th argument to snippet() */ **(**int32)(__ccgo_up(bp + 72)) = 0 /* Column containing best snippet */ iBestStart = 0 /* First token of best snippet */ nBestScore = 0 /* Score of best snippet */ **(**int32)(__ccgo_up(bp + 76)) = 0 if nVal != int32(5) { zErr = __ccgo_ts + 37204 Xsqlite3_result_error(tls, pCtx, zErr, -int32(1)) return } nCol = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxColumnCount})))(tls, pFts) libc.Xmemset(tls, bp, 0, uint32(68)) iCol = Xsqlite3_value_int(tls, **(**uintptr)(__ccgo_up(apVal))) (**(**THighlightContext)(__ccgo_up(bp))).FzOpen = _fts5ValueToText(tls, **(**uintptr)(__ccgo_up(apVal + 1*4))) (**(**THighlightContext)(__ccgo_up(bp))).FzClose = _fts5ValueToText(tls, **(**uintptr)(__ccgo_up(apVal + 2*4))) (**(**THighlightContext)(__ccgo_up(bp))).FiRangeEnd = -int32(1) zEllips = _fts5ValueToText(tls, **(**uintptr)(__ccgo_up(apVal + 3*4))) if Xsqlite3_value_int64(tls, **(**uintptr)(__ccgo_up(apVal + 4*4))) > int64(libc.Int32FromInt32(0)) { v2 = Xsqlite3_value_int64(tls, **(**uintptr)(__ccgo_up(apVal + 4*4))) } else { v2 = int64(libc.Int32FromInt32(0)) } if v2 < int64(libc.Int32FromInt32(64)) { if Xsqlite3_value_int64(tls, **(**uintptr)(__ccgo_up(apVal + 4*4))) > int64(libc.Int32FromInt32(0)) { v3 = Xsqlite3_value_int64(tls, **(**uintptr)(__ccgo_up(apVal + 4*4))) } else { v3 = int64(libc.Int32FromInt32(0)) } v1 = v3 } else { v1 = int64(libc.Int32FromInt32(64)) } nToken = int64(int32(v1)) if iCol >= 0 { v4 = iCol } else { v4 = 0 } iBestCol = v4 nPhrase = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxPhraseCount})))(tls, pFts) aSeen = Xsqlite3_malloc64(tls, libc.Uint64FromInt32(nPhrase)) if aSeen == uintptr(0) { **(**int32)(__ccgo_up(bp + 68)) = int32(SQLITE_NOMEM) } if **(**int32)(__ccgo_up(bp + 68)) == SQLITE_OK { **(**int32)(__ccgo_up(bp + 68)) = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxInstCount})))(tls, pFts, bp+72) } libc.Xmemset(tls, bp+80, 0, uint32(20)) i = 0 for { if !(i < nCol) { break } if iCol < 0 || iCol == i { **(**uintptr)(__ccgo_up(bp + 100)) = uintptr(0) /* Locale of column iCol */ **(**int32)(__ccgo_up(bp + 104)) = 0 (**(**TFts5SFinder)(__ccgo_up(bp + 80))).FiPos = 0 (**(**TFts5SFinder)(__ccgo_up(bp + 80))).FnFirst = 0 **(**int32)(__ccgo_up(bp + 68)) = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxColumnText})))(tls, pFts, i, bp+80+16, bp+108) if **(**int32)(__ccgo_up(bp + 68)) != SQLITE_OK { break } **(**int32)(__ccgo_up(bp + 68)) = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxColumnLocale})))(tls, pFts, i, bp+100, bp+104) if **(**int32)(__ccgo_up(bp + 68)) != SQLITE_OK { break } **(**int32)(__ccgo_up(bp + 68)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxTokenize_v2})))(tls, pFts, (**(**TFts5SFinder)(__ccgo_up(bp + 80))).FzDoc, **(**int32)(__ccgo_up(bp + 108)), **(**uintptr)(__ccgo_up(bp + 100)), **(**int32)(__ccgo_up(bp + 104)), bp+80, __ccgo_fp(_fts5SentenceFinderCb)) if **(**int32)(__ccgo_up(bp + 68)) != SQLITE_OK { break } **(**int32)(__ccgo_up(bp + 68)) = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxColumnSize})))(tls, pFts, i, bp+112) if **(**int32)(__ccgo_up(bp + 68)) != SQLITE_OK { break } ii = 0 for { if !(**(**int32)(__ccgo_up(bp + 68)) == SQLITE_OK && ii < **(**int32)(__ccgo_up(bp + 72))) { break } **(**int32)(__ccgo_up(bp + 68)) = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxInst})))(tls, pFts, ii, bp+116, bp+120, bp+124) if **(**int32)(__ccgo_up(bp + 120)) != i { goto _6 } if **(**int32)(__ccgo_up(bp + 124)) > **(**int32)(__ccgo_up(bp + 112)) { **(**int32)(__ccgo_up(bp + 68)) = libc.Int32FromInt32(SQLITE_CORRUPT) | libc.Int32FromInt32(1)< nBestScore { nBestScore = **(**int32)(__ccgo_up(bp + 132)) iBestCol = i iBestStart = **(**int32)(__ccgo_up(bp + 128)) **(**int32)(__ccgo_up(bp + 76)) = **(**int32)(__ccgo_up(bp + 112)) } if **(**int32)(__ccgo_up(bp + 68)) == SQLITE_OK && (**(**TFts5SFinder)(__ccgo_up(bp + 80))).FnFirst != 0 && int64(**(**int32)(__ccgo_up(bp + 112))) > nToken { jj = 0 for { if !(jj < (**(**TFts5SFinder)(__ccgo_up(bp + 80))).FnFirst-int32(1)) { break } if **(**int32)(__ccgo_up((**(**TFts5SFinder)(__ccgo_up(bp + 80))).FaFirst + uintptr(jj+int32(1))*4)) > **(**int32)(__ccgo_up(bp + 124)) { break } goto _7 _7: ; jj = jj + 1 } if **(**int32)(__ccgo_up((**(**TFts5SFinder)(__ccgo_up(bp + 80))).FaFirst + uintptr(jj)*4)) < **(**int32)(__ccgo_up(bp + 124)) { libc.Xmemset(tls, aSeen, 0, libc.Uint32FromInt32(nPhrase)) **(**int32)(__ccgo_up(bp + 68)) = _fts5SnippetScore(tls, pApi, pFts, **(**int32)(__ccgo_up(bp + 112)), aSeen, i, **(**int32)(__ccgo_up((**(**TFts5SFinder)(__ccgo_up(bp + 80))).FaFirst + uintptr(jj)*4)), int32(nToken), bp+132, uintptr(0)) if **(**int32)(__ccgo_up((**(**TFts5SFinder)(__ccgo_up(bp + 80))).FaFirst + uintptr(jj)*4)) == 0 { v4 = int32(120) } else { v4 = int32(100) } **(**int32)(__ccgo_up(bp + 132)) = **(**int32)(__ccgo_up(bp + 132)) + v4 if **(**int32)(__ccgo_up(bp + 68)) == SQLITE_OK && **(**int32)(__ccgo_up(bp + 132)) > nBestScore { nBestScore = **(**int32)(__ccgo_up(bp + 132)) iBestCol = i iBestStart = **(**int32)(__ccgo_up((**(**TFts5SFinder)(__ccgo_up(bp + 80))).FaFirst + uintptr(jj)*4)) **(**int32)(__ccgo_up(bp + 76)) = **(**int32)(__ccgo_up(bp + 112)) } } } goto _6 _6: ; ii = ii + 1 } } goto _5 _5: ; i = i + 1 } if **(**int32)(__ccgo_up(bp + 68)) == SQLITE_OK { **(**int32)(__ccgo_up(bp + 68)) = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxColumnText})))(tls, pFts, iBestCol, bp+16, bp+20) } if **(**int32)(__ccgo_up(bp + 68)) == SQLITE_OK && **(**int32)(__ccgo_up(bp + 76)) == 0 { **(**int32)(__ccgo_up(bp + 68)) = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxColumnSize})))(tls, pFts, iBestCol, bp+76) } if (**(**THighlightContext)(__ccgo_up(bp))).FzIn != 0 { **(**uintptr)(__ccgo_up(bp + 136)) = uintptr(0) /* Locale of column iBestCol */ **(**int32)(__ccgo_up(bp + 140)) = 0 /* Bytes in pLoc */ if **(**int32)(__ccgo_up(bp + 68)) == SQLITE_OK { **(**int32)(__ccgo_up(bp + 68)) = _fts5CInstIterInit(tls, pApi, pFts, iBestCol, bp+24) } (**(**THighlightContext)(__ccgo_up(bp))).FiRangeStart = iBestStart (**(**THighlightContext)(__ccgo_up(bp))).FiRangeEnd = int32(int64(iBestStart) + nToken - int64(1)) if iBestStart > 0 { _fts5HighlightAppend(tls, bp+68, bp, zEllips, -int32(1)) } /* Advance iterator ctx.iter so that it points to the first coalesced ** phrase instance at or following position iBestStart. */ for (**(**THighlightContext)(__ccgo_up(bp))).Fiter.FiStart >= 0 && (**(**THighlightContext)(__ccgo_up(bp))).Fiter.FiStart < iBestStart && **(**int32)(__ccgo_up(bp + 68)) == SQLITE_OK { **(**int32)(__ccgo_up(bp + 68)) = _fts5CInstIterNext(tls, bp+24) } if **(**int32)(__ccgo_up(bp + 68)) == SQLITE_OK { **(**int32)(__ccgo_up(bp + 68)) = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxColumnLocale})))(tls, pFts, iBestCol, bp+136, bp+140) } if **(**int32)(__ccgo_up(bp + 68)) == SQLITE_OK { **(**int32)(__ccgo_up(bp + 68)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TFts5ExtensionApi)(unsafe.Pointer(pApi)).FxTokenize_v2})))(tls, pFts, (**(**THighlightContext)(__ccgo_up(bp))).FzIn, (**(**THighlightContext)(__ccgo_up(bp))).FnIn, **(**uintptr)(__ccgo_up(bp + 136)), **(**int32)(__ccgo_up(bp + 140)), bp, __ccgo_fp(_fts5HighlightCb)) } if (**(**THighlightContext)(__ccgo_up(bp))).FbOpen != 0 { _fts5HighlightAppend(tls, bp+68, bp, (**(**THighlightContext)(__ccgo_up(bp))).FzClose, -int32(1)) } if (**(**THighlightContext)(__ccgo_up(bp))).FiRangeEnd >= **(**int32)(__ccgo_up(bp + 76))-int32(1) { _fts5HighlightAppend(tls, bp+68, bp, (**(**THighlightContext)(__ccgo_up(bp))).FzIn+uintptr((**(**THighlightContext)(__ccgo_up(bp))).FiOff), (**(**THighlightContext)(__ccgo_up(bp))).FnIn-(**(**THighlightContext)(__ccgo_up(bp))).FiOff) } else { _fts5HighlightAppend(tls, bp+68, bp, zEllips, -int32(1)) } } if **(**int32)(__ccgo_up(bp + 68)) == SQLITE_OK { Xsqlite3_result_text(tls, pCtx, (**(**THighlightContext)(__ccgo_up(bp))).FzOut, -int32(1), uintptr(-libc.Int32FromInt32(1))) } else { Xsqlite3_result_error_code(tls, pCtx, **(**int32)(__ccgo_up(bp + 68))) } Xsqlite3_free(tls, (**(**THighlightContext)(__ccgo_up(bp))).FzOut) Xsqlite3_free(tls, aSeen) Xsqlite3_free(tls, (**(**TFts5SFinder)(__ccgo_up(bp + 80))).FaFirst) } /************************************************************************/ func _fts5StructureReadUncached(tls *libc.TLS, p uintptr) (r uintptr) { bp := tls.Alloc(32) defer tls.Free(32) var pConfig, pData uintptr var _ /* iCookie at bp+4 */ int32 var _ /* pRet at bp+0 */ uintptr _, _ = pConfig, pData **(**uintptr)(__ccgo_up(bp)) = uintptr(0) pConfig = (*TFts5Index)(unsafe.Pointer(p)).FpConfig pData = _fts5DataRead(tls, p, int64(FTS5_STRUCTURE_ROWID)) if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { /* TODO: Do we need this if the leaf-index is appended? Probably... */ libc.Xmemset(tls, (*TFts5Data)(unsafe.Pointer(pData)).Fp+uintptr((*TFts5Data)(unsafe.Pointer(pData)).Fnn), 0, uint32(FTS5_DATA_PADDING)) (*TFts5Index)(unsafe.Pointer(p)).Frc = _fts5StructureDecode(tls, (*TFts5Data)(unsafe.Pointer(pData)).Fp, (*TFts5Data)(unsafe.Pointer(pData)).Fnn, bp+4, bp) if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*TFts5Config)(unsafe.Pointer(pConfig)).Fpgsz == 0 || (*TFts5Config)(unsafe.Pointer(pConfig)).FiCookie != **(**int32)(__ccgo_up(bp + 4)) { (*TFts5Index)(unsafe.Pointer(p)).Frc = _sqlite3Fts5ConfigLoad(tls, pConfig, **(**int32)(__ccgo_up(bp + 4))) } } else { if (*TFts5Index)(unsafe.Pointer(p)).Frc == libc.Int32FromInt32(SQLITE_CORRUPT)|libc.Int32FromInt32(1)<