// Code generated by modernc.org/undup from the per-target sqlite_*.go files; DO NOT EDIT. //go:build (freebsd && arm) || (freebsd && arm64) || (linux && arm) || (linux && arm64) || (linux && ppc64le) || (linux && riscv64) || (linux && s390x) || (openbsd && arm64) package sqlite3 import ( "unsafe" "modernc.org/libc" ) // C documentation // // /* The DblquoteStr object holds the text of a double-quoted // ** string for a prepared statement. A linked list of these objects // ** is constructed during statement parsing and is held on Vdbe.pDblStr. // ** When computing a normalized SQL statement for an SQL statement, that // ** list is consulted for each double-quoted identifier to see if the // ** identifier should really be a string literal. // */ type TDblquoteStr = struct { FpNextStr uintptr Fz [8]uint8 } type TFpDecode = struct { Fn int32 FiDP int32 Fz uintptr FzBuf [21]uint8 Fsign uint8 FisSpecial uint8 } // C documentation // // /* // ** Extra floating-point literals to allow in JSON. // */ type TNanInfName = struct { Fc1 uint8 Fc2 uint8 Fn uint8 FeType uint8 FnRepl uint8 FzMatch uintptr FzRepl uintptr } type TPorterTokenizer = struct { Ftokenizer_v2 Tfts5_tokenizer_v2 FpTokenizer uintptr FaBuf [128]uint8 } type TReturning = struct { FpParse uintptr FpReturnEL uintptr FretTrig TTrigger FretTStep TTriggerStep FiRetCur int32 FnRetCol int32 FiRetReg int32 FzName [40]uint8 } type TWhereScan = struct { FpOrigWC uintptr FpWC uintptr FzCollName uintptr FpIdxExpr uintptr Fk int32 FopMask Tu32 Fidxaff uint8 FiEquiv uint8 FnEquiv uint8 FaiCur [11]int32 FaiColumn [11]Ti16 } // C documentation // // /* // ** Each builtin conversion character (ex: the 'd' in "%d") is described // ** by an instance of the following structure // */ type Tet_info = struct { Ffmttype uint8 Fbase TetByte Fflags TetByte Ftype1 TetByte Fcharset TetByte Fprefix TetByte FiNxt uint8 } func Xsqlite3_filename_journal(tls *libc.TLS, zFilename uintptr) (r uintptr) { if zFilename == uintptr(0) { return uintptr(0) } zFilename = _databaseName(tls, zFilename) zFilename = zFilename + uintptr(_sqlite3Strlen30(tls, zFilename)+int32(1)) for zFilename != 0 && **(**uint8)(__ccgo_up(zFilename)) != 0 { zFilename = zFilename + uintptr(_sqlite3Strlen30(tls, zFilename)+int32(1)) zFilename = zFilename + uintptr(_sqlite3Strlen30(tls, zFilename)+int32(1)) } return zFilename + uintptr(1) } func Xsqlite3_snprintf(tls *libc.TLS, n int32, zBuf uintptr, zFormat uintptr, va uintptr) (r uintptr) { bp := tls.Alloc(32) defer tls.Free(32) var ap Tva_list var _ /* acc at bp+0 */ TStrAccum _ = ap if n <= 0 { return zBuf } _sqlite3StrAccumInit(tls, bp, uintptr(0), zBuf, n, 0) ap = va Xsqlite3_str_vappendf(tls, bp, zFormat, ap) _ = ap **(**uint8)(__ccgo_up(zBuf + uintptr((**(**TStrAccum)(__ccgo_up(bp))).FnChar))) = uint8(0) return zBuf } /* Maximum size of an sqlite3_log() message. */ // C documentation // // /* Truncate the text of the string to be no more than N bytes. */ func Xsqlite3_str_truncate(tls *libc.TLS, p uintptr, N int32) { if p != uintptr(0) && N >= 0 && libc.Uint32FromInt32(N) < (*Tsqlite3_str)(unsafe.Pointer(p)).FnChar { (*Tsqlite3_str)(unsafe.Pointer(p)).FnChar = libc.Uint32FromInt32(N) **(**uint8)(__ccgo_up((*Tsqlite3_str)(unsafe.Pointer(p)).FzText + uintptr((*Tsqlite3_str)(unsafe.Pointer(p)).FnChar))) = uint8(0) } } // C documentation // // /* Return the current value for p */ func Xsqlite3_str_value(tls *libc.TLS, p uintptr) (r uintptr) { if p == uintptr(0) || (*Tsqlite3_str)(unsafe.Pointer(p)).FnChar == uint32(0) { return uintptr(0) } **(**uint8)(__ccgo_up((*Tsqlite3_str)(unsafe.Pointer(p)).FzText + uintptr((*Tsqlite3_str)(unsafe.Pointer(p)).FnChar))) = uint8(0) return (*Tsqlite3_str)(unsafe.Pointer(p)).FzText } // C documentation // // /* // ** Return a pointer to the name of Nth query parameter of the filename. // */ func Xsqlite3_uri_key(tls *libc.TLS, zFilename uintptr, N int32) (r uintptr) { var v1 int32 var v2 bool var v3 uintptr _, _, _ = v1, v2, v3 if zFilename == uintptr(0) || N < 0 { return uintptr(0) } zFilename = _databaseName(tls, zFilename) zFilename = zFilename + uintptr(_sqlite3Strlen30(tls, zFilename)+int32(1)) for { if v2 = zFilename != 0 && **(**uint8)(__ccgo_up(zFilename)) != 0; v2 { v1 = N N = N - 1 } if !(v2 && v1 > 0) { break } zFilename = zFilename + uintptr(_sqlite3Strlen30(tls, zFilename)+int32(1)) zFilename = zFilename + uintptr(_sqlite3Strlen30(tls, zFilename)+int32(1)) } if **(**uint8)(__ccgo_up(zFilename)) != 0 { v3 = zFilename } else { v3 = uintptr(0) } return v3 } // C documentation // // /* // ** CAPI3REF: Run-Time Library Version Numbers // ** KEYWORDS: sqlite3_version sqlite3_sourceid // ** // ** These interfaces provide the same information as the [SQLITE_VERSION], // ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros // ** but are associated with the library instead of the header file. ^(Cautious // ** programmers might include assert() statements in their application to // ** verify that values returned by these interfaces match the macros in // ** the header, and thus ensure that the application is // ** compiled with matching library and header files. // ** // **
//	** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
//	** assert( strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,80)==0 );
//	** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
//	** 
)^ // ** // ** ^The sqlite3_version[] string constant contains the text of the // ** [SQLITE_VERSION] macro. ^The sqlite3_libversion() function returns a // ** pointer to the sqlite3_version[] string constant. The sqlite3_libversion() // ** function is provided for use in DLLs since DLL users usually do not have // ** direct access to string constants within the DLL. ^The // ** sqlite3_libversion_number() function returns an integer equal to // ** [SQLITE_VERSION_NUMBER]. ^(The sqlite3_sourceid() function returns // ** a pointer to a string constant whose value is the same as the // ** [SQLITE_SOURCE_ID] C preprocessor macro. Except if SQLite is built // ** using an edited copy of [the amalgamation], then the last four characters // ** of the hash might be different from [SQLITE_SOURCE_ID].)^ // ** // ** See also: [sqlite_version()] and [sqlite_source_id()]. // */ var Xsqlite3_version = [7]uint8{'3', '.', '5', '3', '.', '3'} // C documentation // // /* // ** sqlite3_snprintf() works like snprintf() except that it ignores the // ** current locale settings. This is important for SQLite because we // ** are not able to use a "," as the decimal point in place of "." as // ** specified by some locales. // ** // ** Oops: The first two arguments of sqlite3_snprintf() are backwards // ** from the snprintf() standard. Unfortunately, it is too late to change // ** this without breaking compatibility, so we just have to live with the // ** mistake. // ** // ** sqlite3_vsnprintf() is the varargs version. // */ func Xsqlite3_vsnprintf(tls *libc.TLS, n int32, zBuf uintptr, zFormat uintptr, ap Tva_list) (r uintptr) { bp := tls.Alloc(32) defer tls.Free(32) var _ /* acc at bp+0 */ TStrAccum if n <= 0 { return zBuf } _sqlite3StrAccumInit(tls, bp, uintptr(0), zBuf, n, 0) Xsqlite3_str_vappendf(tls, bp, zFormat, ap) **(**uint8)(__ccgo_up(zBuf + uintptr((**(**TStrAccum)(__ccgo_up(bp))).FnChar))) = uint8(0) return zBuf } const __CHAR_UNSIGNED__ = 1 var _aDigits = [33]uint8{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'} var _aPrefix = [7]uint8{'-', 'x', '0', 0, 'X', '0'} var _aSpecial = [32]uint8{ 8: uint8('b'), 9: uint8('t'), 10: uint8('n'), 12: uint8('f'), 13: uint8('r'), } // C documentation // // /* // ** The following table defines various date transformations of the form // ** // ** 'NNN days' // ** // ** Where NNN is an arbitrary floating-point number and "days" can be one // ** of several units of time. // */ var _aXformType = [6]struct { FnName Tu8 FzName [7]uint8 FrLimit float32 FrXform float32 }{ 0: { FnName: uint8(6), FzName: [7]uint8{'s', 'e', 'c', 'o', 'n', 'd'}, FrLimit: float32(4.6427e+14), FrXform: float32(1), }, 1: { FnName: uint8(6), FzName: [7]uint8{'m', 'i', 'n', 'u', 't', 'e'}, FrLimit: float32(7.7379e+12), FrXform: float32(60), }, 2: { FnName: uint8(4), FzName: [7]uint8{'h', 'o', 'u', 'r'}, FrLimit: float32(1.2897e+11), FrXform: float32(3600), }, 3: { FnName: uint8(3), FzName: [7]uint8{'d', 'a', 'y'}, FrLimit: float32(5.373485e+06), FrXform: float32(86400), }, 4: { FnName: uint8(5), FzName: [7]uint8{'m', 'o', 'n', 't', 'h'}, FrLimit: float32(176546), FrXform: float32(2.592e+06), }, 5: { FnName: uint8(4), FzName: [7]uint8{'y', 'e', 'a', 'r'}, FrLimit: float32(14713), FrXform: float32(3.1536e+07), }, } // C documentation // // /* // ** Append all path elements in zPath to the DbPath under construction. // */ func _appendAllPathElements(tls *libc.TLS, pPath uintptr, zPath uintptr) { var i, j, v1 int32 _, _, _ = i, j, v1 i = 0 j = 0 for { for **(**uint8)(__ccgo_up(zPath + uintptr(i))) != 0 && libc.Int32FromUint8(**(**uint8)(__ccgo_up(zPath + uintptr(i)))) != int32('/') { i = i + 1 } if i > j { _appendOnePathElement(tls, pPath, zPath+uintptr(j), i-j) } j = i + int32(1) goto _2 _2: ; v1 = i i = i + 1 if !(**(**uint8)(__ccgo_up(zPath + uintptr(v1))) != 0) { break } } } func _asciiFold(tls *libc.TLS, aOut uintptr, aIn uintptr, nByte int32) { var c uint8 var i int32 _, _ = c, i i = 0 for { if !(i < nByte) { break } c = **(**uint8)(__ccgo_up(aIn + uintptr(i))) if libc.Int32FromUint8(c) >= int32('A') && libc.Int32FromUint8(c) <= int32('Z') { c = libc.Uint8FromInt32(int32(c) + libc.Int32FromInt32(32)) } **(**uint8)(__ccgo_up(aOut + uintptr(i))) = c goto _1 _1: ; i = i + 1 } } // C documentation // // /* // ** Return the P5 value that should be used for a binary comparison // ** opcode (OP_Eq, OP_Ge etc.) used to compare pExpr1 and pExpr2. // */ func _binaryCompareP5(tls *libc.TLS, pExpr1 uintptr, pExpr2 uintptr, jumpIfNull int32) (r Tu8) { var aff Tu8 _ = aff aff = _sqlite3ExprAffinity(tls, pExpr2) aff = libc.Uint8FromInt32(libc.Int32FromUint8(_sqlite3CompareAffinity(tls, pExpr1, aff)) | libc.Int32FromUint8(libc.Uint8FromInt32(jumpIfNull))) return aff } // C documentation // // /* // ** Clear the YMD and HMS and the TZ // */ func _clearYMD_HMS_TZ(tls *libc.TLS, p uintptr) { (*TDateTime)(unsafe.Pointer(p)).FvalidYMD = uint8(0) (*TDateTime)(unsafe.Pointer(p)).FvalidHMS = uint8(0) (*TDateTime)(unsafe.Pointer(p)).Ftz = 0 } /* ** On recent Windows platforms, the localtime_s() function is available ** as part of the "Secure CRT". It is essentially equivalent to ** localtime_r() available under most POSIX platforms, except that the ** order of the parameters is reversed. ** ** See http://msdn.microsoft.com/en-us/library/a442x3ye(VS.80).aspx. ** ** If the user has not indicated to use localtime_r() or localtime_s() ** already, check for an MSVC build environment that provides ** localtime_s(). */ // C documentation // // /* // ** Code an OP_Affinity opcode to apply the column affinity string zAff // ** to the n registers starting at base. // ** // ** As an optimization, SQLITE_AFF_BLOB and SQLITE_AFF_NONE entries (which // ** are no-ops) at the beginning and end of zAff are ignored. If all entries // ** in zAff are SQLITE_AFF_BLOB or SQLITE_AFF_NONE, then no code gets generated. // ** // ** This routine makes its own copy of zAff so that the caller is free // ** to modify zAff after this routine returns. // */ func _codeApplyAffinity(tls *libc.TLS, pParse uintptr, base int32, n int32, zAff uintptr) { var v uintptr _ = v v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe if zAff == uintptr(0) { return } /* Adjust base and n to skip over SQLITE_AFF_BLOB and SQLITE_AFF_NONE ** entries at the beginning and end of the affinity string. */ for n > 0 && libc.Int32FromUint8(**(**uint8)(__ccgo_up(zAff))) <= int32(SQLITE_AFF_BLOB) { n = n - 1 base = base + 1 zAff = zAff + 1 } for n > int32(1) && libc.Int32FromUint8(**(**uint8)(__ccgo_up(zAff + uintptr(n-int32(1))))) <= int32(SQLITE_AFF_BLOB) { n = n - 1 } /* Code the OP_Affinity opcode if there is anything left to do. */ if n > 0 { _sqlite3VdbeAddOp4(tls, v, int32(OP_Affinity), base, n, 0, zAff, n) } } // C documentation // // /* // ** Given the YYYY-MM-DD information current in p, determine if there // ** is day-of-month overflow and set nFloor to the number of days that // ** would need to be subtracted from the date in order to bring the // ** date back to the end of the month. // */ func _computeFloor(tls *libc.TLS, p uintptr) { if (*TDateTime)(unsafe.Pointer(p)).FD <= int32(28) { (*TDateTime)(unsafe.Pointer(p)).FnFloor = uint8(0) } else { if int32(1)<<(*TDateTime)(unsafe.Pointer(p)).FM&int32(0x15aa) != 0 { (*TDateTime)(unsafe.Pointer(p)).FnFloor = uint8(0) } else { if (*TDateTime)(unsafe.Pointer(p)).FM != int32(2) { (*TDateTime)(unsafe.Pointer(p)).FnFloor = libc.BoolUint8((*TDateTime)(unsafe.Pointer(p)).FD == libc.Int32FromInt32(31)) } else { if (*TDateTime)(unsafe.Pointer(p)).FY%int32(4) != 0 || (*TDateTime)(unsafe.Pointer(p)).FY%int32(100) == 0 && (*TDateTime)(unsafe.Pointer(p)).FY%int32(400) != 0 { (*TDateTime)(unsafe.Pointer(p)).FnFloor = libc.Uint8FromInt32((*TDateTime)(unsafe.Pointer(p)).FD - int32(28)) } else { (*TDateTime)(unsafe.Pointer(p)).FnFloor = libc.Uint8FromInt32((*TDateTime)(unsafe.Pointer(p)).FD - int32(29)) } } } } } // C documentation // // /* // ** Compute the Hour, Minute, and Seconds from the julian day number. // */ func _computeHMS(tls *libc.TLS, p uintptr) { var day_min, day_ms int32 _, _ = day_min, day_ms /* milliseconds, minutes into the day */ if (*TDateTime)(unsafe.Pointer(p)).FvalidHMS != 0 { return } _computeJD(tls, p) day_ms = int32(((*TDateTime)(unsafe.Pointer(p)).FiJD + libc.Int64FromInt32(43200000)) % libc.Int64FromInt32(86400000)) (*TDateTime)(unsafe.Pointer(p)).Fs = float64(day_ms%libc.Int32FromInt32(60000)) / float64(1000) day_min = day_ms / int32(60000) (*TDateTime)(unsafe.Pointer(p)).Fm = day_min % int32(60) (*TDateTime)(unsafe.Pointer(p)).Fh = day_min / int32(60) libc.SetBitFieldPtr8Uint32(p+44, libc.Uint32FromInt32(0), 0, 0x1) (*TDateTime)(unsafe.Pointer(p)).FvalidHMS = uint8(1) } var _cume_distName = [10]uint8{'c', 'u', 'm', 'e', '_', 'd', 'i', 's', 't'} // C documentation // // /* // ** The Pager stores the Database filename, Journal filename, and WAL filename // ** consecutively in memory, in that order. The database filename is prefixed // ** by four zero bytes. Locate the start of the database filename by searching // ** backwards for the first byte following four consecutive zero bytes. // ** // ** This only works if the filename passed in was obtained from the Pager. // */ func _databaseName(tls *libc.TLS, zName uintptr) (r uintptr) { for libc.Int32FromUint8(**(**uint8)(__ccgo_up(zName + uintptr(-libc.Int32FromInt32(1))))) != 0 || libc.Int32FromUint8(**(**uint8)(__ccgo_up(zName + uintptr(-libc.Int32FromInt32(2))))) != 0 || libc.Int32FromUint8(**(**uint8)(__ccgo_up(zName + uintptr(-libc.Int32FromInt32(3))))) != 0 || libc.Int32FromUint8(**(**uint8)(__ccgo_up(zName + uintptr(-libc.Int32FromInt32(4))))) != 0 { zName = zName - 1 } return zName } // C documentation // // /* // ** date( TIMESTRING, MOD, MOD, ...) // ** // ** Return YYYY-MM-DD // */ func _dateFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { bp := tls.Alloc(64) defer tls.Free(64) var Y int32 var _ /* x at bp+0 */ TDateTime var _ /* zBuf at bp+48 */ [16]uint8 _ = Y if _isDate(tls, context, argc, argv, bp) == 0 { _computeYMD(tls, bp) Y = (**(**TDateTime)(__ccgo_up(bp))).FY if Y < 0 { Y = -Y } (**(**[16]uint8)(__ccgo_up(bp + 48)))[int32(1)] = libc.Uint8FromInt32(int32('0') + Y/int32(1000)%int32(10)) (**(**[16]uint8)(__ccgo_up(bp + 48)))[int32(2)] = libc.Uint8FromInt32(int32('0') + Y/int32(100)%int32(10)) (**(**[16]uint8)(__ccgo_up(bp + 48)))[int32(3)] = libc.Uint8FromInt32(int32('0') + Y/int32(10)%int32(10)) (**(**[16]uint8)(__ccgo_up(bp + 48)))[int32(4)] = libc.Uint8FromInt32(int32('0') + Y%int32(10)) (**(**[16]uint8)(__ccgo_up(bp + 48)))[int32(5)] = uint8('-') (**(**[16]uint8)(__ccgo_up(bp + 48)))[int32(6)] = libc.Uint8FromInt32(int32('0') + (**(**TDateTime)(__ccgo_up(bp))).FM/int32(10)%int32(10)) (**(**[16]uint8)(__ccgo_up(bp + 48)))[int32(7)] = libc.Uint8FromInt32(int32('0') + (**(**TDateTime)(__ccgo_up(bp))).FM%int32(10)) (**(**[16]uint8)(__ccgo_up(bp + 48)))[int32(8)] = uint8('-') (**(**[16]uint8)(__ccgo_up(bp + 48)))[int32(9)] = libc.Uint8FromInt32(int32('0') + (**(**TDateTime)(__ccgo_up(bp))).FD/int32(10)%int32(10)) (**(**[16]uint8)(__ccgo_up(bp + 48)))[int32(10)] = libc.Uint8FromInt32(int32('0') + (**(**TDateTime)(__ccgo_up(bp))).FD%int32(10)) (**(**[16]uint8)(__ccgo_up(bp + 48)))[int32(11)] = uint8(0) if (**(**TDateTime)(__ccgo_up(bp))).FY < 0 { (**(**[16]uint8)(__ccgo_up(bp + 48)))[0] = uint8('-') Xsqlite3_result_text(tls, context, bp+48, int32(11), uintptr(-libc.Int32FromInt32(1))) } else { Xsqlite3_result_text(tls, context, bp+48+1, int32(10), uintptr(-libc.Int32FromInt32(1))) } } } // C documentation // // /* // ** Compute the number of days after the most recent January 1. // ** // ** In other words, compute the zero-based day number for the // ** current year: // ** // ** Jan01 = 0, Jan02 = 1, ..., Jan31 = 30, Feb01 = 31, ... // ** Dec31 = 364 or 365. // */ func _daysAfterJan01(tls *libc.TLS, pDate uintptr) (r int32) { bp := tls.Alloc(48) defer tls.Free(48) var _ /* jan01 at bp+0 */ TDateTime **(**TDateTime)(__ccgo_up(bp)) = **(**TDateTime)(__ccgo_up(pDate)) (**(**TDateTime)(__ccgo_up(bp))).FvalidJD = uint8(0) (**(**TDateTime)(__ccgo_up(bp))).FM = int32(1) (**(**TDateTime)(__ccgo_up(bp))).FD = int32(1) _computeJD(tls, bp) return int32(((*TDateTime)(unsafe.Pointer(pDate)).FiJD - (**(**TDateTime)(__ccgo_up(bp))).FiJD + libc.Int64FromInt32(43200000)) / libc.Int64FromInt32(86400000)) } var _dense_rankName = [11]uint8{'d', 'e', 'n', 's', 'e', '_', 'r', 'a', 'n', 'k'} // C documentation // // /* // ** zSql is a zero-terminated string of UTF-8 SQL text. Return the number of // ** bytes in this text up to but excluding the first character in // ** a host parameter. If the text contains no host parameters, return // ** the total number of bytes in the text. // */ func _findNextHostParameter(tls *libc.TLS, zSql uintptr, pnToken uintptr) (r Ti64) { bp := tls.Alloc(16) defer tls.Free(16) var n, nTotal Ti64 var _ /* tokenType at bp+0 */ int32 _, _ = n, nTotal nTotal = 0 **(**Ti64)(__ccgo_up(pnToken)) = 0 for **(**uint8)(__ccgo_up(zSql)) != 0 { n = _sqlite3GetToken(tls, zSql, bp) if **(**int32)(__ccgo_up(bp)) == int32(TK_VARIABLE) { **(**Ti64)(__ccgo_up(pnToken)) = n break } nTotal = nTotal + n zSql = zSql + uintptr(n) } return nTotal } var _first_valueName = [12]uint8{'f', 'i', 'r', 's', 't', '_', 'v', 'a', 'l', 'u', 'e'} var _fmtinfo = [23]Tet_info{ 0: { Ffmttype: uint8('s'), Fflags: uint8(4), Ftype1: uint8(etSTRING), FiNxt: uint8(1), }, 1: { Ffmttype: uint8('E'), Fflags: uint8(1), Ftype1: uint8(etEXP), Fcharset: uint8(14), }, 2: { Ffmttype: uint8('u'), Fbase: uint8(10), Ftype1: uint8(etDECIMAL), FiNxt: uint8(3), }, 3: { Ffmttype: uint8('G'), Fflags: uint8(1), Ftype1: uint8(etGENERIC), Fcharset: uint8(14), }, 4: { Ffmttype: uint8('w'), Fflags: uint8(4), Ftype1: uint8(etESCAPE_w), }, 5: { Ffmttype: uint8('x'), Fbase: uint8(16), Fcharset: uint8(16), Fprefix: uint8(1), }, 6: { Ffmttype: uint8('c'), Ftype1: uint8(etCHARX), }, 7: { Ffmttype: uint8('z'), Fflags: uint8(4), Ftype1: uint8(etDYNSTRING), FiNxt: uint8(6), }, 8: { Ffmttype: uint8('d'), Fbase: uint8(10), Fflags: uint8(1), Ftype1: uint8(etDECIMAL), }, 9: { Ffmttype: uint8('e'), Fflags: uint8(1), Ftype1: uint8(etEXP), Fcharset: uint8(30), }, 10: { Ffmttype: uint8('f'), Fflags: uint8(1), Ftype1: uint8(etFLOAT), }, 11: { Ffmttype: uint8('g'), Fflags: uint8(1), Ftype1: uint8(etGENERIC), Fcharset: uint8(30), }, 12: { Ffmttype: uint8('Q'), Fflags: uint8(4), Ftype1: uint8(etESCAPE_Q), }, 13: { Ffmttype: uint8('i'), Fbase: uint8(10), Fflags: uint8(1), Ftype1: uint8(etDECIMAL), }, 14: { Ffmttype: uint8('%'), Ftype1: uint8(etPERCENT), FiNxt: uint8(16), }, 15: { Ffmttype: uint8('T'), Ftype1: uint8(etTOKEN), }, 16: { Ffmttype: uint8('S'), Ftype1: uint8(etSRCITEM), }, 17: { Ffmttype: uint8('X'), Fbase: uint8(16), Fprefix: uint8(4), }, 18: { Ffmttype: uint8('n'), Ftype1: uint8(etSIZE), }, 19: { Ffmttype: uint8('o'), Fbase: uint8(8), Fprefix: uint8(2), FiNxt: uint8(17), }, 20: { Ffmttype: uint8('p'), Fbase: uint8(16), Ftype1: uint8(etPOINTER), Fprefix: uint8(1), }, 21: { Ffmttype: uint8('q'), Fflags: uint8(4), Ftype1: uint8(etESCAPE_q), }, 22: { Ffmttype: uint8('r'), Fbase: uint8(10), Fflags: uint8(1), Ftype1: uint8(etORDINAL), }, } /* Additional Notes: ** ** %S Takes a pointer to SrcItem. Shows name or database.name ** %!S Like %S but prefer the zName over the zAlias */ func _fts5AsciiAddExceptions(tls *libc.TLS, p uintptr, zArg uintptr, bTokenChars int32) { var i int32 _ = i i = 0 for { if !(**(**uint8)(__ccgo_up(zArg + uintptr(i))) != 0) { break } if libc.Int32FromUint8(**(**uint8)(__ccgo_up(zArg + uintptr(i))))&int32(0x80) == 0 { **(**uint8)(__ccgo_up(p + uintptr(libc.Int32FromUint8(**(**uint8)(__ccgo_up(zArg + uintptr(i))))))) = libc.Uint8FromInt32(bTokenChars) } goto _1 _1: ; i = i + 1 } } // C documentation // // /* // ** Tokenize some text using the ascii tokenizer. // */ func _fts5AsciiTokenize(tls *libc.TLS, pTokenizer uintptr, pCtx uintptr, iUnused int32, pText uintptr, nText int32, __ccgo_fp_xToken uintptr) (r int32) { bp := tls.Alloc(64) defer tls.Free(64) var a, p, pFold uintptr var ie, is, nByte, nFold, rc int32 var _ /* aFold at bp+0 */ [64]uint8 _, _, _, _, _, _, _, _ = a, ie, is, nByte, nFold, p, pFold, rc p = pTokenizer rc = SQLITE_OK is = 0 nFold = int32(64) pFold = bp a = p _ = iUnused for is < nText && rc == SQLITE_OK { /* Skip any leading divider characters. */ for is < nText && (libc.Int32FromUint8(**(**uint8)(__ccgo_up(pText + uintptr(is))))&int32(0x80) == 0 && libc.Int32FromUint8(**(**uint8)(__ccgo_up(a + uintptr(libc.Int32FromUint8(**(**uint8)(__ccgo_up(pText + uintptr(is)))))))) == 0) { is = is + 1 } if is == nText { break } /* Count the token characters */ ie = is + int32(1) for ie < nText && (libc.Int32FromUint8(**(**uint8)(__ccgo_up(pText + uintptr(ie))))&int32(0x80) != 0 || **(**uint8)(__ccgo_up(a + uintptr(libc.Int32FromUint8(**(**uint8)(__ccgo_up(pText + uintptr(ie))))))) != 0) { ie = ie + 1 } /* Fold to lower case */ nByte = ie - is if nByte > nFold { if pFold != bp { Xsqlite3_free(tls, pFold) } pFold = Xsqlite3_malloc64(tls, libc.Uint64FromInt64(int64(nByte)*int64(2))) if pFold == uintptr(0) { rc = int32(SQLITE_NOMEM) break } nFold = nByte * int32(2) } _asciiFold(tls, pFold, pText+uintptr(is), nByte) /* Invoke the token callback */ rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&struct{ uintptr }{__ccgo_fp_xToken})))(tls, pCtx, 0, pFold, nByte, is, ie) is = ie + int32(1) } if pFold != bp { Xsqlite3_free(tls, pFold) } if rc == int32(SQLITE_DONE) { rc = SQLITE_OK } return rc } /************************************************************************** ** Start of unicode61 tokenizer implementation. */ /* ** The following two macros - READ_UTF8 and WRITE_UTF8 - have been copied ** from the sqlite3 source file utf.c. If this file is compiled as part ** of the amalgamation, they are not required. */ // C documentation // // /* // ** Argument pIn points to the first character in what is expected to be // ** a comma-separated list of SQL literals followed by a ')' character. // ** If it actually is this, return a pointer to the ')'. Otherwise, return // ** NULL to indicate a parse error. // */ func _fts5ConfigSkipArgs(tls *libc.TLS, pIn uintptr) (r uintptr) { var p uintptr _ = p p = pIn for int32(1) != 0 { p = _fts5ConfigSkipWhitespace(tls, p) p = _fts5ConfigSkipLiteral(tls, p) p = _fts5ConfigSkipWhitespace(tls, p) if p == uintptr(0) || libc.Int32FromUint8(**(**uint8)(__ccgo_up(p))) == int32(')') { break } if libc.Int32FromUint8(**(**uint8)(__ccgo_up(p))) != int32(',') { p = uintptr(0) break } p = p + 1 } return p } // C documentation // // /* // ** Argument pIn points to a character that is part of a nul-terminated // ** string. Return a pointer to the first character following *pIn in // ** the string that is not a "bareword" character. // */ func _fts5ConfigSkipBareword(tls *libc.TLS, pIn uintptr) (r uintptr) { var p uintptr _ = p p = pIn for _sqlite3Fts5IsBareword(tls, **(**uint8)(__ccgo_up(p))) != 0 { p = p + 1 } if p == pIn { p = uintptr(0) } return p } // C documentation // // /* // ** Argument pIn points to a character that is part of a nul-terminated // ** string. Return a pointer to the first character following *pIn in // ** the string that is not a white-space character. // */ func _fts5ConfigSkipWhitespace(tls *libc.TLS, pIn uintptr) (r uintptr) { var p uintptr _ = p p = pIn if p != 0 { for _fts5_iswhitespace(tls, **(**uint8)(__ccgo_up(p))) != 0 { p = p + 1 } } return p } // C documentation // // /* // ** The first character of the string pointed to by argument z is guaranteed // ** to be an open-quote character (see function fts5_isopenquote()). // ** // ** This function searches for the corresponding close-quote character within // ** the string and, if found, dequotes the string in place and adds a new // ** nul-terminator byte. // ** // ** If the close-quote is found, the value returned is the byte offset of // ** the character immediately following it. Or, if the close-quote is not // ** found, -1 is returned. If -1 is returned, the buffer is left in an // ** undefined state. // */ func _fts5Dequote(tls *libc.TLS, z uintptr) (r int32) { var iIn, iOut, v1, v2 int32 var q uint8 _, _, _, _, _ = iIn, iOut, q, v1, v2 iIn = int32(1) iOut = 0 q = **(**uint8)(__ccgo_up(z)) /* Set stack variable q to the close-quote character */ if libc.Int32FromUint8(q) == int32('[') { q = uint8(']') } for **(**uint8)(__ccgo_up(z + uintptr(iIn))) != 0 { if libc.Int32FromUint8(**(**uint8)(__ccgo_up(z + uintptr(iIn)))) == libc.Int32FromUint8(q) { if libc.Int32FromUint8(**(**uint8)(__ccgo_up(z + uintptr(iIn+int32(1))))) != libc.Int32FromUint8(q) { /* Character iIn was the close quote. */ iIn = iIn + 1 break } else { /* Character iIn and iIn+1 form an escaped quote character. Skip ** the input cursor past both and copy a single quote character ** to the output buffer. */ iIn = iIn + int32(2) v1 = iOut iOut = iOut + 1 **(**uint8)(__ccgo_up(z + uintptr(v1))) = q } } else { v1 = iOut iOut = iOut + 1 v2 = iIn iIn = iIn + 1 **(**uint8)(__ccgo_up(z + uintptr(v1))) = **(**uint8)(__ccgo_up(z + uintptr(v2))) } } **(**uint8)(__ccgo_up(z + uintptr(iOut))) = uint8('\000') return iIn } // C documentation // // /* // ** Assuming that buffer z is at least nByte bytes in size and contains a // ** valid utf-8 string, return the number of characters in the string. // */ func _fts5ExprCountChar(tls *libc.TLS, z uintptr, nByte int32) (r int32) { var ii, nRet int32 _, _ = ii, nRet nRet = 0 ii = 0 for { if !(ii < nByte) { break } if libc.Int32FromUint8(**(**uint8)(__ccgo_up(z + uintptr(ii))))&int32(0xC0) != int32(0x80) { nRet = nRet + 1 } goto _1 _1: ; ii = ii + 1 } return nRet } func _fts5ExprIsspace(tls *libc.TLS, t uint8) (r int32) { return libc.BoolInt32(libc.Int32FromUint8(t) == int32(' ') || libc.Int32FromUint8(t) == int32('\t') || libc.Int32FromUint8(t) == int32('\n') || libc.Int32FromUint8(t) == int32('\r')) } // C documentation // // /* // ** pIn is a UTF-8 encoded string, nIn bytes in size. Return the number of // ** unicode characters in the string. // */ func _fts5IndexCharlen(tls *libc.TLS, pIn uintptr, nIn int32) (r int32) { var i, nChar, v1 int32 _, _, _ = i, nChar, v1 nChar = 0 i = 0 for i < nIn { v1 = i i = i + 1 if libc.Int32FromUint8(uint8(**(**uint8)(__ccgo_up(pIn + uintptr(v1))))) >= int32(0xc0) { for i < nIn && libc.Int32FromUint8(**(**uint8)(__ccgo_up(pIn + uintptr(i))))&int32(0xc0) == int32(0x80) { i = i + 1 } } nChar = nChar + 1 } return nChar } func _fts5PorterGobbleVC(tls *libc.TLS, zStem uintptr, nStem int32, bPrevCons int32) (r int32) { var bCons, i, v2 int32 _, _, _ = bCons, i, v2 bCons = bPrevCons /* Scan for a vowel */ i = 0 for { if !(i < nStem) { break } v2 = libc.BoolInt32(!(_fts5PorterIsVowel(tls, **(**uint8)(__ccgo_up(zStem + uintptr(i))), bCons) != 0)) bCons = v2 if 0 == v2 { break } goto _1 _1: ; i = i + 1 } /* Scan for a consonent */ i = i + 1 for { if !(i < nStem) { break } v2 = libc.BoolInt32(!(_fts5PorterIsVowel(tls, **(**uint8)(__ccgo_up(zStem + uintptr(i))), bCons) != 0)) bCons = v2 if v2 != 0 { return i + int32(1) } goto _3 _3: ; i = i + 1 } return 0 } func _fts5PorterIsVowel(tls *libc.TLS, c uint8, bYIsVowel int32) (r int32) { return libc.BoolInt32(libc.Int32FromUint8(c) == int32('a') || libc.Int32FromUint8(c) == int32('e') || libc.Int32FromUint8(c) == int32('i') || libc.Int32FromUint8(c) == int32('o') || libc.Int32FromUint8(c) == int32('u') || bYIsVowel != 0 && libc.Int32FromUint8(c) == int32('y')) } func _fts5PorterStep1A(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) { var nBuf int32 _ = nBuf nBuf = **(**int32)(__ccgo_up(pnBuf)) if libc.Int32FromUint8(**(**uint8)(__ccgo_up(aBuf + uintptr(nBuf-int32(1))))) == int32('s') { if libc.Int32FromUint8(**(**uint8)(__ccgo_up(aBuf + uintptr(nBuf-int32(2))))) == int32('e') { if nBuf > int32(4) && libc.Int32FromUint8(**(**uint8)(__ccgo_up(aBuf + uintptr(nBuf-int32(4))))) == int32('s') && libc.Int32FromUint8(**(**uint8)(__ccgo_up(aBuf + uintptr(nBuf-int32(3))))) == int32('s') || nBuf > int32(3) && libc.Int32FromUint8(**(**uint8)(__ccgo_up(aBuf + uintptr(nBuf-int32(3))))) == int32('i') { **(**int32)(__ccgo_up(pnBuf)) = nBuf - int32(2) } else { **(**int32)(__ccgo_up(pnBuf)) = nBuf - int32(1) } } else { if libc.Int32FromUint8(**(**uint8)(__ccgo_up(aBuf + uintptr(nBuf-int32(2))))) != int32('s') { **(**int32)(__ccgo_up(pnBuf)) = nBuf - int32(1) } } } } // C documentation // // /* porter rule condition: (m > 1 and (*S or *T)) */ func _fts5Porter_MGt1_and_S_or_T(tls *libc.TLS, zStem uintptr, nStem int32) (r int32) { return libc.BoolInt32((libc.Int32FromUint8(**(**uint8)(__ccgo_up(zStem + uintptr(nStem-int32(1))))) == int32('s') || libc.Int32FromUint8(**(**uint8)(__ccgo_up(zStem + uintptr(nStem-int32(1))))) == int32('t')) && _fts5Porter_MGt1(tls, zStem, nStem) != 0) } // C documentation // // /* porter rule condition: (*o) */ func _fts5Porter_Ostar(tls *libc.TLS, zStem uintptr, nStem int32) (r int32) { var bCons, i, mask int32 _, _, _ = bCons, i, mask if libc.Int32FromUint8(**(**uint8)(__ccgo_up(zStem + uintptr(nStem-int32(1))))) == int32('w') || libc.Int32FromUint8(**(**uint8)(__ccgo_up(zStem + uintptr(nStem-int32(1))))) == int32('x') || libc.Int32FromUint8(**(**uint8)(__ccgo_up(zStem + uintptr(nStem-int32(1))))) == int32('y') { return 0 } else { mask = 0 bCons = 0 i = 0 for { if !(i < nStem) { break } bCons = libc.BoolInt32(!(_fts5PorterIsVowel(tls, **(**uint8)(__ccgo_up(zStem + uintptr(i))), bCons) != 0)) mask = mask< 0)) != 0 { return int32(1) } goto _1 _1: ; i = i + 1 } return 0 } /************************************************************************** *************************************************************************** ** GENERATED CODE STARTS HERE (mkportersteps.tcl) */ // C documentation // // /* // ** pToken is a buffer nToken bytes in size that may or may not contain // ** an embedded 0x00 byte. If it does, return the number of bytes in // ** the buffer before the 0x00. If it does not, return nToken. // */ func _fts5QueryTerm(tls *libc.TLS, pToken uintptr, nToken int32) (r int32) { var ii int32 _ = ii ii = 0 for { if !(ii < nToken && **(**uint8)(__ccgo_up(pToken + uintptr(ii))) != 0) { break } goto _1 _1: ; ii = ii + 1 } return ii } // C documentation // // /* // ** This function is an xTokenize() callback used by the auxiliary snippet() // ** function. Its job is to identify tokens that are the first in a sentence. // ** For each such token, an entry is added to the SFinder.aFirst[] array. // */ func _fts5SentenceFinderCb(tls *libc.TLS, pContext uintptr, tflags int32, pToken uintptr, nToken int32, iStartOff int32, iEndOff int32) (r int32) { var c uint8 var i, rc int32 var p uintptr _, _, _, _ = c, i, p, rc rc = SQLITE_OK _ = pToken _ = nToken _ = iEndOff if tflags&int32(FTS5_TOKEN_COLOCATED) == 0 { p = pContext if (*TFts5SFinder)(unsafe.Pointer(p)).FiPos > 0 { c = uint8(0) i = iStartOff - int32(1) for { if !(i >= 0) { break } c = **(**uint8)(__ccgo_up((*TFts5SFinder)(unsafe.Pointer(p)).FzDoc + uintptr(i))) if libc.Int32FromUint8(c) != int32(' ') && libc.Int32FromUint8(c) != int32('\t') && libc.Int32FromUint8(c) != int32('\n') && libc.Int32FromUint8(c) != int32('\r') { break } goto _1 _1: ; i = i - 1 } if i != iStartOff-int32(1) && (libc.Int32FromUint8(c) == int32('.') || libc.Int32FromUint8(c) == int32(':')) { rc = _fts5SentenceFinderAdd(tls, p, (*TFts5SFinder)(unsafe.Pointer(p)).FiPos) } } else { rc = _fts5SentenceFinderAdd(tls, p, 0) } (*TFts5SFinder)(unsafe.Pointer(p)).FiPos = (*TFts5SFinder)(unsafe.Pointer(p)).FiPos + 1 } return rc } func _fts5_isdigit(tls *libc.TLS, a uint8) (r int32) { return libc.BoolInt32(libc.Int32FromUint8(a) >= int32('0') && libc.Int32FromUint8(a) <= int32('9')) } func _fts5_isopenquote(tls *libc.TLS, x uint8) (r int32) { return libc.BoolInt32(libc.Int32FromUint8(x) == int32('"') || libc.Int32FromUint8(x) == int32('\'') || libc.Int32FromUint8(x) == int32('[') || libc.Int32FromUint8(x) == int32('`')) } func _fts5_iswhitespace(tls *libc.TLS, x uint8) (r int32) { return libc.BoolInt32(libc.Int32FromUint8(x) == int32(' ')) } // C documentation // // /* // ** Growing our own isspace() routine this way is twice as fast as // ** the library isspace() function. // */ var _geopolyIsSpace = [256]uint8{ 9: uint8(1), 10: uint8(1), 13: uint8(1), 32: uint8(1), } /* Compiler and version */ // C documentation // // /* Parse out a number. Write the value into *pVal if pVal!=0. // ** return non-zero on success and zero if the next token is not a number. // */ func _geopolyParseNumber(tls *libc.TLS, p uintptr, pVal uintptr) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var c uint8 var j, seenDP, seenE, v2 int32 var z uintptr var _ /* r at bp+0 */ float64 _, _, _, _, _, _ = c, j, seenDP, seenE, z, v2 c = _geopolySkipSpace(tls, p) z = (*TGeoParse)(unsafe.Pointer(p)).Fz j = 0 seenDP = 0 seenE = 0 if libc.Int32FromUint8(c) == int32('-') { j = int32(1) c = uint8(**(**uint8)(__ccgo_up(z + uintptr(j)))) } if libc.Int32FromUint8(c) == int32('0') && libc.Int32FromUint8(**(**uint8)(__ccgo_up(z + uintptr(j+int32(1))))) >= int32('0') && libc.Int32FromUint8(**(**uint8)(__ccgo_up(z + uintptr(j+int32(1))))) <= int32('9') { return 0 } for { c = uint8(**(**uint8)(__ccgo_up(z + uintptr(j)))) if libc.Int32FromUint8(_sqlite3CtypeMap[c])&int32(0x04) != 0 { goto _1 } if libc.Int32FromUint8(c) == int32('.') { if libc.Int32FromUint8(**(**uint8)(__ccgo_up(z + uintptr(j-int32(1))))) == int32('-') { return 0 } if seenDP != 0 { return 0 } seenDP = int32(1) goto _1 } if libc.Int32FromUint8(c) == int32('e') || libc.Int32FromUint8(c) == int32('E') { if libc.Int32FromUint8(**(**uint8)(__ccgo_up(z + uintptr(j-int32(1))))) < int32('0') { return 0 } if seenE != 0 { return -int32(1) } v2 = libc.Int32FromInt32(1) seenE = v2 seenDP = v2 c = uint8(**(**uint8)(__ccgo_up(z + uintptr(j+int32(1))))) if libc.Int32FromUint8(c) == int32('+') || libc.Int32FromUint8(c) == int32('-') { j = j + 1 c = uint8(**(**uint8)(__ccgo_up(z + uintptr(j+int32(1))))) } if libc.Int32FromUint8(c) < int32('0') || libc.Int32FromUint8(c) > int32('9') { return 0 } goto _1 } break goto _1 _1: ; j = j + 1 } if libc.Int32FromUint8(**(**uint8)(__ccgo_up(z + uintptr(j-int32(1))))) < int32('0') { return 0 } if pVal != 0 { _sqlite3AtoF(tls, (*TGeoParse)(unsafe.Pointer(p)).Fz, bp) **(**TGeoCoord)(__ccgo_up(pVal)) = float32(**(**float64)(__ccgo_up(bp))) } **(**uintptr)(__ccgo_up(p)) += uintptr(j) return int32(1) } // C documentation // // /* Skip whitespace. Return the next non-whitespace character. */ func _geopolySkipSpace(tls *libc.TLS, p uintptr) (r uint8) { for _geopolyIsSpace[**(**uint8)(__ccgo_up((*TGeoParse)(unsafe.Pointer(p)).Fz))] != 0 { (*TGeoParse)(unsafe.Pointer(p)).Fz = (*TGeoParse)(unsafe.Pointer(p)).Fz + 1 } return uint8(**(**uint8)(__ccgo_up((*TGeoParse)(unsafe.Pointer(p)).Fz))) } // C documentation // // /* // ** Convert zDate into one or more integers according to the conversion // ** specifier zFormat. // ** // ** zFormat[] contains 4 characters for each integer converted, except for // ** the last integer which is specified by three characters. The meaning // ** of a four-character format specifiers ABCD is: // ** // ** A: number of digits to convert. Always "2" or "4". // ** B: minimum value. Always "0" or "1". // ** C: maximum value, decoded as: // ** a: 12 // ** b: 14 // ** c: 24 // ** d: 31 // ** e: 59 // ** f: 9999 // ** D: the separator character, or \000 to indicate this is the // ** last number to convert. // ** // ** Example: To translate an ISO-8601 date YYYY-MM-DD, the format would // ** be "40f-21a-20c". The "40f-" indicates the 4-digit year followed by "-". // ** The "21a-" indicates the 2-digit month followed by "-". The "20c" indicates // ** the 2-digit day which is the last integer in the set. // ** // ** The function returns the number of successful conversions. // */ func _getDigits(tls *libc.TLS, zDate uintptr, zFormat uintptr, va uintptr) (r int32) { var N, min, nextC, v1 uint8 var ap Tva_list var cnt, val int32 var max Tu16 _, _, _, _, _, _, _, _ = N, ap, cnt, max, min, nextC, val, v1 cnt = 0 ap = va for cond := true; cond; cond = nextC != 0 { N = libc.Uint8FromInt32(libc.Int32FromUint8(**(**uint8)(__ccgo_up(zFormat))) - int32('0')) min = libc.Uint8FromInt32(libc.Int32FromUint8(**(**uint8)(__ccgo_up(zFormat + 1))) - int32('0')) val = 0 max = _aMx[libc.Int32FromUint8(**(**uint8)(__ccgo_up(zFormat + 2)))-int32('a')] nextC = **(**uint8)(__ccgo_up(zFormat + 3)) val = 0 for { v1 = N N = N - 1 if !(v1 != 0) { break } if !(libc.Int32FromUint8(_sqlite3CtypeMap[uint8(**(**uint8)(__ccgo_up(zDate)))])&libc.Int32FromInt32(0x04) != 0) { goto end_getDigits } val = val*int32(10) + libc.Int32FromUint8(**(**uint8)(__ccgo_up(zDate))) - int32('0') zDate = zDate + 1 } if val < libc.Int32FromUint8(min) || val > libc.Int32FromUint16(max) || libc.Int32FromUint8(nextC) != 0 && libc.Int32FromUint8(nextC) != libc.Int32FromUint8(**(**uint8)(__ccgo_up(zDate))) { goto end_getDigits } **(**int32)(__ccgo_up(libc.VaUintptr(&ap))) = val zDate = zDate + 1 cnt = cnt + 1 zFormat = zFormat + uintptr(4) } goto end_getDigits end_getDigits: ; _ = ap return cnt } // C documentation // // /* Array for converting from half-bytes (nybbles) into ASCII hex // ** digits. */ var _hexdigits = [16]uint8{ 0: uint8('0'), 1: uint8('1'), 2: uint8('2'), 3: uint8('3'), 4: uint8('4'), 5: uint8('5'), 6: uint8('6'), 7: uint8('7'), 8: uint8('8'), 9: uint8('9'), 10: uint8('A'), 11: uint8('B'), 12: uint8('C'), 13: uint8('D'), 14: uint8('E'), 15: uint8('F'), } // C documentation // // /* // ** Measure the number of characters needed to output the given // ** identifier. The number returned includes any quotes used // ** but does not include the null terminator. // ** // ** The estimate is conservative. It might be larger that what is // ** really needed. // */ func _identLength(tls *libc.TLS, z uintptr) (r Ti64) { var n Ti64 _ = n n = 0 for { if !(**(**uint8)(__ccgo_up(z)) != 0) { break } if libc.Int32FromUint8(**(**uint8)(__ccgo_up(z))) == int32('"') { n = n + 1 } goto _1 _1: ; n = n + 1 z = z + 1 } return n + int64(2) } // C documentation // // /* // ** The first parameter is a pointer to an output buffer. The second // ** parameter is a pointer to an integer that contains the offset at // ** which to write into the output buffer. This function copies the // ** nul-terminated string pointed to by the third parameter, zSignedIdent, // ** to the specified offset in the buffer and updates *pIdx to refer // ** to the first byte after the last byte written before returning. // ** // ** If the string zSignedIdent consists entirely of alphanumeric // ** characters, does not begin with a digit and is not an SQL keyword, // ** then it is copied to the output buffer exactly as it is. Otherwise, // ** it is quoted using double-quotes. // */ func _identPut(tls *libc.TLS, z uintptr, pIdx uintptr, zSignedIdent uintptr) { var i, j, needQuote, v2 int32 var zIdent uintptr _, _, _, _, _ = i, j, needQuote, zIdent, v2 zIdent = zSignedIdent i = **(**int32)(__ccgo_up(pIdx)) j = 0 for { if !(**(**uint8)(__ccgo_up(zIdent + uintptr(j))) != 0) { break } if !(libc.Int32FromUint8(_sqlite3CtypeMap[**(**uint8)(__ccgo_up(zIdent + uintptr(j)))])&libc.Int32FromInt32(0x06) != 0) && libc.Int32FromUint8(**(**uint8)(__ccgo_up(zIdent + uintptr(j)))) != int32('_') { break } goto _1 _1: ; j = j + 1 } needQuote = libc.BoolInt32(libc.Int32FromUint8(_sqlite3CtypeMap[**(**uint8)(__ccgo_up(zIdent))])&int32(0x04) != 0 || _sqlite3KeywordCode(tls, zIdent, j) != int32(TK_ID) || libc.Int32FromUint8(**(**uint8)(__ccgo_up(zIdent + uintptr(j)))) != 0 || j == 0) if needQuote != 0 { v2 = i i = i + 1 **(**uint8)(__ccgo_up(z + uintptr(v2))) = uint8('"') } j = 0 for { if !(**(**uint8)(__ccgo_up(zIdent + uintptr(j))) != 0) { break } v2 = i i = i + 1 **(**uint8)(__ccgo_up(z + uintptr(v2))) = uint8(**(**uint8)(__ccgo_up(zIdent + uintptr(j)))) if libc.Int32FromUint8(**(**uint8)(__ccgo_up(zIdent + uintptr(j)))) == int32('"') { v2 = i i = i + 1 **(**uint8)(__ccgo_up(z + uintptr(v2))) = uint8('"') } goto _3 _3: ; j = j + 1 } if needQuote != 0 { v2 = i i = i + 1 **(**uint8)(__ccgo_up(z + uintptr(v2))) = uint8('"') } **(**uint8)(__ccgo_up(z + uintptr(i))) = uint8(0) **(**int32)(__ccgo_up(pIdx)) = i } // C documentation // // /* // ** The input pBlob is guaranteed to be a Blob that is not marked // ** with MEM_Zero. Return true if it could be a zero-blob. // */ func _isAllZero(tls *libc.TLS, z uintptr, n int32) (r int32) { var i int32 _ = i i = 0 for { if !(i < n) { break } if **(**uint8)(__ccgo_up(z + uintptr(i))) != 0 { return 0 } goto _1 _1: ; i = i + 1 } return int32(1) } // C documentation // // /* // ** Return true if z[] begins with N hexadecimal digits, and write // ** a decoding of those digits into *pVal. Or return false if any // ** one of the first N characters in z[] is not a hexadecimal digit. // */ func _isNHex(tls *libc.TLS, z uintptr, N int32, pVal uintptr) (r int32) { var i int32 var v Tu32 _, _ = i, v v = uint32(0) i = 0 for { if !(i < N) { break } if !(libc.Int32FromUint8(_sqlite3CtypeMap[uint8(**(**uint8)(__ccgo_up(z + uintptr(i))))])&libc.Int32FromInt32(0x08) != 0) { return 0 } v = v<= uint32(0xc0) { sz = _sqlite3Utf8ReadLimited(tls, zLeft, libc.Int32FromUint32(nLeft), bp) zLeft = zLeft + uintptr(sz) nLeft = nLeft - libc.Uint32FromInt32(sz) } else { zLeft = zLeft + 1 nLeft = nLeft - 1 } } else { n = _jsonUnescapeOneChar(tls, zLeft, nLeft, bp) zLeft = zLeft + uintptr(n) nLeft = nLeft - n } } if nRight == uint32(0) { **(**Tu32)(__ccgo_up(bp + 4)) = uint32(0) } else { if rawRight != 0 || libc.Int32FromUint8(**(**uint8)(__ccgo_up(zRight))) != int32('\\') { **(**Tu32)(__ccgo_up(bp + 4)) = uint32(**(**Tu8)(__ccgo_up(zRight))) if **(**Tu32)(__ccgo_up(bp + 4)) >= uint32(0xc0) { sz1 = _sqlite3Utf8ReadLimited(tls, zRight, libc.Int32FromUint32(nRight), bp+4) zRight = zRight + uintptr(sz1) nRight = nRight - libc.Uint32FromInt32(sz1) } else { zRight = zRight + 1 nRight = nRight - 1 } } else { n1 = _jsonUnescapeOneChar(tls, zRight, nRight, bp+4) zRight = zRight + uintptr(n1) nRight = nRight - n1 } } if **(**Tu32)(__ccgo_up(bp)) != **(**Tu32)(__ccgo_up(bp + 4)) { return 0 } if **(**Tu32)(__ccgo_up(bp)) == uint32(0) { return int32(1) } } return r } // C documentation // // /* // ** The set of all space characters recognized by jsonIsspace(). // ** Useful as the second argument to strspn(). // */ var _jsonSpaces = [5]uint8{9, 10, 13, ' '} // C documentation // // /* Make sure there is a zero terminator on p->zBuf[] // ** // ** Return true on success. Return false if an OOM prevents this // ** from happening. // */ func _jsonStringTerminate(tls *libc.TLS, p uintptr) (r int32) { _jsonAppendChar(tls, p, uint8(0)) _jsonStringTrimOneChar(tls, p) return libc.BoolInt32(libc.Int32FromUint8((*TJsonString)(unsafe.Pointer(p)).FeErr) == 0) } // C documentation // // /* // ** Input z[0..n] defines JSON escape sequence including the leading '\\'. // ** Decode that escape sequence into a single character. Write that // ** character into *piOut. Return the number of bytes in the escape sequence. // ** // ** If there is a syntax error of some kind (for example too few characters // ** after the '\\' to complete the encoding) then *piOut is set to // ** JSON_INVALID_CHAR. // */ func _jsonUnescapeOneChar(tls *libc.TLS, z uintptr, n Tu32, piOut uintptr) (r Tu32) { var nSkip, v, vlo, v1 Tu32 var sz, v3 int32 var v2 bool _, _, _, _, _, _, _ = nSkip, sz, v, vlo, v1, v2, v3 if n < uint32(2) { **(**Tu32)(__ccgo_up(piOut)) = uint32(JSON_INVALID_CHAR) return n } switch libc.Int32FromUint8(uint8(**(**uint8)(__ccgo_up(z + 1)))) { case int32('u'): if n < uint32(6) { **(**Tu32)(__ccgo_up(piOut)) = uint32(JSON_INVALID_CHAR) return n } v = _jsonHexToInt4(tls, z+2) if v2 = v&uint32(0xfc00) == uint32(0xd800) && n >= uint32(12) && libc.Int32FromUint8(**(**uint8)(__ccgo_up(z + 6))) == int32('\\') && libc.Int32FromUint8(**(**uint8)(__ccgo_up(z + 7))) == int32('u'); v2 { v1 = _jsonHexToInt4(tls, z+8) vlo = v1 } if v2 && v1&uint32(0xfc00) == uint32(0xdc00) { **(**Tu32)(__ccgo_up(piOut)) = v&uint32(0x3ff)< uint32(2) && libc.Int32FromUint8(_sqlite3CtypeMap[uint8(**(**uint8)(__ccgo_up(z + 2)))])&int32(0x04) != 0 { v3 = int32(JSON_INVALID_CHAR) } else { v3 = 0 } **(**Tu32)(__ccgo_up(piOut)) = libc.Uint32FromInt32(v3) return uint32(2) case int32('\''): fallthrough case int32('"'): fallthrough case int32('/'): fallthrough case int32('\\'): **(**Tu32)(__ccgo_up(piOut)) = uint32(**(**uint8)(__ccgo_up(z + 1))) return uint32(2) case int32('x'): if n < uint32(4) { **(**Tu32)(__ccgo_up(piOut)) = uint32(JSON_INVALID_CHAR) return n } **(**Tu32)(__ccgo_up(piOut)) = libc.Uint32FromInt32(libc.Int32FromUint8(_jsonHexToInt(tls, libc.Int32FromUint8(**(**uint8)(__ccgo_up(z + 2)))))< 0) { break } if libc.Int64FromUint8(_aKWLen[i]) != n { goto _1 } zKW = uintptr(unsafe.Pointer(&_zKWText)) + uintptr(_aKWOffset[i]) if libc.Int32FromUint8(**(**uint8)(__ccgo_up(z))) & ^libc.Int32FromInt32(0x20) != libc.Int32FromUint8(**(**uint8)(__ccgo_up(zKW))) { goto _1 } if libc.Int32FromUint8(**(**uint8)(__ccgo_up(z + 1))) & ^libc.Int32FromInt32(0x20) != libc.Int32FromUint8(**(**uint8)(__ccgo_up(zKW + 1))) { goto _1 } j = int64(2) for j < n && libc.Int32FromUint8(**(**uint8)(__ccgo_up(z + uintptr(j)))) & ^libc.Int32FromInt32(0x20) == libc.Int32FromUint8(**(**uint8)(__ccgo_up(zKW + uintptr(j)))) { j = j + 1 } if j < n { goto _1 } /* REINDEX */ /* INDEXED */ /* INDEX */ /* DESC */ /* ESCAPE */ /* EACH */ /* CHECK */ /* KEY */ /* BEFORE */ /* FOREIGN */ /* FOR */ /* IGNORE */ /* REGEXP */ /* EXPLAIN */ /* INSTEAD */ /* ADD */ /* DATABASE */ /* AS */ /* SELECT */ /* TABLE */ /* LEFT */ /* THEN */ /* END */ /* DEFERRABLE */ /* ELSE */ /* EXCLUDE */ /* DELETE */ /* TEMPORARY */ /* TEMP */ /* OR */ /* ISNULL */ /* NULLS */ /* SAVEPOINT */ /* INTERSECT */ /* TIES */ /* NOTNULL */ /* NOT */ /* NO */ /* NULL */ /* LIKE */ /* EXCEPT */ /* TRANSACTION */ /* ACTION */ /* ON */ /* NATURAL */ /* ALTER */ /* RAISE */ /* EXCLUSIVE */ /* EXISTS */ /* CONSTRAINT */ /* INTO */ /* OFFSET */ /* OF */ /* SET */ /* TRIGGER */ /* RANGE */ /* GENERATED */ /* DETACH */ /* HAVING */ /* GLOB */ /* BEGIN */ /* INNER */ /* REFERENCES */ /* UNIQUE */ /* QUERY */ /* WITHOUT */ /* WITH */ /* OUTER */ /* RELEASE */ /* ATTACH */ /* BETWEEN */ /* NOTHING */ /* GROUPS */ /* GROUP */ /* CASCADE */ /* ASC */ /* DEFAULT */ /* CASE */ /* COLLATE */ /* CREATE */ /* CURRENT_DATE */ /* IMMEDIATE */ /* JOIN */ /* INSERT */ /* MATCH */ /* PLAN */ /* ANALYZE */ /* PRAGMA */ /* MATERIALIZED */ /* DEFERRED */ /* DISTINCT */ /* IS */ /* UPDATE */ /* VALUES */ /* VIRTUAL */ /* ALWAYS */ /* WHEN */ /* WHERE */ /* RECURSIVE */ /* ABORT */ /* AFTER */ /* RENAME */ /* AND */ /* DROP */ /* PARTITION */ /* AUTOINCREMENT */ /* TO */ /* IN */ /* CAST */ /* COLUMN */ /* COMMIT */ /* CONFLICT */ /* CROSS */ /* CURRENT_TIMESTAMP */ /* CURRENT_TIME */ /* CURRENT */ /* PRECEDING */ /* FAIL */ /* LAST */ /* FILTER */ /* REPLACE */ /* FIRST */ /* FOLLOWING */ /* FROM */ /* FULL */ /* LIMIT */ /* IF */ /* ORDER */ /* RESTRICT */ /* OTHERS */ /* OVER */ /* RETURNING */ /* RIGHT */ /* ROLLBACK */ /* ROWS */ /* ROW */ /* UNBOUNDED */ /* UNION */ /* USING */ /* VACUUM */ /* VIEW */ /* WINDOW */ /* DO */ /* BY */ /* INITIALLY */ /* ALL */ /* PRIMARY */ **(**int32)(__ccgo_up(pType)) = libc.Int32FromUint8(_aKWCode[i]) break goto _1 _1: ; i = libc.Int64FromUint8(_aKWNext[i]) } return n } var _lagName = [4]uint8{'l', 'a', 'g'} var _last_valueName = [11]uint8{'l', 'a', 's', 't', '_', 'v', 'a', 'l', 'u', 'e'} var _leadName = [5]uint8{'l', 'e', 'a', 'd'} func _lowerFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var i, n int32 var z1, z2 uintptr _, _, _, _ = i, n, z1, z2 _ = argc z2 = Xsqlite3_value_text(tls, **(**uintptr)(__ccgo_up(argv))) n = Xsqlite3_value_bytes(tls, **(**uintptr)(__ccgo_up(argv))) /* Verify that the call to _bytes() does not invalidate the _text() pointer */ if z2 != 0 { z1 = _contextMalloc(tls, context, int64(n)+int64(1)) if z1 != 0 { i = 0 for { if !(i < n) { break } **(**uint8)(__ccgo_up(z1 + uintptr(i))) = _sqlite3UpperToLower[uint8(**(**uint8)(__ccgo_up(z2 + uintptr(i))))] goto _1 _1: ; i = i + 1 } Xsqlite3_result_text(tls, context, z1, n, __ccgo_fp(Xsqlite3_free)) } } } /* ** Some functions like COALESCE() and IFNULL() and UNLIKELY() are implemented ** as VDBE code so that unused argument values do not have to be computed. ** However, we still need some kind of function implementation for this ** routines in the function table. The noopFunc macro provides this. ** noopFunc will never be called so it doesn't matter what the implementation ** is. We might as well use the "version()" function as a substitute. */ var _nth_valueName = [10]uint8{'n', 't', 'h', '_', 'v', 'a', 'l', 'u', 'e'} var _ntileName = [6]uint8{'n', 't', 'i', 'l', 'e'} /* nullRow[] is an OP_Record encoding of a row containing 5 NULLs */ var _nullRow = [6]uint8{ 0: uint8(6), } /* Set properties of a table column based on the (magical) ** name of the column. */ var _percent_rankName = [13]uint8{'p', 'e', 'r', 'c', 'e', 'n', 't', '_', 'r', 'a', 'n', 'k'} // C documentation // // /* // ** Write an entry into the pointer map. // ** // ** This routine updates the pointer map entry for page number 'key' // ** so that it maps to type 'eType' and parent page number 'pgno'. // ** // ** If *pRC is initially non-zero (non-SQLITE_OK) then this routine is // ** a no-op. If an error occurs, the appropriate error code is written // ** into *pRC. // */ func _ptrmapPut(tls *libc.TLS, pBt uintptr, key TPgno, eType Tu8, parent TPgno, pRC uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var iPtrmap TPgno var offset, rc, v1 int32 var pPtrmap uintptr var _ /* pDbPage at bp+0 */ uintptr _, _, _, _, _ = iPtrmap, offset, pPtrmap, rc, v1 /* Return code from subfunctions */ if **(**int32)(__ccgo_up(pRC)) != 0 { return } /* The super-journal page number must never be used as a pointer map page */ if key == uint32(0) { **(**int32)(__ccgo_up(pRC)) = _sqlite3CorruptError(tls, int32(74301)) return } iPtrmap = _ptrmapPageno(tls, pBt, key) rc = _sqlite3PagerGet(tls, (*TBtShared)(unsafe.Pointer(pBt)).FpPager, iPtrmap, bp, 0) if rc != SQLITE_OK { **(**int32)(__ccgo_up(pRC)) = rc return } if libc.Int32FromUint8(**(**uint8)(__ccgo_up(_sqlite3PagerGetExtra(tls, **(**uintptr)(__ccgo_up(bp)))))) != 0 { /* The first byte of the extra data is the MemPage.isInit byte. ** If that byte is set, it means this page is also being used ** as a btree page. */ **(**int32)(__ccgo_up(pRC)) = _sqlite3CorruptError(tls, int32(74314)) goto ptrmap_exit } offset = libc.Int32FromUint32(libc.Uint32FromInt32(5) * (key - iPtrmap - libc.Uint32FromInt32(1))) if offset < 0 { **(**int32)(__ccgo_up(pRC)) = _sqlite3CorruptError(tls, int32(74319)) goto ptrmap_exit } pPtrmap = _sqlite3PagerGetData(tls, **(**uintptr)(__ccgo_up(bp))) if libc.Int32FromUint8(eType) != libc.Int32FromUint8(**(**Tu8)(__ccgo_up(pPtrmap + uintptr(offset)))) || _sqlite3Get4byte(tls, pPtrmap+uintptr(offset+int32(1))) != parent { v1 = _sqlite3PagerWrite(tls, **(**uintptr)(__ccgo_up(bp))) rc = v1 **(**int32)(__ccgo_up(pRC)) = v1 if rc == SQLITE_OK { **(**Tu8)(__ccgo_up(pPtrmap + uintptr(offset))) = eType _sqlite3Put4byte(tls, pPtrmap+uintptr(offset+int32(1)), parent) } } goto ptrmap_exit ptrmap_exit: ; _sqlite3PagerUnref(tls, **(**uintptr)(__ccgo_up(bp))) } var _rankName = [5]uint8{'r', 'a', 'n', 'k'} // C documentation // // /* // ** Return a nul-terminated string consisting of nByte comma separated // ** "?" expressions. For example, if nByte is 3, return a pointer to // ** a buffer containing the string "?,?,?". // ** // ** The memory for the returned string is obtained from sqlite3_malloc(). // ** It is the responsibility of the caller to eventually free it using // ** sqlite3_free(). // ** // ** If an OOM error is encountered when allocating space for the new // ** string, an error code is left in the rbu handle passed as the first // ** argument and NULL is returned. Or, if an error has already occurred // ** when this function is called, NULL is returned immediately, without // ** attempting the allocation or modifying the stored error code. // */ func _rbuObjIterGetBindlist(tls *libc.TLS, p uintptr, nBind int32) (r uintptr) { var i, v2 int32 var nByte Tsqlite3_int64 var zRet uintptr _, _, _, _ = i, nByte, zRet, v2 zRet = uintptr(0) nByte = int64(2)*int64(nBind) + int64(1) zRet = _rbuMalloc(tls, p, nByte) if zRet != 0 { i = 0 for { if !(i < nBind) { break } **(**uint8)(__ccgo_up(zRet + uintptr(i*int32(2)))) = uint8('?') if i+int32(1) == nBind { v2 = int32('\000') } else { v2 = int32(',') } **(**uint8)(__ccgo_up(zRet + uintptr(i*int32(2)+int32(1)))) = libc.Uint8FromInt32(v2) goto _1 _1: ; i = i + 1 } } return zRet } // C documentation // // /* // ** Static names for the built-in window function names. These static // ** names are used, rather than string literals, so that FuncDef objects // ** can be associated with a particular window function by direct // ** comparison of the zName pointer. Example: // ** // ** if( pFuncDef->zName==row_valueName ){ ... } // */ var _row_numberName = [11]uint8{'r', 'o', 'w', '_', 'n', 'u', 'm', 'b', 'e', 'r'} // C documentation // // /* // ** Set the time to the current time reported by the VFS. // ** // ** Return the number of errors. // */ func _setDateTimeToCurrent(tls *libc.TLS, context uintptr, p uintptr) (r int32) { (*TDateTime)(unsafe.Pointer(p)).FiJD = _sqlite3StmtCurrentTime(tls, context) if (*TDateTime)(unsafe.Pointer(p)).FiJD > 0 { (*TDateTime)(unsafe.Pointer(p)).FvalidJD = uint8(1) libc.SetBitFieldPtr8Uint32(p+44, libc.Uint32FromInt32(1), 3, 0x8) libc.SetBitFieldPtr8Uint32(p+44, libc.Uint32FromInt32(0), 4, 0x10) _clearYMD_HMS_TZ(tls, p) return 0 } else { return int32(1) } return r } // C documentation // // /* // ** Scan the column type name zType (length nType) and return the // ** associated affinity type. // ** // ** This routine does a case-independent search of zType for the // ** substrings in the following table. If one of the substrings is // ** found, the corresponding affinity is returned. If zType contains // ** more than one of the substrings, entries toward the top of // ** the table take priority. For example, if zType is 'BLOBINT', // ** SQLITE_AFF_INTEGER is returned. // ** // ** Substring | Affinity // ** -------------------------------- // ** 'INT' | SQLITE_AFF_INTEGER // ** 'CHAR' | SQLITE_AFF_TEXT // ** 'CLOB' | SQLITE_AFF_TEXT // ** 'TEXT' | SQLITE_AFF_TEXT // ** 'BLOB' | SQLITE_AFF_BLOB // ** 'REAL' | SQLITE_AFF_REAL // ** 'FLOA' | SQLITE_AFF_REAL // ** 'DOUB' | SQLITE_AFF_REAL // ** // ** If none of the substrings in the above table are found, // ** SQLITE_AFF_NUMERIC is returned. // */ func _sqlite3AffinityType(tls *libc.TLS, zIn uintptr, pCol uintptr) (r uint8) { bp := tls.Alloc(16) defer tls.Free(16) var aff uint8 var h Tu32 var x Tu8 var zChar uintptr var _ /* v at bp+0 */ int32 _, _, _, _ = aff, h, x, zChar h = uint32(0) aff = uint8(SQLITE_AFF_NUMERIC) zChar = uintptr(0) for **(**uint8)(__ccgo_up(zIn)) != 0 { x = **(**Tu8)(__ccgo_up(zIn)) h = h< r=(k/4+1) */ _sqlite3GetInt32(tls, zChar, bp) break } zChar = zChar + 1 } } else { **(**int32)(__ccgo_up(bp)) = int32(16) /* BLOB, TEXT, CLOB -> r=5 (approx 20 bytes)*/ } } **(**int32)(__ccgo_up(bp)) = **(**int32)(__ccgo_up(bp))/int32(4) + int32(1) if **(**int32)(__ccgo_up(bp)) > int32(255) { **(**int32)(__ccgo_up(bp)) = int32(255) } (*TColumn)(unsafe.Pointer(pCol)).FszEst = libc.Uint8FromInt32(**(**int32)(__ccgo_up(bp))) } return aff } // C documentation // // /* // ** Write a single UTF8 character whose value is v into the // ** buffer starting at zOut. zOut must be sized to hold at // ** least four bytes. Return the number of bytes needed // ** to encode the new character. // */ func _sqlite3AppendOneUtf8Character(tls *libc.TLS, zOut uintptr, v Tu32) (r int32) { if v < uint32(0x00080) { **(**uint8)(__ccgo_up(zOut)) = uint8(v & libc.Uint32FromInt32(0xff)) return int32(1) } if v < uint32(0x00800) { **(**uint8)(__ccgo_up(zOut)) = libc.Uint8FromInt32(int32(0xc0) + libc.Int32FromUint8(uint8(v>>libc.Int32FromInt32(6)&libc.Uint32FromInt32(0x1f)))) **(**uint8)(__ccgo_up(zOut + 1)) = libc.Uint8FromInt32(int32(0x80) + libc.Int32FromUint8(uint8(v&libc.Uint32FromInt32(0x3f)))) return int32(2) } if v < uint32(0x10000) { **(**uint8)(__ccgo_up(zOut)) = libc.Uint8FromInt32(int32(0xe0) + libc.Int32FromUint8(uint8(v>>libc.Int32FromInt32(12)&libc.Uint32FromInt32(0x0f)))) **(**uint8)(__ccgo_up(zOut + 1)) = libc.Uint8FromInt32(int32(0x80) + libc.Int32FromUint8(uint8(v>>libc.Int32FromInt32(6)&libc.Uint32FromInt32(0x3f)))) **(**uint8)(__ccgo_up(zOut + 2)) = libc.Uint8FromInt32(int32(0x80) + libc.Int32FromUint8(uint8(v&libc.Uint32FromInt32(0x3f)))) return int32(3) } **(**uint8)(__ccgo_up(zOut)) = libc.Uint8FromInt32(int32(0xf0) + libc.Int32FromUint8(uint8(v>>libc.Int32FromInt32(18)&libc.Uint32FromInt32(0x07)))) **(**uint8)(__ccgo_up(zOut + 1)) = libc.Uint8FromInt32(int32(0x80) + libc.Int32FromUint8(uint8(v>>libc.Int32FromInt32(12)&libc.Uint32FromInt32(0x3f)))) **(**uint8)(__ccgo_up(zOut + 2)) = libc.Uint8FromInt32(int32(0x80) + libc.Int32FromUint8(uint8(v>>libc.Int32FromInt32(6)&libc.Uint32FromInt32(0x3f)))) **(**uint8)(__ccgo_up(zOut + 3)) = libc.Uint8FromInt32(int32(0x80) + libc.Int32FromUint8(uint8(v&libc.Uint32FromInt32(0x3f)))) return int32(4) } // C documentation // // /* // ** Convert zNum to a 64-bit signed integer. zNum must be decimal. This // ** routine does *not* accept hexadecimal notation. // ** // ** Returns: // ** // ** -1 Not even a prefix of the input text looks like an integer // ** 0 Successful transformation. Fits in a 64-bit signed integer. // ** 1 Excess non-space text after the integer value // ** 2 Integer too large for a 64-bit signed integer or is malformed // ** 3 Special case of 9223372036854775808 // ** // ** length is the number of bytes in the string (bytes, not characters). // ** The string is not necessarily zero-terminated. The encoding is // ** given by enc. // */ func _sqlite3Atoi64(tls *libc.TLS, zNum uintptr, pNum uintptr, length int32, enc Tu8) (r int32) { var c, v3 uint32 var i, incr, j, jj, neg, nonNum, rc, v6 int32 var u Tu64 var zEnd, zStart uintptr var v4 bool var v5 int64 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = c, i, incr, j, jj, neg, nonNum, rc, u, zEnd, zStart, v3, v4, v5, v6 u = uint64(0) neg = 0 c = uint32(0) nonNum = 0 zEnd = zNum + uintptr(length) if libc.Int32FromUint8(enc) == int32(SQLITE_UTF8) { incr = int32(1) } else { incr = int32(2) length = length & ^libc.Int32FromInt32(1) i = int32(3) - libc.Int32FromUint8(enc) for { if !(i < length && libc.Int32FromUint8(**(**uint8)(__ccgo_up(zNum + uintptr(i)))) == 0) { break } goto _1 _1: ; i = i + int32(2) } nonNum = libc.BoolInt32(i < length) zEnd = zNum + uintptr(i^int32(1)) zNum = zNum + uintptr(libc.Int32FromUint8(enc)&libc.Int32FromInt32(1)) } for zNum < zEnd && libc.Int32FromUint8(_sqlite3CtypeMap[uint8(**(**uint8)(__ccgo_up(zNum)))])&int32(0x01) != 0 { zNum = zNum + uintptr(incr) } if zNum < zEnd { if libc.Int32FromUint8(**(**uint8)(__ccgo_up(zNum))) == int32('-') { neg = int32(1) zNum = zNum + uintptr(incr) } else { if libc.Int32FromUint8(**(**uint8)(__ccgo_up(zNum))) == int32('+') { zNum = zNum + uintptr(incr) } } } zStart = zNum for zNum < zEnd && libc.Int32FromUint8(**(**uint8)(__ccgo_up(zNum))) == int32('0') { zNum = zNum + uintptr(incr) } /* Skip leading zeros. */ i = 0 for { if v4 = zNum+uintptr(i) < zEnd; v4 { v3 = uint32(**(**uint8)(__ccgo_up(zNum + uintptr(i)))) - libc.Uint32FromUint8('0') c = v3 } if !(v4 && v3 <= uint32(9)) { break } u = u*uint64(10) + uint64(c) goto _2 _2: ; i = i + incr } if u > libc.Uint64FromInt64(libc.Int64FromUint32(0xffffffff)|libc.Int64FromInt32(0x7fffffff)< int32(19)*incr { v6 = int32(1) } else { v6 = _compare2pow63(tls, zNum, incr) } j = v6 if j < 0 { /* zNum is less than 9223372036854775808 so it fits */ return rc } else { if neg != 0 { v5 = int64(-libc.Int32FromInt32(1)) - (libc.Int64FromUint32(0xffffffff) | libc.Int64FromInt32(0x7fffffff)< 0 { /* zNum is greater than 9223372036854775808 so it overflows */ return int32(2) } else { /* zNum is exactly 9223372036854775808. Fits if negative. The ** special case 2 overflow if positive */ if neg != 0 { v6 = rc } else { v6 = int32(3) } return v6 } } } return r } // C documentation // // /* // ** Return the collating sequence name for a column // */ func _sqlite3ColumnColl(tls *libc.TLS, pCol uintptr) (r uintptr) { var z uintptr _ = z if libc.Int32FromUint16((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_HASCOLL) == 0 { return uintptr(0) } z = (*TColumn)(unsafe.Pointer(pCol)).FzCnName for **(**uint8)(__ccgo_up(z)) != 0 { z = z + 1 } if libc.Int32FromUint16((*TColumn)(unsafe.Pointer(pCol)).FcolFlags)&int32(COLFLAG_HASTYPE) != 0 { for cond := true; cond; cond = **(**uint8)(__ccgo_up(z)) != 0 { z = z + 1 } } return z + uintptr(1) } // C documentation // // /* // ** pExpr is an operand of a comparison operator. aff2 is the // ** type affinity of the other operand. This routine returns the // ** type affinity that should be used for the comparison operator. // */ func _sqlite3CompareAffinity(tls *libc.TLS, pExpr uintptr, aff2 uint8) (r uint8) { var aff1 uint8 var v1 int32 _, _ = aff1, v1 aff1 = _sqlite3ExprAffinity(tls, pExpr) if libc.Int32FromUint8(aff1) > int32(SQLITE_AFF_NONE) && libc.Int32FromUint8(aff2) > int32(SQLITE_AFF_NONE) { /* Both sides of the comparison are columns. If one has numeric ** affinity, use that. Otherwise use no affinity. */ if libc.Int32FromUint8(aff1) >= int32(SQLITE_AFF_NUMERIC) || libc.Int32FromUint8(aff2) >= int32(SQLITE_AFF_NUMERIC) { return uint8(SQLITE_AFF_NUMERIC) } else { return uint8(SQLITE_AFF_BLOB) } } else { /* One side is a column, the other is not. Use the columns affinity. */ if libc.Int32FromUint8(aff1) <= int32(SQLITE_AFF_NONE) { v1 = libc.Int32FromUint8(aff2) } else { v1 = libc.Int32FromUint8(aff1) } return libc.Uint8FromInt32(v1 | int32(SQLITE_AFF_NONE)) } return r } // C documentation // // /* // ** Convert an SQL-style quoted string into a normal string by removing // ** the quote characters. The conversion is done in-place. If the // ** input does not begin with a quote character, then this routine // ** is a no-op. // ** // ** The input string must be zero-terminated. A new zero-terminator // ** is added to the dequoted string. // ** // ** The return value is -1 if no dequoting occurs or the length of the // ** dequoted string, exclusive of the zero terminator, if dequoting does // ** occur. // ** // ** 2002-02-14: This routine is extended to remove MS-Access style // ** brackets from around identifiers. For example: "[a-b-c]" becomes // ** "a-b-c". // */ func _sqlite3Dequote(tls *libc.TLS, z uintptr) { var i, j, v2 int32 var quote uint8 _, _, _, _ = i, j, quote, v2 if z == uintptr(0) { return } quote = **(**uint8)(__ccgo_up(z)) if !(libc.Int32FromUint8(_sqlite3CtypeMap[quote])&libc.Int32FromInt32(0x80) != 0) { return } if libc.Int32FromUint8(quote) == int32('[') { quote = uint8(']') } i = int32(1) j = libc.Int32FromInt32(0) for { if libc.Int32FromUint8(**(**uint8)(__ccgo_up(z + uintptr(i)))) == libc.Int32FromUint8(quote) { if libc.Int32FromUint8(**(**uint8)(__ccgo_up(z + uintptr(i+int32(1))))) == libc.Int32FromUint8(quote) { v2 = j j = j + 1 **(**uint8)(__ccgo_up(z + uintptr(v2))) = quote i = i + 1 } else { break } } else { v2 = j j = j + 1 **(**uint8)(__ccgo_up(z + uintptr(v2))) = **(**uint8)(__ccgo_up(z + uintptr(i))) } goto _1 _1: ; i = i + 1 } **(**uint8)(__ccgo_up(z + uintptr(j))) = uint8(0) } func _sqlite3DequoteExpr(tls *libc.TLS, p uintptr) { var v1 int32 _ = v1 if libc.Int32FromUint8(**(**uint8)(__ccgo_up(*(*uintptr)(unsafe.Pointer(p + 8))))) == int32('"') { v1 = libc.Int32FromInt32(EP_Quoted) | libc.Int32FromInt32(EP_DblQuoted) } else { v1 = int32(EP_Quoted) } **(**Tu32)(__ccgo_up(p + 4)) |= libc.Uint32FromInt32(v1) _sqlite3Dequote(tls, *(*uintptr)(unsafe.Pointer(p + 8))) } // C documentation // // /* // ** Digit pairs used to convert a U64 or I64 into text, two digits // ** at a time. // */ var _sqlite3DigitPairs = *(*struct { FforceAlignment [0]int16 Fa [201]uint8 F__ccgo_pad2 [1]byte })(unsafe.Pointer(&struct { f [201]uint8 _ [1]byte }{f: [201]uint8{'0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', '0', '8', '0', '9', '1', '0', '1', '1', '1', '2', '1', '3', '1', '4', '1', '5', '1', '6', '1', '7', '1', '8', '1', '9', '2', '0', '2', '1', '2', '2', '2', '3', '2', '4', '2', '5', '2', '6', '2', '7', '2', '8', '2', '9', '3', '0', '3', '1', '3', '2', '3', '3', '3', '4', '3', '5', '3', '6', '3', '7', '3', '8', '3', '9', '4', '0', '4', '1', '4', '2', '4', '3', '4', '4', '4', '5', '4', '6', '4', '7', '4', '8', '4', '9', '5', '0', '5', '1', '5', '2', '5', '3', '5', '4', '5', '5', '5', '6', '5', '7', '5', '8', '5', '9', '6', '0', '6', '1', '6', '2', '6', '3', '6', '4', '6', '5', '6', '6', '6', '7', '6', '8', '6', '9', '7', '0', '7', '1', '7', '2', '7', '3', '7', '4', '7', '5', '7', '6', '7', '7', '7', '8', '7', '9', '8', '0', '8', '1', '8', '2', '8', '3', '8', '4', '8', '5', '8', '6', '8', '7', '8', '8', '8', '9', '9', '0', '9', '1', '9', '2', '9', '3', '9', '4', '9', '5', '9', '6', '9', '7', '9', '8', '9', '9'}})) /* ** ARMv6, ARMv7, PPC32 are known to not support hardware u64 division. */ // C documentation // // /* // ** Return TRUE if the given expression is a constant which would be // ** unchanged by OP_Affinity with the affinity given in the second // ** argument. // ** // ** This routine is used to determine if the OP_Affinity operation // ** can be omitted. When in doubt return FALSE. A false negative // ** is harmless. A false positive, however, can result in the wrong // ** answer. // */ func _sqlite3ExprNeedsNoAffinityChange(tls *libc.TLS, p uintptr, aff uint8) (r int32) { var op Tu8 var unaryMinus int32 _, _ = op, unaryMinus unaryMinus = 0 if libc.Int32FromUint8(aff) == int32(SQLITE_AFF_BLOB) { return int32(1) } for libc.Int32FromUint8((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_UPLUS) || libc.Int32FromUint8((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_UMINUS) { if libc.Int32FromUint8((*TExpr)(unsafe.Pointer(p)).Fop) == int32(TK_UMINUS) { unaryMinus = int32(1) } p = (*TExpr)(unsafe.Pointer(p)).FpLeft } op = (*TExpr)(unsafe.Pointer(p)).Fop if libc.Int32FromUint8(op) == int32(TK_REGISTER) { op = (*TExpr)(unsafe.Pointer(p)).Fop2 } switch libc.Int32FromUint8(op) { case int32(TK_INTEGER): return libc.BoolInt32(libc.Int32FromUint8(aff) >= int32(SQLITE_AFF_NUMERIC)) case int32(TK_FLOAT): return libc.BoolInt32(libc.Int32FromUint8(aff) >= int32(SQLITE_AFF_NUMERIC)) case int32(TK_STRING): return libc.BoolInt32(!(unaryMinus != 0) && libc.Int32FromUint8(aff) == int32(SQLITE_AFF_TEXT)) case int32(TK_BLOB): return libc.BoolInt32(!(unaryMinus != 0)) case int32(TK_COLUMN): /* p cannot be part of a CHECK constraint */ return libc.BoolInt32(libc.Int32FromUint8(aff) >= int32(SQLITE_AFF_NUMERIC) && int32((*TExpr)(unsafe.Pointer(p)).FiColumn) < 0) default: return 0 } return r } // C documentation // // /* // ** The argument must be a TK_TRUEFALSE Expr node. Return 1 if it is TRUE // ** and 0 if it is FALSE. // */ func _sqlite3ExprTruthValue(tls *libc.TLS, pExpr uintptr) (r int32) { pExpr = _sqlite3ExprSkipCollateAndLikely(tls, pExpr) return libc.BoolInt32(libc.Int32FromUint8(**(**uint8)(__ccgo_up(*(*uintptr)(unsafe.Pointer(pExpr + 8)) + 4))) == 0) } // C documentation // // /* // ** Value pVal is guaranteed to be an fts5_locale() value, according to // ** sqlite3Fts5IsLocaleValue(). This function extracts the text and locale // ** from the value and returns them separately. // ** // ** If successful, SQLITE_OK is returned and (*ppText) and (*ppLoc) set // ** to point to buffers containing the text and locale, as utf-8, // ** respectively. In this case output parameters (*pnText) and (*pnLoc) are // ** set to the sizes in bytes of these two buffers. // ** // ** Or, if an error occurs, then an SQLite error code is returned. The final // ** value of the four output parameters is undefined in this case. // */ func _sqlite3Fts5DecodeLocaleValue(tls *libc.TLS, pVal uintptr, ppText uintptr, pnText uintptr, ppLoc uintptr, pnLoc uintptr) (r int32) { var n, nLoc int32 var p uintptr _, _, _ = n, nLoc, p p = Xsqlite3_value_blob(tls, pVal) n = Xsqlite3_value_bytes(tls, pVal) nLoc = 0 nLoc = libc.Int32FromInt64(16) for { if !(**(**uint8)(__ccgo_up(p + uintptr(nLoc))) != 0) { break } if nLoc == n-int32(1) { return int32(SQLITE_MISMATCH) } goto _1 _1: ; nLoc = nLoc + 1 } **(**uintptr)(__ccgo_up(ppLoc)) = p + uintptr(libc.Int32FromInt64(16)) **(**int32)(__ccgo_up(pnLoc)) = nLoc - libc.Int32FromInt64(16) **(**uintptr)(__ccgo_up(ppText)) = p + uintptr(nLoc+int32(1)) **(**int32)(__ccgo_up(pnText)) = n - nLoc - int32(1) return SQLITE_OK } // C documentation // // /* // ** Convert an SQL-style quoted string into a normal string by removing // ** the quote characters. The conversion is done in-place. If the // ** input does not begin with a quote character, then this routine // ** is a no-op. // ** // ** Examples: // ** // ** "abc" becomes abc // ** 'xyz' becomes xyz // ** [pqr] becomes pqr // ** `mno` becomes mno // */ func _sqlite3Fts5Dequote(tls *libc.TLS, z uintptr) { var quote uint8 _ = quote /* Quote character (if any ) */ quote = **(**uint8)(__ccgo_up(z)) if libc.Int32FromUint8(quote) == int32('[') || libc.Int32FromUint8(quote) == int32('\'') || libc.Int32FromUint8(quote) == int32('"') || libc.Int32FromUint8(quote) == int32('`') { _fts5Dequote(tls, z) } } // C documentation // // /* // ** Argument p points to a buffer containing utf-8 text that is n bytes in // ** size. Return the number of bytes in the nChar character prefix of the // ** buffer, or 0 if there are less than nChar characters in total. // */ func _sqlite3Fts5IndexCharlenToBytelen(tls *libc.TLS, p uintptr, nByte int32, nChar int32) (r int32) { var i, n, v2 int32 _, _, _ = i, n, v2 n = 0 i = 0 for { if !(i < nChar) { break } if n >= nByte { return 0 } /* Input contains fewer than nChar chars */ v2 = n n = n + 1 if libc.Int32FromUint8(uint8(**(**uint8)(__ccgo_up(p + uintptr(v2))))) >= int32(0xc0) { if n >= nByte { return 0 } for libc.Int32FromUint8(**(**uint8)(__ccgo_up(p + uintptr(n))))&int32(0xc0) == int32(0x80) { n = n + 1 if n >= nByte { if i+int32(1) == nChar { break } return 0 } } } goto _1 _1: ; i = i + 1 } return n } // C documentation // // /* // ** Return a simple checksum value based on the arguments. // */ func _sqlite3Fts5IndexEntryCksum(tls *libc.TLS, iRowid Ti64, iCol int32, iPos int32, iIdx int32, pTerm uintptr, nTerm int32) (r Tu64) { var i int32 var ret Tu64 _, _ = i, ret ret = libc.Uint64FromInt64(iRowid) ret = ret + (ret<= 0 { ret = ret + (ret< uint64(4294967296) { **(**Tu32)(__ccgo_up(pI)) = uint32(0) return 0 } goto _1 _1: ; i = i + 1 } if i == 0 || libc.Int32FromUint8(**(**uint8)(__ccgo_up(z + uintptr(i)))) != 0 { **(**Tu32)(__ccgo_up(pI)) = uint32(0) return 0 } **(**Tu32)(__ccgo_up(pI)) = uint32(v) return int32(1) } /* ** The variable-length integer encoding is as follows: ** ** KEY: ** A = 0xxxxxxx 7 bits of data and one flag bit ** B = 1xxxxxxx 7 bits of data and one flag bit ** C = xxxxxxxx 8 bits of data ** ** 7 bits - A ** 14 bits - BA ** 21 bits - BBA ** 28 bits - BBBA ** 35 bits - BBBBA ** 42 bits - BBBBBA ** 49 bits - BBBBBBA ** 56 bits - BBBBBBBA ** 64 bits - BBBBBBBBC */ // C documentation // // /* // ** Convert a BLOB literal of the form "x'hhhhhh'" into its binary // ** value. Return a pointer to its binary value. Space to hold the // ** binary value has been obtained from malloc and must be freed by // ** the calling routine. // */ func _sqlite3HexToBlob(tls *libc.TLS, db uintptr, z uintptr, n int32) (r uintptr) { var i int32 var zBlob uintptr _, _ = i, zBlob zBlob = _sqlite3DbMallocRawNN(tls, db, libc.Uint64FromInt32(n/int32(2)+int32(1))) n = n - 1 if zBlob != 0 { i = 0 for { if !(i < n) { break } **(**uint8)(__ccgo_up(zBlob + uintptr(i/int32(2)))) = libc.Uint8FromInt32(libc.Int32FromUint8(_sqlite3HexToInt(tls, libc.Int32FromUint8(**(**uint8)(__ccgo_up(z + uintptr(i))))))<= int32(SQLITE_AFF_NUMERIC)) } // C documentation // // /* // ** Return the affinity for a single column of an index. // */ func _sqlite3IndexColumnAffinity(tls *libc.TLS, db uintptr, pIdx uintptr, iCol int32) (r uint8) { if !((*TIndex)(unsafe.Pointer(pIdx)).FzColAff != 0) { if _sqlite3IndexAffinityStr(tls, db, pIdx) == uintptr(0) { return uint8(SQLITE_AFF_BLOB) } } return **(**uint8)(__ccgo_up((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(iCol))) } // C documentation // // /* // ** Check to see if pExpr is one of the indexed expressions on pParse->pIdxEpr. // ** If it is, then resolve the expression by reading from the index and // ** return the register into which the value has been read. If pExpr is // ** not an indexed expression, then return negative. // */ func _sqlite3IndexedExprLookup(tls *libc.TLS, pParse uintptr, pExpr uintptr, target int32) (r int32) { var addr, iDataCur int32 var exprAff Tu8 var p, v uintptr _, _, _, _, _ = addr, exprAff, iDataCur, p, v p = (*TParse)(unsafe.Pointer(pParse)).FpIdxEpr for { if !(p != 0) { break } iDataCur = (*TIndexedExpr)(unsafe.Pointer(p)).FiDataCur if iDataCur < 0 { goto _1 } if (*TParse)(unsafe.Pointer(pParse)).FiSelfTab != 0 { if (*TIndexedExpr)(unsafe.Pointer(p)).FiDataCur != (*TParse)(unsafe.Pointer(pParse)).FiSelfTab-int32(1) { goto _1 } iDataCur = -int32(1) } if _sqlite3ExprCompare(tls, uintptr(0), pExpr, (*TIndexedExpr)(unsafe.Pointer(p)).FpExpr, iDataCur) != 0 { goto _1 } exprAff = _sqlite3ExprAffinity(tls, pExpr) if libc.Int32FromUint8(exprAff) <= int32(SQLITE_AFF_BLOB) && libc.Int32FromUint8((*TIndexedExpr)(unsafe.Pointer(p)).Faff) != int32(SQLITE_AFF_BLOB) || libc.Int32FromUint8(exprAff) == int32(SQLITE_AFF_TEXT) && libc.Int32FromUint8((*TIndexedExpr)(unsafe.Pointer(p)).Faff) != int32(SQLITE_AFF_TEXT) || libc.Int32FromUint8(exprAff) >= int32(SQLITE_AFF_NUMERIC) && libc.Int32FromUint8((*TIndexedExpr)(unsafe.Pointer(p)).Faff) != int32(SQLITE_AFF_NUMERIC) { /* Affinity mismatch on a generated column */ goto _1 } /* Functions that might set a subtype should not be replaced by the ** value taken from an expression index if they are themselves an ** argument to another scalar function or aggregate. ** https://sqlite.org/forum/forumpost/68d284c86b082c3e */ if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&libc.Uint32FromUint32(EP_SubtArg) != uint32(0) && _sqlite3ExprCanReturnSubtype(tls, pParse, pExpr) != 0 { goto _1 } v = (*TParse)(unsafe.Pointer(pParse)).FpVdbe if (*TIndexedExpr)(unsafe.Pointer(p)).FbMaybeNullRow != 0 { /* If the index is on a NULL row due to an outer join, then we ** cannot extract the value from the index. The value must be ** computed using the original expression. */ addr = _sqlite3VdbeCurrentAddr(tls, v) _sqlite3VdbeAddOp3(tls, v, int32(OP_IfNullRow), (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCur, addr+int32(3), target) _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCur, (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCol, target) _sqlite3VdbeGoto(tls, v, 0) p = (*TParse)(unsafe.Pointer(pParse)).FpIdxEpr (*TParse)(unsafe.Pointer(pParse)).FpIdxEpr = uintptr(0) _sqlite3ExprCode(tls, pParse, pExpr, target) (*TParse)(unsafe.Pointer(pParse)).FpIdxEpr = p _sqlite3VdbeJumpHere(tls, v, addr+int32(2)) } else { _sqlite3VdbeAddOp3(tls, v, int32(OP_Column), (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCur, (*TIndexedExpr)(unsafe.Pointer(p)).FiIdxCol, target) } return target goto _1 _1: ; p = (*TIndexedExpr)(unsafe.Pointer(p)).FpIENext } return -int32(1) /* Not found */ } // C documentation // // /* // ** This routine implements the uncommon and slower path for // ** sqlite3MemRealValueRC() that has to deal with input strings // ** that are not UTF8 or that are not zero-terminated. It is // ** broken out into a separate no-inline routine so that the // ** main sqlite3MemRealValueRC() routine can avoid unnecessary // ** stack pushes. // ** // ** A text->float translation of pMem->z is written into *pValue. // ** // ** Result code invariants: // ** // ** rc==0 => ERROR: Input string not well-formed, or OOM // ** rc<0 => Some prefix of the input is well-formed // ** rc>0 => All of the input is well-formed // ** (rc&2)==0 => The number is expressed as an integer, with no // ** decimal point or eNNN suffix. // */ func _sqlite3MemRealValueRCSlowPath(tls *libc.TLS, pMem uintptr, pValue uintptr) (r int32) { var i, j, n, rc, v2 int32 var z, zCopy, zCopy1 uintptr _, _, _, _, _, _, _, _ = i, j, n, rc, z, zCopy, zCopy1, v2 rc = SQLITE_OK **(**float64)(__ccgo_up(pValue)) = float64(0) if libc.Int32FromUint8((*TMem)(unsafe.Pointer(pMem)).Fenc) == int32(SQLITE_UTF8) { zCopy = _sqlite3DbStrNDup(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, (*TMem)(unsafe.Pointer(pMem)).Fz, libc.Uint64FromInt32((*TMem)(unsafe.Pointer(pMem)).Fn)) if zCopy != 0 { rc = _sqlite3AtoF(tls, zCopy, pValue) _sqlite3DbFree(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, zCopy) } return rc } else { n = (*TMem)(unsafe.Pointer(pMem)).Fn & ^libc.Int32FromInt32(1) zCopy1 = _sqlite3DbMallocRaw(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, libc.Uint64FromInt32(n/int32(2)+int32(2))) if zCopy1 != 0 { z = (*TMem)(unsafe.Pointer(pMem)).Fz if libc.Int32FromUint8((*TMem)(unsafe.Pointer(pMem)).Fenc) == int32(SQLITE_UTF16LE) { v2 = libc.Int32FromInt32(0) j = v2 i = v2 for { if !(i < n-int32(1)) { break } **(**uint8)(__ccgo_up(zCopy1 + uintptr(j))) = **(**uint8)(__ccgo_up(z + uintptr(i))) if libc.Int32FromUint8(**(**uint8)(__ccgo_up(z + uintptr(i+int32(1))))) != 0 { break } goto _1 _1: ; i = i + int32(2) j = j + 1 } } else { v2 = libc.Int32FromInt32(0) j = v2 i = v2 for { if !(i < n-int32(1)) { break } if libc.Int32FromUint8(**(**uint8)(__ccgo_up(z + uintptr(i)))) != 0 { break } **(**uint8)(__ccgo_up(zCopy1 + uintptr(j))) = **(**uint8)(__ccgo_up(z + uintptr(i+int32(1)))) goto _3 _3: ; i = i + int32(2) j = j + 1 } } **(**uint8)(__ccgo_up(zCopy1 + uintptr(j))) = uint8(0) rc = _sqlite3AtoF(tls, zCopy1, pValue) if i < n { rc = -int32(100) } _sqlite3DbFree(tls, (*TMem)(unsafe.Pointer(pMem)).Fdb, zCopy1) } return rc } return r } func _sqlite3OsFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nPathOut int32, zPathOut uintptr) (r int32) { **(**uint8)(__ccgo_up(zPathOut)) = uint8(0) return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tsqlite3_vfs)(unsafe.Pointer(pVfs)).FxFullPathname})))(tls, pVfs, zPath, nPathOut, zPathOut) } var _sqlite3StdTypeAffinity = [6]uint8{ 0: uint8(SQLITE_AFF_NUMERIC), 1: uint8(SQLITE_AFF_BLOB), 2: uint8(SQLITE_AFF_INTEGER), 3: uint8(SQLITE_AFF_INTEGER), 4: uint8(SQLITE_AFF_REAL), 5: uint8(SQLITE_AFF_TEXT), } func _sqlite3StrAccumFinish(tls *libc.TLS, p uintptr) (r uintptr) { if (*TStrAccum)(unsafe.Pointer(p)).FzText != 0 { **(**uint8)(__ccgo_up((*TStrAccum)(unsafe.Pointer(p)).FzText + uintptr((*TStrAccum)(unsafe.Pointer(p)).FnChar))) = uint8(0) if (*TStrAccum)(unsafe.Pointer(p)).FmxAlloc > uint32(0) && !(libc.Int32FromUint8((*TStrAccum)(unsafe.Pointer(p)).FprintfFlags)&libc.Int32FromInt32(SQLITE_PRINTF_MALLOCED) != libc.Int32FromInt32(0)) { return _strAccumFinishRealloc(tls, p) } } return (*TStrAccum)(unsafe.Pointer(p)).FzText } // C documentation // // /* // ** Name of the default collating sequence // */ var _sqlite3StrBINARY = [7]uint8{'B', 'I', 'N', 'A', 'R', 'Y'} // C documentation // // /* // ** Compute an 8-bit hash on a string that is insensitive to case differences // */ func _sqlite3StrIHash(tls *libc.TLS, z uintptr) (r Tu8) { var h Tu8 _ = h h = uint8(0) if z == uintptr(0) { return uint8(0) } for **(**uint8)(__ccgo_up(z)) != 0 { h = libc.Uint8FromInt32(int32(h) + libc.Int32FromUint8(_sqlite3UpperToLower[uint8(**(**uint8)(__ccgo_up(z)))])) z = z + 1 } return h } // C documentation // // /* // ** Exported version of applyAffinity(). This one works on sqlite3_value*, // ** not the internal Mem* type. // */ func _sqlite3ValueApplyAffinity(tls *libc.TLS, pVal uintptr, affinity Tu8, enc Tu8) { _applyAffinity(tls, pVal, affinity, enc) } // C documentation // // /* // ** Move data out of a btree key or data field and into a Mem structure. // ** The data is payload from the entry that pCur is currently pointing // ** to. offset and amt determine what portion of the data or key to retrieve. // ** The result is written into the pMem element. // ** // ** The pMem object must have been initialized. This routine will use // ** pMem->zMalloc to hold the content from the btree, if possible. New // ** pMem->zMalloc space will be allocated if necessary. The calling routine // ** is responsible for making sure that the pMem object is eventually // ** destroyed. // ** // ** If this routine fails for any reason (malloc returns NULL or unable // ** to read from the disk) then the pMem is left in an inconsistent state. // */ func _sqlite3VdbeMemFromBtree(tls *libc.TLS, pCur uintptr, offset Tu32, amt Tu32, pMem uintptr) (r int32) { var rc, v1 int32 _, _ = rc, v1 (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(MEM_Null) if amt >= uint32(SQLITE_MAX_ALLOCATION_SIZE) { return int32(SQLITE_NOMEM) } if uint64(amt)+uint64(offset) > libc.Uint64FromInt64(_sqlite3BtreeMaxRecordSize(tls, pCur)) { return _sqlite3CorruptError(tls, int32(87091)) } v1 = _sqlite3VdbeMemClearAndResize(tls, pMem, libc.Int32FromUint32(amt+uint32(1))) rc = v1 if SQLITE_OK == v1 { rc = _sqlite3BtreePayload(tls, pCur, offset, amt, (*TMem)(unsafe.Pointer(pMem)).Fz) if rc == SQLITE_OK { **(**uint8)(__ccgo_up((*TMem)(unsafe.Pointer(pMem)).Fz + uintptr(amt))) = uint8(0) /* Overrun area used when reading malformed records */ (*TMem)(unsafe.Pointer(pMem)).Fflags = uint16(MEM_Blob) (*TMem)(unsafe.Pointer(pMem)).Fn = libc.Int32FromUint32(amt) } else { _sqlite3VdbeMemRelease(tls, pMem) } } return rc } // C documentation // // /* // ** Generate code that initializes multiple registers to string or integer // ** constants. The registers begin with iDest and increase consecutively. // ** One register is initialized for each characgter in zTypes[]. For each // ** "s" character in zTypes[], the register is a string if the argument is // ** not NULL, or OP_Null if the value is a null pointer. For each "i" character // ** in zTypes[], the register is initialized to an integer. // ** // ** If the input string does not end with "X" then an OP_ResultRow instruction // ** is generated for the values inserted. // */ func _sqlite3VdbeMultiLoad(tls *libc.TLS, p uintptr, iDest int32, zTypes uintptr, va uintptr) { var ap Tva_list var c, v2 uint8 var i, v3 int32 var z uintptr _, _, _, _, _, _ = ap, c, i, z, v2, v3 ap = va i = 0 for { v2 = **(**uint8)(__ccgo_up(zTypes + uintptr(i))) c = v2 if !(libc.Int32FromUint8(v2) != 0) { break } if libc.Int32FromUint8(c) == int32('s') { z = libc.VaUintptr(&ap) if z == uintptr(0) { v3 = int32(OP_Null) } else { v3 = int32(OP_String8) } _sqlite3VdbeAddOp4(tls, p, v3, 0, iDest+i, 0, z, 0) } else { if libc.Int32FromUint8(c) == int32('i') { _sqlite3VdbeAddOp2(tls, p, int32(OP_Integer), libc.VaInt32(&ap), iDest+i) } else { goto skip_op_resultrow } } goto _1 _1: ; i = i + 1 } _sqlite3VdbeAddOp2(tls, p, int32(OP_ResultRow), iDest, i) goto skip_op_resultrow skip_op_resultrow: ; _ = ap } // C documentation // // /* // ** Elements of sqlite3Stat[] are protected by either the memory allocator // ** mutex, or by the pcache1 mutex. The following array determines which. // */ var _statMutex = [10]uint8{ 1: uint8(1), 2: uint8(1), 7: uint8(1), } /* The "wsdStat" macro will resolve to the status information ** state vector. If writable static data is unsupported on the target, ** we have to locate the state vector at run-time. In the more common ** case where writable static data is supported, wsdStat can refer directly ** to the "sqlite3Stat" state vector declared above. */ // C documentation // // /* // ** The hashing function. // */ func _strHash(tls *libc.TLS, z uintptr) (r uint32) { var h uint32 var v1 uintptr _, _ = h, v1 h = uint32(0) for **(**uint8)(__ccgo_up(z)) != 0 { /*OPTIMIZATION-IF-TRUE*/ /* Knuth multiplicative hashing. (Sorting & Searching, p. 510). ** 0x9e3779b1 is 2654435761 which is the closest prime number to ** (2**32)*golden_ratio, where golden_ratio = (sqrt(5) - 1)/2. ** ** Only bits 0xdf for ASCII and bits 0xbf for EBCDIC each octet are ** hashed since the omitted bits determine the upper/lower case difference. */ v1 = z z = z + 1 h = h + libc.Uint32FromInt32(int32(0xdf)&libc.Int32FromUint8(uint8(**(**uint8)(__ccgo_up(v1))))) h = h * uint32(0x9e3779b1) } return h } // C documentation // // /* // ** We already know that pExpr is a binary operator where both operands are // ** column references. This routine checks to see if pExpr is an equivalence // ** relation: // ** 1. The SQLITE_Transitive optimization must be enabled // ** 2. Must be either an == or an IS operator // ** 3. Not originating in the ON clause of an OUTER JOIN // ** 4. The operator is not IS or else the query does not contain RIGHT JOIN // ** 5. The affinities of A and B must be compatible // ** 6. Both operands use the same collating sequence, and they must not // ** use explicit COLLATE clauses. // ** If this routine returns TRUE, that means that the RHS can be substituted // ** for the LHS anyplace else in the WHERE clause where the LHS column occurs. // ** This is an optimization. No harm comes from returning 0. But if 1 is // ** returned when it should not be, then incorrect answers might result. // */ func _termIsEquivalence(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSrc uintptr) (r int32) { var aff1, aff2 uint8 _, _ = aff1, aff2 if !((*Tsqlite3)(unsafe.Pointer((*TParse)(unsafe.Pointer(pParse)).Fdb)).FdbOptFlags&libc.Uint32FromInt32(libc.Int32FromInt32(SQLITE_Transitive)) == libc.Uint32FromInt32(0)) { return 0 } /* (1) */ if libc.Int32FromUint8((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_EQ) && libc.Int32FromUint8((*TExpr)(unsafe.Pointer(pExpr)).Fop) != int32(TK_IS) { return 0 } /* (2) */ if (*TExpr)(unsafe.Pointer(pExpr)).Fflags&libc.Uint32FromInt32(libc.Int32FromInt32(EP_OuterON)|libc.Int32FromInt32(EP_Collate)) != uint32(0) { return 0 } /* (3) */ if libc.Int32FromUint8((*TExpr)(unsafe.Pointer(pExpr)).Fop) == int32(TK_IS) && (*TSrcList)(unsafe.Pointer(pSrc)).FnSrc >= int32(2) && libc.Int32FromUint8((*(*TSrcItem)(unsafe.Pointer(pSrc + 8))).Ffg.Fjointype)&int32(JT_LTORJ) != 0 { return 0 /* (4) */ } aff1 = _sqlite3ExprAffinity(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft) aff2 = _sqlite3ExprAffinity(tls, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) if libc.Int32FromUint8(aff1) != libc.Int32FromUint8(aff2) && (!(libc.Int32FromUint8(aff1) >= libc.Int32FromInt32(SQLITE_AFF_NUMERIC)) || !(libc.Int32FromUint8(aff2) >= libc.Int32FromInt32(SQLITE_AFF_NUMERIC))) { return 0 /* (5) */ } if !(_sqlite3ExprCollSeqMatch(tls, pParse, (*TExpr)(unsafe.Pointer(pExpr)).FpLeft, (*TExpr)(unsafe.Pointer(pExpr)).FpRight) != 0) { return 0 /* (6) */ } return int32(1) } // C documentation // // /* // ** Duplicate a range of text from an SQL statement, then convert all // ** whitespace characters into ordinary space characters. // */ func _triggerSpanDup(tls *libc.TLS, db uintptr, zStart uintptr, zEnd uintptr) (r uintptr) { var i int32 var z uintptr _, _ = i, z z = _sqlite3DbSpanDup(tls, db, zStart, zEnd) if z != 0 { i = 0 for { if !(**(**uint8)(__ccgo_up(z + uintptr(i))) != 0) { break } if libc.Int32FromUint8(_sqlite3CtypeMap[uint8(**(**uint8)(__ccgo_up(z + uintptr(i))))])&int32(0x01) != 0 { **(**uint8)(__ccgo_up(z + uintptr(i))) = uint8(' ') } goto _1 _1: ; i = i + 1 } } return z } // C documentation // // /* // ** Expression pRight, which is the RHS of a comparison operation, is // ** either a vector of n elements or, if n==1, a scalar expression. // ** Before the comparison operation, affinity zAff is to be applied // ** to the pRight values. This function modifies characters within the // ** affinity string to SQLITE_AFF_BLOB if either: // ** // ** * the comparison will be performed with no affinity, or // ** * the affinity change in zAff is guaranteed not to change the value. // */ func _updateRangeAffinityStr(tls *libc.TLS, pRight uintptr, n int32, zAff uintptr) { var i int32 var p uintptr _, _ = i, p i = 0 for { if !(i < n) { break } p = _sqlite3VectorFieldSubexpr(tls, pRight, i) if libc.Int32FromUint8(_sqlite3CompareAffinity(tls, p, **(**uint8)(__ccgo_up(zAff + uintptr(i))))) == int32(SQLITE_AFF_BLOB) || _sqlite3ExprNeedsNoAffinityChange(tls, p, **(**uint8)(__ccgo_up(zAff + uintptr(i)))) != 0 { **(**uint8)(__ccgo_up(zAff + uintptr(i))) = uint8(SQLITE_AFF_BLOB) } goto _1 _1: ; i = i + 1 } } // C documentation // // /* // ** Implementation of the upper() and lower() SQL functions. // */ func _upperFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var i, n int32 var z1, z2 uintptr _, _, _, _ = i, n, z1, z2 _ = argc z2 = Xsqlite3_value_text(tls, **(**uintptr)(__ccgo_up(argv))) n = Xsqlite3_value_bytes(tls, **(**uintptr)(__ccgo_up(argv))) /* Verify that the call to _bytes() does not invalidate the _text() pointer */ if z2 != 0 { z1 = _contextMalloc(tls, context, int64(n)+int64(1)) if z1 != 0 { i = 0 for { if !(i < n) { break } **(**uint8)(__ccgo_up(z1 + uintptr(i))) = libc.Uint8FromInt32(libc.Int32FromUint8(**(**uint8)(__ccgo_up(z2 + uintptr(i)))) & ^(libc.Int32FromUint8(_sqlite3CtypeMap[uint8(**(**uint8)(__ccgo_up(z2 + uintptr(i))))]) & libc.Int32FromInt32(0x20))) goto _1 _1: ; i = i + 1 } Xsqlite3_result_text(tls, context, z1, n, __ccgo_fp(Xsqlite3_free)) } } } // C documentation // // /* // ** This routine does the core work of extracting URI parameters from a // ** database filename for the sqlite3_uri_parameter() interface. // */ func _uriParameter(tls *libc.TLS, zFilename uintptr, zParam uintptr) (r uintptr) { var x int32 _ = x zFilename = zFilename + uintptr(_sqlite3Strlen30(tls, zFilename)+int32(1)) for zFilename != uintptr(0) && **(**uint8)(__ccgo_up(zFilename)) != 0 { x = libc.Xstrcmp(tls, zFilename, zParam) zFilename = zFilename + uintptr(_sqlite3Strlen30(tls, zFilename)+int32(1)) if x == 0 { return zFilename } zFilename = zFilename + uintptr(_sqlite3Strlen30(tls, zFilename)+int32(1)) } return uintptr(0) } // C documentation // // /* // ** Write a 32-bit integer into the given file descriptor. Return SQLITE_OK // ** on success or an error code is something goes wrong. // */ func _write32bits(tls *libc.TLS, fd uintptr, offset Ti64, val Tu32) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) var _ /* ac at bp+0 */ [4]uint8 _sqlite3Put4byte(tls, bp, val) return _sqlite3OsWrite(tls, fd, bp, int32(4), offset) } var _zAff = [10]uint8{'B', 0, 'C', 0, 'D', 0, 'E', 0, 'F'} // C documentation // // /* // ** Page paths: // ** // ** The value of the 'path' column describes the path taken from the // ** root-node of the b-tree structure to each page. The value of the // ** root-node path is '/'. // ** // ** The value of the path for the left-most child page of the root of // ** a b-tree is '/000/'. (Btrees store content ordered from left to right // ** so the pages to the left have smaller keys than the pages to the right.) // ** The next to left-most child of the root page is // ** '/001', and so on, each sibling page identified by a 3-digit hex // ** value. The children of the 451st left-most sibling have paths such // ** as '/1c2/000/, '/1c2/001/' etc. // ** // ** Overflow pages are specified by appending a '+' character and a // ** six-digit hexadecimal value to the path to the cell they are linked // ** from. For example, the three overflow pages in a chain linked from // ** the left-most cell of the 450th child of the root page are identified // ** by the paths: // ** // ** '/1c2/000+000000' // First page in overflow chain // ** '/1c2/000+000001' // Second page in overflow chain // ** '/1c2/000+000002' // Third page in overflow chain // ** // ** If the paths are sorted using the BINARY collation sequence, then // ** the overflow pages associated with a cell will appear earlier in the // ** sort-order than its child page: // ** // ** '/1c2/000/' // Left-most child of 451st child of root // */ var _zDbstatSchema = [258]uint8{'C', 'R', 'E', 'A', 'T', 'E', ' ', 'T', 'A', 'B', 'L', 'E', ' ', 'x', '(', ' ', 'n', 'a', 'm', 'e', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'T', 'E', 'X', 'T', ',', ' ', 'p', 'a', 't', 'h', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'T', 'E', 'X', 'T', ',', ' ', 'p', 'a', 'g', 'e', 'n', 'o', ' ', ' ', ' ', ' ', ' ', 'I', 'N', 'T', 'E', 'G', 'E', 'R', ',', ' ', 'p', 'a', 'g', 'e', 't', 'y', 'p', 'e', ' ', ' ', ' ', 'T', 'E', 'X', 'T', ',', ' ', 'n', 'c', 'e', 'l', 'l', ' ', ' ', ' ', ' ', ' ', ' ', 'I', 'N', 'T', 'E', 'G', 'E', 'R', ',', ' ', 'p', 'a', 'y', 'l', 'o', 'a', 'd', ' ', ' ', ' ', ' ', 'I', 'N', 'T', 'E', 'G', 'E', 'R', ',', ' ', 'u', 'n', 'u', 's', 'e', 'd', ' ', ' ', ' ', ' ', ' ', 'I', 'N', 'T', 'E', 'G', 'E', 'R', ',', ' ', 'm', 'x', '_', 'p', 'a', 'y', 'l', 'o', 'a', 'd', ' ', 'I', 'N', 'T', 'E', 'G', 'E', 'R', ',', ' ', 'p', 'g', 'o', 'f', 'f', 's', 'e', 't', ' ', ' ', ' ', 'I', 'N', 'T', 'E', 'G', 'E', 'R', ',', ' ', 'p', 'g', 's', 'i', 'z', 'e', ' ', ' ', ' ', ' ', ' ', 'I', 'N', 'T', 'E', 'G', 'E', 'R', ',', ' ', 's', 'c', 'h', 'e', 'm', 'a', ' ', ' ', ' ', ' ', ' ', 'T', 'E', 'X', 'T', ' ', 'H', 'I', 'D', 'D', 'E', 'N', ',', ' ', 'a', 'g', 'g', 'r', 'e', 'g', 'a', 't', 'e', ' ', ' ', 'B', 'O', 'O', 'L', 'E', 'A', 'N', ' ', 'H', 'I', 'D', 'D', 'E', 'N', ')'} var _zFake = [8]uint8{} // C documentation // // /* // ** The sqlite3KeywordCode function looks up an identifier to determine if // ** it is a keyword. If it is a keyword, the token code of that keyword is // ** returned. If the input is not a keyword, TK_ID is returned. // ** // ** The implementation of this routine was generated by a program, // ** mkkeywordhash.c, located in the tool subdirectory of the distribution. // ** The output of the mkkeywordhash.c program is written into a file // ** named keywordhash.h and then included into this source file by // ** the #include below. // */ // /************** Include keywordhash.h in the middle of tokenize.c ************/ // /************** Begin file keywordhash.h *************************************/ // /***** This file contains automatically generated code ****** // ** // ** The code in this file has been automatically generated by // ** // ** sqlite/tool/mkkeywordhash.c // ** // ** The code in this file implements a function that determines whether // ** or not a given identifier is really an SQL keyword. The same thing // ** might be implemented more directly using a hand-written hash table. // ** But by using this automatically generated code, the size of the code // ** is substantially reduced. This is important for embedded applications // ** on platforms with limited memory. // */ // /* Hash score: 231 */ // /* zKWText[] encodes 1007 bytes of keyword text in 667 bytes */ // /* REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT */ // /* ABLEFTHENDEFERRABLELSEXCLUDELETEMPORARYISNULLSAVEPOINTERSECT */ // /* IESNOTNULLIKEXCEPTRANSACTIONATURALTERAISEXCLUSIVEXISTS */ // /* CONSTRAINTOFFSETRIGGERANGENERATEDETACHAVINGLOBEGINNEREFERENCES */ // /* UNIQUERYWITHOUTERELEASEATTACHBETWEENOTHINGROUPSCASCADEFAULT */ // /* CASECOLLATECREATECURRENT_DATEIMMEDIATEJOINSERTMATCHPLANALYZE */ // /* PRAGMATERIALIZEDEFERREDISTINCTUPDATEVALUESVIRTUALWAYSWHENWHERE */ // /* CURSIVEABORTAFTERENAMEANDROPARTITIONAUTOINCREMENTCASTCOLUMN */ // /* COMMITCONFLICTCROSSCURRENT_TIMESTAMPRECEDINGFAILASTFILTER */ // /* EPLACEFIRSTFOLLOWINGFROMFULLIMITIFORDERESTRICTOTHERSOVER */ // /* ETURNINGRIGHTROLLBACKROWSUNBOUNDEDUNIONUSINGVACUUMVIEWINDOWBY */ // /* INITIALLYPRIMARY */ var _zKWText = [666]uint8{ 0: uint8('R'), 1: uint8('E'), 2: uint8('I'), 3: uint8('N'), 4: uint8('D'), 5: uint8('E'), 6: uint8('X'), 7: uint8('E'), 8: uint8('D'), 9: uint8('E'), 10: uint8('S'), 11: uint8('C'), 12: uint8('A'), 13: uint8('P'), 14: uint8('E'), 15: uint8('A'), 16: uint8('C'), 17: uint8('H'), 18: uint8('E'), 19: uint8('C'), 20: uint8('K'), 21: uint8('E'), 22: uint8('Y'), 23: uint8('B'), 24: uint8('E'), 25: uint8('F'), 26: uint8('O'), 27: uint8('R'), 28: uint8('E'), 29: uint8('I'), 30: uint8('G'), 31: uint8('N'), 32: uint8('O'), 33: uint8('R'), 34: uint8('E'), 35: uint8('G'), 36: uint8('E'), 37: uint8('X'), 38: uint8('P'), 39: uint8('L'), 40: uint8('A'), 41: uint8('I'), 42: uint8('N'), 43: uint8('S'), 44: uint8('T'), 45: uint8('E'), 46: uint8('A'), 47: uint8('D'), 48: uint8('D'), 49: uint8('A'), 50: uint8('T'), 51: uint8('A'), 52: uint8('B'), 53: uint8('A'), 54: uint8('S'), 55: uint8('E'), 56: uint8('L'), 57: uint8('E'), 58: uint8('C'), 59: uint8('T'), 60: uint8('A'), 61: uint8('B'), 62: uint8('L'), 63: uint8('E'), 64: uint8('F'), 65: uint8('T'), 66: uint8('H'), 67: uint8('E'), 68: uint8('N'), 69: uint8('D'), 70: uint8('E'), 71: uint8('F'), 72: uint8('E'), 73: uint8('R'), 74: uint8('R'), 75: uint8('A'), 76: uint8('B'), 77: uint8('L'), 78: uint8('E'), 79: uint8('L'), 80: uint8('S'), 81: uint8('E'), 82: uint8('X'), 83: uint8('C'), 84: uint8('L'), 85: uint8('U'), 86: uint8('D'), 87: uint8('E'), 88: uint8('L'), 89: uint8('E'), 90: uint8('T'), 91: uint8('E'), 92: uint8('M'), 93: uint8('P'), 94: uint8('O'), 95: uint8('R'), 96: uint8('A'), 97: uint8('R'), 98: uint8('Y'), 99: uint8('I'), 100: uint8('S'), 101: uint8('N'), 102: uint8('U'), 103: uint8('L'), 104: uint8('L'), 105: uint8('S'), 106: uint8('A'), 107: uint8('V'), 108: uint8('E'), 109: uint8('P'), 110: uint8('O'), 111: uint8('I'), 112: uint8('N'), 113: uint8('T'), 114: uint8('E'), 115: uint8('R'), 116: uint8('S'), 117: uint8('E'), 118: uint8('C'), 119: uint8('T'), 120: uint8('I'), 121: uint8('E'), 122: uint8('S'), 123: uint8('N'), 124: uint8('O'), 125: uint8('T'), 126: uint8('N'), 127: uint8('U'), 128: uint8('L'), 129: uint8('L'), 130: uint8('I'), 131: uint8('K'), 132: uint8('E'), 133: uint8('X'), 134: uint8('C'), 135: uint8('E'), 136: uint8('P'), 137: uint8('T'), 138: uint8('R'), 139: uint8('A'), 140: uint8('N'), 141: uint8('S'), 142: uint8('A'), 143: uint8('C'), 144: uint8('T'), 145: uint8('I'), 146: uint8('O'), 147: uint8('N'), 148: uint8('A'), 149: uint8('T'), 150: uint8('U'), 151: uint8('R'), 152: uint8('A'), 153: uint8('L'), 154: uint8('T'), 155: uint8('E'), 156: uint8('R'), 157: uint8('A'), 158: uint8('I'), 159: uint8('S'), 160: uint8('E'), 161: uint8('X'), 162: uint8('C'), 163: uint8('L'), 164: uint8('U'), 165: uint8('S'), 166: uint8('I'), 167: uint8('V'), 168: uint8('E'), 169: uint8('X'), 170: uint8('I'), 171: uint8('S'), 172: uint8('T'), 173: uint8('S'), 174: uint8('C'), 175: uint8('O'), 176: uint8('N'), 177: uint8('S'), 178: uint8('T'), 179: uint8('R'), 180: uint8('A'), 181: uint8('I'), 182: uint8('N'), 183: uint8('T'), 184: uint8('O'), 185: uint8('F'), 186: uint8('F'), 187: uint8('S'), 188: uint8('E'), 189: uint8('T'), 190: uint8('R'), 191: uint8('I'), 192: uint8('G'), 193: uint8('G'), 194: uint8('E'), 195: uint8('R'), 196: uint8('A'), 197: uint8('N'), 198: uint8('G'), 199: uint8('E'), 200: uint8('N'), 201: uint8('E'), 202: uint8('R'), 203: uint8('A'), 204: uint8('T'), 205: uint8('E'), 206: uint8('D'), 207: uint8('E'), 208: uint8('T'), 209: uint8('A'), 210: uint8('C'), 211: uint8('H'), 212: uint8('A'), 213: uint8('V'), 214: uint8('I'), 215: uint8('N'), 216: uint8('G'), 217: uint8('L'), 218: uint8('O'), 219: uint8('B'), 220: uint8('E'), 221: uint8('G'), 222: uint8('I'), 223: uint8('N'), 224: uint8('N'), 225: uint8('E'), 226: uint8('R'), 227: uint8('E'), 228: uint8('F'), 229: uint8('E'), 230: uint8('R'), 231: uint8('E'), 232: uint8('N'), 233: uint8('C'), 234: uint8('E'), 235: uint8('S'), 236: uint8('U'), 237: uint8('N'), 238: uint8('I'), 239: uint8('Q'), 240: uint8('U'), 241: uint8('E'), 242: uint8('R'), 243: uint8('Y'), 244: uint8('W'), 245: uint8('I'), 246: uint8('T'), 247: uint8('H'), 248: uint8('O'), 249: uint8('U'), 250: uint8('T'), 251: uint8('E'), 252: uint8('R'), 253: uint8('E'), 254: uint8('L'), 255: uint8('E'), 256: uint8('A'), 257: uint8('S'), 258: uint8('E'), 259: uint8('A'), 260: uint8('T'), 261: uint8('T'), 262: uint8('A'), 263: uint8('C'), 264: uint8('H'), 265: uint8('B'), 266: uint8('E'), 267: uint8('T'), 268: uint8('W'), 269: uint8('E'), 270: uint8('E'), 271: uint8('N'), 272: uint8('O'), 273: uint8('T'), 274: uint8('H'), 275: uint8('I'), 276: uint8('N'), 277: uint8('G'), 278: uint8('R'), 279: uint8('O'), 280: uint8('U'), 281: uint8('P'), 282: uint8('S'), 283: uint8('C'), 284: uint8('A'), 285: uint8('S'), 286: uint8('C'), 287: uint8('A'), 288: uint8('D'), 289: uint8('E'), 290: uint8('F'), 291: uint8('A'), 292: uint8('U'), 293: uint8('L'), 294: uint8('T'), 295: uint8('C'), 296: uint8('A'), 297: uint8('S'), 298: uint8('E'), 299: uint8('C'), 300: uint8('O'), 301: uint8('L'), 302: uint8('L'), 303: uint8('A'), 304: uint8('T'), 305: uint8('E'), 306: uint8('C'), 307: uint8('R'), 308: uint8('E'), 309: uint8('A'), 310: uint8('T'), 311: uint8('E'), 312: uint8('C'), 313: uint8('U'), 314: uint8('R'), 315: uint8('R'), 316: uint8('E'), 317: uint8('N'), 318: uint8('T'), 319: uint8('_'), 320: uint8('D'), 321: uint8('A'), 322: uint8('T'), 323: uint8('E'), 324: uint8('I'), 325: uint8('M'), 326: uint8('M'), 327: uint8('E'), 328: uint8('D'), 329: uint8('I'), 330: uint8('A'), 331: uint8('T'), 332: uint8('E'), 333: uint8('J'), 334: uint8('O'), 335: uint8('I'), 336: uint8('N'), 337: uint8('S'), 338: uint8('E'), 339: uint8('R'), 340: uint8('T'), 341: uint8('M'), 342: uint8('A'), 343: uint8('T'), 344: uint8('C'), 345: uint8('H'), 346: uint8('P'), 347: uint8('L'), 348: uint8('A'), 349: uint8('N'), 350: uint8('A'), 351: uint8('L'), 352: uint8('Y'), 353: uint8('Z'), 354: uint8('E'), 355: uint8('P'), 356: uint8('R'), 357: uint8('A'), 358: uint8('G'), 359: uint8('M'), 360: uint8('A'), 361: uint8('T'), 362: uint8('E'), 363: uint8('R'), 364: uint8('I'), 365: uint8('A'), 366: uint8('L'), 367: uint8('I'), 368: uint8('Z'), 369: uint8('E'), 370: uint8('D'), 371: uint8('E'), 372: uint8('F'), 373: uint8('E'), 374: uint8('R'), 375: uint8('R'), 376: uint8('E'), 377: uint8('D'), 378: uint8('I'), 379: uint8('S'), 380: uint8('T'), 381: uint8('I'), 382: uint8('N'), 383: uint8('C'), 384: uint8('T'), 385: uint8('U'), 386: uint8('P'), 387: uint8('D'), 388: uint8('A'), 389: uint8('T'), 390: uint8('E'), 391: uint8('V'), 392: uint8('A'), 393: uint8('L'), 394: uint8('U'), 395: uint8('E'), 396: uint8('S'), 397: uint8('V'), 398: uint8('I'), 399: uint8('R'), 400: uint8('T'), 401: uint8('U'), 402: uint8('A'), 403: uint8('L'), 404: uint8('W'), 405: uint8('A'), 406: uint8('Y'), 407: uint8('S'), 408: uint8('W'), 409: uint8('H'), 410: uint8('E'), 411: uint8('N'), 412: uint8('W'), 413: uint8('H'), 414: uint8('E'), 415: uint8('R'), 416: uint8('E'), 417: uint8('C'), 418: uint8('U'), 419: uint8('R'), 420: uint8('S'), 421: uint8('I'), 422: uint8('V'), 423: uint8('E'), 424: uint8('A'), 425: uint8('B'), 426: uint8('O'), 427: uint8('R'), 428: uint8('T'), 429: uint8('A'), 430: uint8('F'), 431: uint8('T'), 432: uint8('E'), 433: uint8('R'), 434: uint8('E'), 435: uint8('N'), 436: uint8('A'), 437: uint8('M'), 438: uint8('E'), 439: uint8('A'), 440: uint8('N'), 441: uint8('D'), 442: uint8('R'), 443: uint8('O'), 444: uint8('P'), 445: uint8('A'), 446: uint8('R'), 447: uint8('T'), 448: uint8('I'), 449: uint8('T'), 450: uint8('I'), 451: uint8('O'), 452: uint8('N'), 453: uint8('A'), 454: uint8('U'), 455: uint8('T'), 456: uint8('O'), 457: uint8('I'), 458: uint8('N'), 459: uint8('C'), 460: uint8('R'), 461: uint8('E'), 462: uint8('M'), 463: uint8('E'), 464: uint8('N'), 465: uint8('T'), 466: uint8('C'), 467: uint8('A'), 468: uint8('S'), 469: uint8('T'), 470: uint8('C'), 471: uint8('O'), 472: uint8('L'), 473: uint8('U'), 474: uint8('M'), 475: uint8('N'), 476: uint8('C'), 477: uint8('O'), 478: uint8('M'), 479: uint8('M'), 480: uint8('I'), 481: uint8('T'), 482: uint8('C'), 483: uint8('O'), 484: uint8('N'), 485: uint8('F'), 486: uint8('L'), 487: uint8('I'), 488: uint8('C'), 489: uint8('T'), 490: uint8('C'), 491: uint8('R'), 492: uint8('O'), 493: uint8('S'), 494: uint8('S'), 495: uint8('C'), 496: uint8('U'), 497: uint8('R'), 498: uint8('R'), 499: uint8('E'), 500: uint8('N'), 501: uint8('T'), 502: uint8('_'), 503: uint8('T'), 504: uint8('I'), 505: uint8('M'), 506: uint8('E'), 507: uint8('S'), 508: uint8('T'), 509: uint8('A'), 510: uint8('M'), 511: uint8('P'), 512: uint8('R'), 513: uint8('E'), 514: uint8('C'), 515: uint8('E'), 516: uint8('D'), 517: uint8('I'), 518: uint8('N'), 519: uint8('G'), 520: uint8('F'), 521: uint8('A'), 522: uint8('I'), 523: uint8('L'), 524: uint8('A'), 525: uint8('S'), 526: uint8('T'), 527: uint8('F'), 528: uint8('I'), 529: uint8('L'), 530: uint8('T'), 531: uint8('E'), 532: uint8('R'), 533: uint8('E'), 534: uint8('P'), 535: uint8('L'), 536: uint8('A'), 537: uint8('C'), 538: uint8('E'), 539: uint8('F'), 540: uint8('I'), 541: uint8('R'), 542: uint8('S'), 543: uint8('T'), 544: uint8('F'), 545: uint8('O'), 546: uint8('L'), 547: uint8('L'), 548: uint8('O'), 549: uint8('W'), 550: uint8('I'), 551: uint8('N'), 552: uint8('G'), 553: uint8('F'), 554: uint8('R'), 555: uint8('O'), 556: uint8('M'), 557: uint8('F'), 558: uint8('U'), 559: uint8('L'), 560: uint8('L'), 561: uint8('I'), 562: uint8('M'), 563: uint8('I'), 564: uint8('T'), 565: uint8('I'), 566: uint8('F'), 567: uint8('O'), 568: uint8('R'), 569: uint8('D'), 570: uint8('E'), 571: uint8('R'), 572: uint8('E'), 573: uint8('S'), 574: uint8('T'), 575: uint8('R'), 576: uint8('I'), 577: uint8('C'), 578: uint8('T'), 579: uint8('O'), 580: uint8('T'), 581: uint8('H'), 582: uint8('E'), 583: uint8('R'), 584: uint8('S'), 585: uint8('O'), 586: uint8('V'), 587: uint8('E'), 588: uint8('R'), 589: uint8('E'), 590: uint8('T'), 591: uint8('U'), 592: uint8('R'), 593: uint8('N'), 594: uint8('I'), 595: uint8('N'), 596: uint8('G'), 597: uint8('R'), 598: uint8('I'), 599: uint8('G'), 600: uint8('H'), 601: uint8('T'), 602: uint8('R'), 603: uint8('O'), 604: uint8('L'), 605: uint8('L'), 606: uint8('B'), 607: uint8('A'), 608: uint8('C'), 609: uint8('K'), 610: uint8('R'), 611: uint8('O'), 612: uint8('W'), 613: uint8('S'), 614: uint8('U'), 615: uint8('N'), 616: uint8('B'), 617: uint8('O'), 618: uint8('U'), 619: uint8('N'), 620: uint8('D'), 621: uint8('E'), 622: uint8('D'), 623: uint8('U'), 624: uint8('N'), 625: uint8('I'), 626: uint8('O'), 627: uint8('N'), 628: uint8('U'), 629: uint8('S'), 630: uint8('I'), 631: uint8('N'), 632: uint8('G'), 633: uint8('V'), 634: uint8('A'), 635: uint8('C'), 636: uint8('U'), 637: uint8('U'), 638: uint8('M'), 639: uint8('V'), 640: uint8('I'), 641: uint8('E'), 642: uint8('W'), 643: uint8('I'), 644: uint8('N'), 645: uint8('D'), 646: uint8('O'), 647: uint8('W'), 648: uint8('B'), 649: uint8('Y'), 650: uint8('I'), 651: uint8('N'), 652: uint8('I'), 653: uint8('T'), 654: uint8('I'), 655: uint8('A'), 656: uint8('L'), 657: uint8('L'), 658: uint8('Y'), 659: uint8('P'), 660: uint8('R'), 661: uint8('I'), 662: uint8('M'), 663: uint8('A'), 664: uint8('R'), 665: uint8('Y'), } /* 0123456789 123456789 123456789 123 */ var _zKeyText = [34]uint8{'n', 'a', 't', 'u', 'r', 'a', 'l', 'e', 'f', 't', 'o', 'u', 't', 'e', 'r', 'i', 'g', 'h', 't', 'f', 'u', 'l', 'l', 'i', 'n', 'n', 'e', 'r', 'c', 'r', 'o', 's', 's'} // C documentation // // /* // ** The header string that appears at the beginning of every // ** SQLite database. // */ var _zMagicHeader = [16]uint8{'S', 'Q', 'L', 'i', 't', 'e', ' ', 'f', 'o', 'r', 'm', 'a', 't', ' ', '3'} /* ** Set this global variable to 1 to enable tracing using the TRACE ** macro. */ /* ** Extract a 2-byte big-endian integer from an array of unsigned bytes. ** But if the value is zero, make it 65536. ** ** This routine is used to extract the "offset to cell content area" value ** from the header of a btree page. If the page size is 65536 and the page ** is empty, the offset should be 65536, but the 2-byte value stores zero. ** This routine makes the necessary adjustment to 65536. */ /* ** Values passed as the 5th argument to allocateBtreePage() */ /* ** Macro IfNotOmitAV(x) returns (x) if SQLITE_OMIT_AUTOVACUUM is not ** defined, or 0 if it is. For example: ** ** bIncrVacuum = IfNotOmitAV(pBtShared->incrVacuum); */ var _zOrd = [9]uint8{'t', 'h', 's', 't', 'n', 'd', 'r', 'd'} /* End of function */ /* 123456789 123456789 123 */ var _zText = [25]uint8{'o', 'n', 'o', 'f', 'f', 'a', 'l', 's', 'e', 'y', 'e', 's', 't', 'r', 'u', 'e', 'x', 't', 'r', 'a', 'f', 'u', 'l', 'l'} var _zeroHdr = [28]uint8{}