// Code generated by modernc.org/undup from the per-target sqlite_*.go files; DO NOT EDIT. //go:build (darwin && amd64) || (darwin && arm64) || (freebsd && 386) || (freebsd && amd64) || (linux && 386) || (linux && amd64) || (linux && loong64) || (netbsd && amd64) || (openbsd && amd64) || (windows && (amd64 || arm64)) || (windows && 386) 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]int8 } type TFpDecode = struct { Fn int32 FiDP int32 Fz uintptr FzBuf [21]int8 Fsign int8 FisSpecial int8 } // C documentation // // /* // ** Extra floating-point literals to allow in JSON. // */ type TNanInfName = struct { Fc1 int8 Fc2 int8 Fn int8 FeType int8 FnRepl int8 FzMatch uintptr FzRepl uintptr } type TPorterTokenizer = struct { Ftokenizer_v2 Tfts5_tokenizer_v2 FpTokenizer uintptr FaBuf [128]int8 } type TReturning = struct { FpParse uintptr FpReturnEL uintptr FretTrig TTrigger FretTStep TTriggerStep FiRetCur int32 FnRetCol int32 FiRetReg int32 FzName [40]int8 } type TWhereScan = struct { FpOrigWC uintptr FpWC uintptr FzCollName uintptr FpIdxExpr uintptr Fk int32 FopMask Tu32 Fidxaff int8 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 int8 Fbase TetByte Fflags TetByte Ftype1 TetByte Fcharset TetByte Fprefix TetByte FiNxt int8 } 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 && **(**int8)(__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 **(**int8)(__ccgo_up(zBuf + uintptr((**(**TStrAccum)(__ccgo_up(bp))).FnChar))) = 0 return zBuf } /* Maximum size of an sqlite3_log() message. */ // 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) } **(**int8)(__ccgo_up((*Tsqlite3_str)(unsafe.Pointer(p)).FzText + uintptr((*Tsqlite3_str)(unsafe.Pointer(p)).FnChar))) = 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 && **(**int8)(__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 **(**int8)(__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]int8{'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) **(**int8)(__ccgo_up(zBuf + uintptr((**(**TStrAccum)(__ccgo_up(bp))).FnChar))) = 0 return zBuf } var _aDigits = [33]int8{'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]int8{'-', 'x', '0', 0, 'X', '0'} var _aSpecial = [32]int8{ 8: int8('b'), 9: int8('t'), 10: int8('n'), 12: int8('f'), 13: int8('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]int8 FrLimit float32 FrXform float32 }{ 0: { FnName: uint8(6), FzName: [7]int8{'s', 'e', 'c', 'o', 'n', 'd'}, FrLimit: float32(4.6427e+14), FrXform: float32(1), }, 1: { FnName: uint8(6), FzName: [7]int8{'m', 'i', 'n', 'u', 't', 'e'}, FrLimit: float32(7.7379e+12), FrXform: float32(60), }, 2: { FnName: uint8(4), FzName: [7]int8{'h', 'o', 'u', 'r'}, FrLimit: float32(1.2897e+11), FrXform: float32(3600), }, 3: { FnName: uint8(3), FzName: [7]int8{'d', 'a', 'y'}, FrLimit: float32(5.373485e+06), FrXform: float32(86400), }, 4: { FnName: uint8(5), FzName: [7]int8{'m', 'o', 'n', 't', 'h'}, FrLimit: float32(176546), FrXform: float32(2.592e+06), }, 5: { FnName: uint8(4), FzName: [7]int8{'y', 'e', 'a', 'r'}, FrLimit: float32(14713), FrXform: float32(3.1536e+07), }, } func _asciiFold(tls *libc.TLS, aOut uintptr, aIn uintptr, nByte int32) { var c int8 var i int32 _, _ = c, i i = 0 for { if !(i < nByte) { break } c = **(**int8)(__ccgo_up(aIn + uintptr(i))) if int32(c) >= int32('A') && int32(c) <= int32('Z') { c = int8(int32(c) + libc.Int32FromInt32(32)) } **(**int8)(__ccgo_up(aOut + uintptr(i))) = c goto _1 _1: ; i = i + 1 } } // C documentation // // /* // ** If the DateTime p is raw number, try to figure out if it is // ** a julian day number of a unix timestamp. Set the p value // ** appropriately. // */ func _autoAdjustDate(tls *libc.TLS, p uintptr) { var r float64 _ = r if !(int32(uint32(*(*uint8)(unsafe.Pointer(p + 44))&0x1>>0)) != 0) || (*TDateTime)(unsafe.Pointer(p)).FvalidJD != 0 { libc.SetBitFieldPtr8Uint32(p+44, libc.Uint32FromInt32(0), 0, 0x1) } else { if (*TDateTime)(unsafe.Pointer(p)).Fs >= float64(int64(-libc.Int32FromInt32(21086676))*libc.Int64FromInt32(10000)) && (*TDateTime)(unsafe.Pointer(p)).Fs <= float64(libc.Int64FromInt32(25340230)*libc.Int64FromInt32(10000)+libc.Int64FromInt32(799)) { r = float64((*TDateTime)(unsafe.Pointer(p)).Fs*float64(1000)) + float64(2.1086676e+14) _clearYMD_HMS_TZ(tls, p) (*TDateTime)(unsafe.Pointer(p)).FiJD = int64(r + libc.Float64FromFloat64(0.5)) (*TDateTime)(unsafe.Pointer(p)).FvalidJD = int8(1) libc.SetBitFieldPtr8Uint32(p+44, libc.Uint32FromInt32(0), 0, 0x1) } } } // C documentation // // /* // ** Clear the YMD and HMS and the TZ // */ func _clearYMD_HMS_TZ(tls *libc.TLS, p uintptr) { (*TDateTime)(unsafe.Pointer(p)).FvalidYMD = 0 (*TDateTime)(unsafe.Pointer(p)).FvalidHMS = 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 && int32(**(**int8)(__ccgo_up(zAff))) <= int32(SQLITE_AFF_BLOB) { n = n - 1 base = base + 1 zAff = zAff + 1 } for n > int32(1) && int32(**(**int8)(__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 = 0 } else { if int32(1)<<(*TDateTime)(unsafe.Pointer(p)).FM&int32(0x15aa) != 0 { (*TDateTime)(unsafe.Pointer(p)).FnFloor = 0 } else { if (*TDateTime)(unsafe.Pointer(p)).FM != int32(2) { (*TDateTime)(unsafe.Pointer(p)).FnFloor = libc.BoolInt8((*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 = int8((*TDateTime)(unsafe.Pointer(p)).FD - int32(28)) } else { (*TDateTime)(unsafe.Pointer(p)).FnFloor = int8((*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 = int8(1) } // C documentation // // /* // ** Convert from YYYY-MM-DD HH:MM:SS to julian day. We always assume // ** that the YYYY-MM-DD is according to the Gregorian calendar. // ** // ** Reference: Meeus page 61 // */ func _computeJD(tls *libc.TLS, p uintptr) { var A, B, D, M, X1, X2, Y int32 _, _, _, _, _, _, _ = A, B, D, M, X1, X2, Y if (*TDateTime)(unsafe.Pointer(p)).FvalidJD != 0 { return } if (*TDateTime)(unsafe.Pointer(p)).FvalidYMD != 0 { Y = (*TDateTime)(unsafe.Pointer(p)).FY M = (*TDateTime)(unsafe.Pointer(p)).FM D = (*TDateTime)(unsafe.Pointer(p)).FD } else { Y = int32(2000) /* If no YMD specified, assume 2000-Jan-01 */ M = int32(1) D = int32(1) } if Y < -int32(4713) || Y > int32(9999) || int32(uint32(*(*uint8)(unsafe.Pointer(p + 44))&0x1>>0)) != 0 { _datetimeError(tls, p) return } if M <= int32(2) { Y = Y - 1 M = M + int32(12) } A = (Y + int32(4800)) / int32(100) B = int32(38) - A + A/int32(4) X1 = int32(36525) * (Y + int32(4716)) / int32(100) X2 = int32(306001) * (M + int32(1)) / int32(10000) (*TDateTime)(unsafe.Pointer(p)).FiJD = int64(float64((float64(X1+X2+D+B) - libc.Float64FromFloat64(1524.5)) * libc.Float64FromInt32(86400000))) (*TDateTime)(unsafe.Pointer(p)).FvalidJD = int8(1) if (*TDateTime)(unsafe.Pointer(p)).FvalidHMS != 0 { **(**Tsqlite3_int64)(__ccgo_up(p)) += int64((*TDateTime)(unsafe.Pointer(p)).Fh*int32(3600000)+(*TDateTime)(unsafe.Pointer(p)).Fm*int32(60000)) + int64(float64((*TDateTime)(unsafe.Pointer(p)).Fs*libc.Float64FromInt32(1000))+libc.Float64FromFloat64(0.5)) if (*TDateTime)(unsafe.Pointer(p)).Ftz != 0 { **(**Tsqlite3_int64)(__ccgo_up(p)) -= int64((*TDateTime)(unsafe.Pointer(p)).Ftz * int32(60000)) (*TDateTime)(unsafe.Pointer(p)).FvalidYMD = 0 (*TDateTime)(unsafe.Pointer(p)).FvalidHMS = 0 (*TDateTime)(unsafe.Pointer(p)).Ftz = 0 libc.SetBitFieldPtr8Uint32(p+44, libc.Uint32FromInt32(1), 3, 0x8) libc.SetBitFieldPtr8Uint32(p+44, libc.Uint32FromInt32(0), 4, 0x10) } } } // C documentation // // /* // ** Compute the Year, Month, and Day from the julian day number. // */ func _computeYMD(tls *libc.TLS, p uintptr) { var A, B, C, D, E, X1, Z, alpha, v1 int32 _, _, _, _, _, _, _, _, _ = A, B, C, D, E, X1, Z, alpha, v1 if (*TDateTime)(unsafe.Pointer(p)).FvalidYMD != 0 { return } if !((*TDateTime)(unsafe.Pointer(p)).FvalidJD != 0) { (*TDateTime)(unsafe.Pointer(p)).FY = int32(2000) (*TDateTime)(unsafe.Pointer(p)).FM = int32(1) (*TDateTime)(unsafe.Pointer(p)).FD = int32(1) } else { if !(_validJulianDay(tls, (*TDateTime)(unsafe.Pointer(p)).FiJD) != 0) { _datetimeError(tls, p) return } else { Z = int32(((*TDateTime)(unsafe.Pointer(p)).FiJD + libc.Int64FromInt32(43200000)) / libc.Int64FromInt32(86400000)) alpha = int32((float64(Z)+libc.Float64FromFloat64(32044.75))/libc.Float64FromFloat64(36524.25)) - int32(52) A = Z + int32(1) + alpha - (alpha+int32(100))/int32(4) + int32(25) B = A + int32(1524) C = int32((float64(B) - libc.Float64FromFloat64(122.1)) / libc.Float64FromFloat64(365.25)) D = int32(36525) * (C & int32(32767)) / int32(100) E = int32(float64(B-D) / libc.Float64FromFloat64(30.6001)) X1 = int32(float64(libc.Float64FromFloat64(30.6001) * float64(E))) (*TDateTime)(unsafe.Pointer(p)).FD = B - D - X1 if E < int32(14) { v1 = E - int32(1) } else { v1 = E - int32(13) } (*TDateTime)(unsafe.Pointer(p)).FM = v1 if (*TDateTime)(unsafe.Pointer(p)).FM > int32(2) { v1 = C - int32(4716) } else { v1 = C - int32(4715) } (*TDateTime)(unsafe.Pointer(p)).FY = v1 } } (*TDateTime)(unsafe.Pointer(p)).FvalidYMD = int8(1) } var _cume_distName = [10]int8{'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 int32(**(**int8)(__ccgo_up(zName + uintptr(-libc.Int32FromInt32(1))))) != 0 || int32(**(**int8)(__ccgo_up(zName + uintptr(-libc.Int32FromInt32(2))))) != 0 || int32(**(**int8)(__ccgo_up(zName + uintptr(-libc.Int32FromInt32(3))))) != 0 || int32(**(**int8)(__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]int8 _ = Y if _isDate(tls, context, argc, argv, bp) == 0 { _computeYMD(tls, bp) Y = (**(**TDateTime)(__ccgo_up(bp))).FY if Y < 0 { Y = -Y } (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(1)] = int8(int32('0') + Y/int32(1000)%int32(10)) (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(2)] = int8(int32('0') + Y/int32(100)%int32(10)) (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(3)] = int8(int32('0') + Y/int32(10)%int32(10)) (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(4)] = int8(int32('0') + Y%int32(10)) (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(5)] = int8('-') (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(6)] = int8(int32('0') + (**(**TDateTime)(__ccgo_up(bp))).FM/int32(10)%int32(10)) (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(7)] = int8(int32('0') + (**(**TDateTime)(__ccgo_up(bp))).FM%int32(10)) (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(8)] = int8('-') (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(9)] = int8(int32('0') + (**(**TDateTime)(__ccgo_up(bp))).FD/int32(10)%int32(10)) (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(10)] = int8(int32('0') + (**(**TDateTime)(__ccgo_up(bp))).FD%int32(10)) (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(11)] = 0 if (**(**TDateTime)(__ccgo_up(bp))).FY < 0 { (**(**[16]int8)(__ccgo_up(bp + 48)))[0] = int8('-') 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 // // /* // ** datetime( TIMESTRING, MOD, MOD, ...) // ** // ** Return YYYY-MM-DD HH:MM:SS // */ func _datetimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { bp := tls.Alloc(80) defer tls.Free(80) var Y, n, s int32 var _ /* x at bp+0 */ TDateTime var _ /* zBuf at bp+48 */ [32]int8 _, _, _ = Y, n, s if _isDate(tls, context, argc, argv, bp) == 0 { _computeYMD_HMS(tls, bp) Y = (**(**TDateTime)(__ccgo_up(bp))).FY if Y < 0 { Y = -Y } (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(1)] = int8(int32('0') + Y/int32(1000)%int32(10)) (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(2)] = int8(int32('0') + Y/int32(100)%int32(10)) (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(3)] = int8(int32('0') + Y/int32(10)%int32(10)) (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(4)] = int8(int32('0') + Y%int32(10)) (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(5)] = int8('-') (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(6)] = int8(int32('0') + (**(**TDateTime)(__ccgo_up(bp))).FM/int32(10)%int32(10)) (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(7)] = int8(int32('0') + (**(**TDateTime)(__ccgo_up(bp))).FM%int32(10)) (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(8)] = int8('-') (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(9)] = int8(int32('0') + (**(**TDateTime)(__ccgo_up(bp))).FD/int32(10)%int32(10)) (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(10)] = int8(int32('0') + (**(**TDateTime)(__ccgo_up(bp))).FD%int32(10)) (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(11)] = int8(' ') (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(12)] = int8(int32('0') + (**(**TDateTime)(__ccgo_up(bp))).Fh/int32(10)%int32(10)) (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(13)] = int8(int32('0') + (**(**TDateTime)(__ccgo_up(bp))).Fh%int32(10)) (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(14)] = int8(':') (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(15)] = int8(int32('0') + (**(**TDateTime)(__ccgo_up(bp))).Fm/int32(10)%int32(10)) (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(16)] = int8(int32('0') + (**(**TDateTime)(__ccgo_up(bp))).Fm%int32(10)) (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(17)] = int8(':') if int32(uint32(*(*uint8)(unsafe.Pointer(bp + 44))&0x4>>2)) != 0 { s = int32(float64(libc.Float64FromFloat64(1000)*(**(**TDateTime)(__ccgo_up(bp))).Fs) + libc.Float64FromFloat64(0.5)) (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(18)] = int8(int32('0') + s/int32(10000)%int32(10)) (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(19)] = int8(int32('0') + s/int32(1000)%int32(10)) (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(20)] = int8('.') (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(21)] = int8(int32('0') + s/int32(100)%int32(10)) (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(22)] = int8(int32('0') + s/int32(10)%int32(10)) (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(23)] = int8(int32('0') + s%int32(10)) (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(24)] = 0 n = int32(24) } else { s = int32((**(**TDateTime)(__ccgo_up(bp))).Fs) (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(18)] = int8(int32('0') + s/int32(10)%int32(10)) (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(19)] = int8(int32('0') + s%int32(10)) (**(**[32]int8)(__ccgo_up(bp + 48)))[int32(20)] = 0 n = int32(20) } if (**(**TDateTime)(__ccgo_up(bp))).FY < 0 { (**(**[32]int8)(__ccgo_up(bp + 48)))[0] = int8('-') Xsqlite3_result_text(tls, context, bp+48, n, uintptr(-libc.Int32FromInt32(1))) } else { Xsqlite3_result_text(tls, context, bp+48+1, n-int32(1), 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 = 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]int8{'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 **(**int8)(__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]int8{'f', 'i', 'r', 's', 't', '_', 'v', 'a', 'l', 'u', 'e'} var _fmtinfo = [23]Tet_info{ 0: { Ffmttype: int8('s'), Fflags: uint8(4), Ftype1: uint8(etSTRING), FiNxt: int8(1), }, 1: { Ffmttype: int8('E'), Fflags: uint8(1), Ftype1: uint8(etEXP), Fcharset: uint8(14), }, 2: { Ffmttype: int8('u'), Fbase: uint8(10), Ftype1: uint8(etDECIMAL), FiNxt: int8(3), }, 3: { Ffmttype: int8('G'), Fflags: uint8(1), Ftype1: uint8(etGENERIC), Fcharset: uint8(14), }, 4: { Ffmttype: int8('w'), Fflags: uint8(4), Ftype1: uint8(etESCAPE_w), }, 5: { Ffmttype: int8('x'), Fbase: uint8(16), Fcharset: uint8(16), Fprefix: uint8(1), }, 6: { Ffmttype: int8('c'), Ftype1: uint8(etCHARX), }, 7: { Ffmttype: int8('z'), Fflags: uint8(4), Ftype1: uint8(etDYNSTRING), FiNxt: int8(6), }, 8: { Ffmttype: int8('d'), Fbase: uint8(10), Fflags: uint8(1), Ftype1: uint8(etDECIMAL), }, 9: { Ffmttype: int8('e'), Fflags: uint8(1), Ftype1: uint8(etEXP), Fcharset: uint8(30), }, 10: { Ffmttype: int8('f'), Fflags: uint8(1), Ftype1: uint8(etFLOAT), }, 11: { Ffmttype: int8('g'), Fflags: uint8(1), Ftype1: uint8(etGENERIC), Fcharset: uint8(30), }, 12: { Ffmttype: int8('Q'), Fflags: uint8(4), Ftype1: uint8(etESCAPE_Q), }, 13: { Ffmttype: int8('i'), Fbase: uint8(10), Fflags: uint8(1), Ftype1: uint8(etDECIMAL), }, 14: { Ffmttype: int8('%'), Ftype1: uint8(etPERCENT), FiNxt: int8(16), }, 15: { Ffmttype: int8('T'), Ftype1: uint8(etTOKEN), }, 16: { Ffmttype: int8('S'), Ftype1: uint8(etSRCITEM), }, 17: { Ffmttype: int8('X'), Fbase: uint8(16), Fprefix: uint8(4), }, 18: { Ffmttype: int8('n'), Ftype1: uint8(etSIZE), }, 19: { Ffmttype: int8('o'), Fbase: uint8(8), Fprefix: uint8(2), FiNxt: int8(17), }, 20: { Ffmttype: int8('p'), Fbase: uint8(16), Ftype1: uint8(etPOINTER), Fprefix: uint8(1), }, 21: { Ffmttype: int8('q'), Fflags: uint8(4), Ftype1: uint8(etESCAPE_q), }, 22: { Ffmttype: int8('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 */ // 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) || int32(**(**int8)(__ccgo_up(p))) == int32(')') { break } if int32(**(**int8)(__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, **(**int8)(__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, **(**int8)(__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 int8 _, _, _, _, _ = iIn, iOut, q, v1, v2 iIn = int32(1) iOut = 0 q = **(**int8)(__ccgo_up(z)) /* Set stack variable q to the close-quote character */ if int32(q) == int32('[') { q = int8(']') } for **(**int8)(__ccgo_up(z + uintptr(iIn))) != 0 { if int32(**(**int8)(__ccgo_up(z + uintptr(iIn)))) == int32(q) { if int32(**(**int8)(__ccgo_up(z + uintptr(iIn+int32(1))))) != int32(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 **(**int8)(__ccgo_up(z + uintptr(v1))) = q } } else { v1 = iOut iOut = iOut + 1 v2 = iIn iIn = iIn + 1 **(**int8)(__ccgo_up(z + uintptr(v1))) = **(**int8)(__ccgo_up(z + uintptr(v2))) } } **(**int8)(__ccgo_up(z + uintptr(iOut))) = int8('\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 int32(**(**int8)(__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 int8) (r int32) { return libc.BoolInt32(int32(t) == int32(' ') || int32(t) == int32('\t') || int32(t) == int32('\n') || int32(t) == int32('\r')) } 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, **(**int8)(__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, **(**int8)(__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 int8, bYIsVowel int32) (r int32) { return libc.BoolInt32(int32(c) == int32('a') || int32(c) == int32('e') || int32(c) == int32('i') || int32(c) == int32('o') || int32(c) == int32('u') || bYIsVowel != 0 && int32(c) == int32('y')) } func _fts5PorterStep1A(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) { var nBuf int32 _ = nBuf nBuf = **(**int32)(__ccgo_up(pnBuf)) if int32(**(**int8)(__ccgo_up(aBuf + uintptr(nBuf-int32(1))))) == int32('s') { if int32(**(**int8)(__ccgo_up(aBuf + uintptr(nBuf-int32(2))))) == int32('e') { if nBuf > int32(4) && int32(**(**int8)(__ccgo_up(aBuf + uintptr(nBuf-int32(4))))) == int32('s') && int32(**(**int8)(__ccgo_up(aBuf + uintptr(nBuf-int32(3))))) == int32('s') || nBuf > int32(3) && int32(**(**int8)(__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 int32(**(**int8)(__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((int32(**(**int8)(__ccgo_up(zStem + uintptr(nStem-int32(1))))) == int32('s') || int32(**(**int8)(__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 int32(**(**int8)(__ccgo_up(zStem + uintptr(nStem-int32(1))))) == int32('w') || int32(**(**int8)(__ccgo_up(zStem + uintptr(nStem-int32(1))))) == int32('x') || int32(**(**int8)(__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, **(**int8)(__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 && **(**int8)(__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 int8 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 = 0 i = iStartOff - int32(1) for { if !(i >= 0) { break } c = **(**int8)(__ccgo_up((*TFts5SFinder)(unsafe.Pointer(p)).FzDoc + uintptr(i))) if int32(c) != int32(' ') && int32(c) != int32('\t') && int32(c) != int32('\n') && int32(c) != int32('\r') { break } goto _1 _1: ; i = i - 1 } if i != iStartOff-int32(1) && (int32(c) == int32('.') || int32(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 int8) (r int32) { return libc.BoolInt32(int32(a) >= int32('0') && int32(a) <= int32('9')) } func _fts5_isopenquote(tls *libc.TLS, x int8) (r int32) { return libc.BoolInt32(int32(x) == int32('"') || int32(x) == int32('\'') || int32(x) == int32('[') || int32(x) == int32('`')) } func _fts5_iswhitespace(tls *libc.TLS, x int8) (r int32) { return libc.BoolInt32(int32(x) == int32(' ')) } // C documentation // // /* // ** Growing our own isspace() routine this way is twice as fast as // ** the library isspace() function. // */ var _geopolyIsSpace = [256]int8{ 9: int8(1), 10: int8(1), 13: int8(1), 32: int8(1), } /* Compiler and version */ // C documentation // // /* Array for converting from half-bytes (nybbles) into ASCII hex // ** digits. */ var _hexdigits = [16]int8{ 0: int8('0'), 1: int8('1'), 2: int8('2'), 3: int8('3'), 4: int8('4'), 5: int8('5'), 6: int8('6'), 7: int8('7'), 8: int8('8'), 9: int8('9'), 10: int8('A'), 11: int8('B'), 12: int8('C'), 13: int8('D'), 14: int8('E'), 15: int8('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 !(**(**int8)(__ccgo_up(z)) != 0) { break } if int32(**(**int8)(__ccgo_up(z))) == int32('"') { n = n + 1 } goto _1 _1: ; n = n + 1 z = z + 1 } return n + int64(2) } // 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 **(**int8)(__ccgo_up(z + uintptr(i))) != 0 { return 0 } goto _1 _1: ; i = i + 1 } return int32(1) } // C documentation // // /* Append a comma separator to the output buffer, if the previous // ** character is not '[' or '{'. // */ func _jsonAppendSeparator(tls *libc.TLS, p uintptr) { var c int8 _ = c if (*TJsonString)(unsafe.Pointer(p)).FnUsed == uint64(0) { return } c = **(**int8)(__ccgo_up((*TJsonString)(unsafe.Pointer(p)).FzBuf + uintptr((*TJsonString)(unsafe.Pointer(p)).FnUsed-uint64(1)))) if int32(c) == int32('[') || int32(c) == int32('{') { return } _jsonAppendChar(tls, p, int8(',')) } // C documentation // // /* // ** If z[0] is 'u' and is followed by exactly 4 hexadecimal character, // ** then set *pOp to JSONB_TEXTJ and return true. If not, do not make // ** any changes to *pOp and return false. // */ func _jsonIs4HexB(tls *libc.TLS, z uintptr, pOp uintptr) (r int32) { if int32(**(**int8)(__ccgo_up(z))) != int32('u') { return 0 } if !(_jsonIs4Hex(tls, z+1) != 0) { return 0 } **(**int32)(__ccgo_up(pOp)) = int32(JSONB_TEXTJ) return int32(1) } // C documentation // // /* // ** Characters that are special to JSON. Control characters, // ** '"' and '\\' and '\''. Actually, '\'' is not special to // ** canonical JSON, but it is special in JSON-5, so we include // ** it in the set of special characters. // */ var _jsonIsOk = [256]int8{ 32: int8(1), 33: int8(1), 35: int8(1), 36: int8(1), 37: int8(1), 38: int8(1), 40: int8(1), 41: int8(1), 42: int8(1), 43: int8(1), 44: int8(1), 45: int8(1), 46: int8(1), 47: int8(1), 48: int8(1), 49: int8(1), 50: int8(1), 51: int8(1), 52: int8(1), 53: int8(1), 54: int8(1), 55: int8(1), 56: int8(1), 57: int8(1), 58: int8(1), 59: int8(1), 60: int8(1), 61: int8(1), 62: int8(1), 63: int8(1), 64: int8(1), 65: int8(1), 66: int8(1), 67: int8(1), 68: int8(1), 69: int8(1), 70: int8(1), 71: int8(1), 72: int8(1), 73: int8(1), 74: int8(1), 75: int8(1), 76: int8(1), 77: int8(1), 78: int8(1), 79: int8(1), 80: int8(1), 81: int8(1), 82: int8(1), 83: int8(1), 84: int8(1), 85: int8(1), 86: int8(1), 87: int8(1), 88: int8(1), 89: int8(1), 90: int8(1), 91: int8(1), 93: int8(1), 94: int8(1), 95: int8(1), 96: int8(1), 97: int8(1), 98: int8(1), 99: int8(1), 100: int8(1), 101: int8(1), 102: int8(1), 103: int8(1), 104: int8(1), 105: int8(1), 106: int8(1), 107: int8(1), 108: int8(1), 109: int8(1), 110: int8(1), 111: int8(1), 112: int8(1), 113: int8(1), 114: int8(1), 115: int8(1), 116: int8(1), 117: int8(1), 118: int8(1), 119: int8(1), 120: int8(1), 121: int8(1), 122: int8(1), 123: int8(1), 124: int8(1), 125: int8(1), 126: int8(1), 127: int8(1), 128: int8(1), 129: int8(1), 130: int8(1), 131: int8(1), 132: int8(1), 133: int8(1), 134: int8(1), 135: int8(1), 136: int8(1), 137: int8(1), 138: int8(1), 139: int8(1), 140: int8(1), 141: int8(1), 142: int8(1), 143: int8(1), 144: int8(1), 145: int8(1), 146: int8(1), 147: int8(1), 148: int8(1), 149: int8(1), 150: int8(1), 151: int8(1), 152: int8(1), 153: int8(1), 154: int8(1), 155: int8(1), 156: int8(1), 157: int8(1), 158: int8(1), 159: int8(1), 160: int8(1), 161: int8(1), 162: int8(1), 163: int8(1), 164: int8(1), 165: int8(1), 166: int8(1), 167: int8(1), 168: int8(1), 169: int8(1), 170: int8(1), 171: int8(1), 172: int8(1), 173: int8(1), 174: int8(1), 175: int8(1), 176: int8(1), 177: int8(1), 178: int8(1), 179: int8(1), 180: int8(1), 181: int8(1), 182: int8(1), 183: int8(1), 184: int8(1), 185: int8(1), 186: int8(1), 187: int8(1), 188: int8(1), 189: int8(1), 190: int8(1), 191: int8(1), 192: int8(1), 193: int8(1), 194: int8(1), 195: int8(1), 196: int8(1), 197: int8(1), 198: int8(1), 199: int8(1), 200: int8(1), 201: int8(1), 202: int8(1), 203: int8(1), 204: int8(1), 205: int8(1), 206: int8(1), 207: int8(1), 208: int8(1), 209: int8(1), 210: int8(1), 211: int8(1), 212: int8(1), 213: int8(1), 214: int8(1), 215: int8(1), 216: int8(1), 217: int8(1), 218: int8(1), 219: int8(1), 220: int8(1), 221: int8(1), 222: int8(1), 223: int8(1), 224: int8(1), 225: int8(1), 226: int8(1), 227: int8(1), 228: int8(1), 229: int8(1), 230: int8(1), 231: int8(1), 232: int8(1), 233: int8(1), 234: int8(1), 235: int8(1), 236: int8(1), 237: int8(1), 238: int8(1), 239: int8(1), 240: int8(1), 241: int8(1), 242: int8(1), 243: int8(1), 244: int8(1), 245: int8(1), 246: int8(1), 247: int8(1), 248: int8(1), 249: int8(1), 250: int8(1), 251: int8(1), 252: int8(1), 253: int8(1), 254: int8(1), 255: int8(1), } // C documentation // // /* // ** Growing our own isspace() routine this way is twice as fast as // ** the library isspace() function, resulting in a 7% overall performance // ** increase for the text-JSON parser. (Ubuntu14.10 gcc 4.8.4 x64 with -Os). // */ var _jsonIsSpace = [256]int8{ 9: int8(1), 10: int8(1), 13: int8(1), 32: int8(1), } // C documentation // // /* // ** The set of all space characters recognized by jsonIsspace(). // ** Useful as the second argument to strspn(). // */ var _jsonSpaces = [5]int8{9, 10, 13, ' '} var _lagName = [4]int8{'l', 'a', 'g'} var _last_valueName = [11]int8{'l', 'a', 's', 't', '_', 'v', 'a', 'l', 'u', 'e'} var _leadName = [5]int8{'l', 'e', 'a', 'd'} var _nth_valueName = [10]int8{'n', 't', 'h', '_', 'v', 'a', 'l', 'u', 'e'} var _ntileName = [6]int8{'n', 't', 'i', 'l', 'e'} /* nullRow[] is an OP_Record encoding of a row containing 5 NULLs */ var _nullRow = [6]int8{ 0: int8(6), } /* Set properties of a table column based on the (magical) ** name of the column. */ var _percent_rankName = [13]int8{'p', 'e', 'r', 'c', 'e', 'n', 't', '_', 'r', 'a', 'n', 'k'} var _rankName = [5]int8{'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 } **(**int8)(__ccgo_up(zRet + uintptr(i*int32(2)))) = int8('?') if i+int32(1) == nBind { v2 = int32('\000') } else { v2 = int32(',') } **(**int8)(__ccgo_up(zRet + uintptr(i*int32(2)+int32(1)))) = int8(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]int8{'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 = int8(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 // // /* // ** Input "r" is a numeric quantity which might be a julian day number, // ** or the number of seconds since 1970. If the value if r is within // ** range of a julian day number, install it as such and set validJD. // ** If the value is a valid unix timestamp, put it in p->s and set p->rawS. // */ func _setRawDateNumber(tls *libc.TLS, p uintptr, r float64) { (*TDateTime)(unsafe.Pointer(p)).Fs = r libc.SetBitFieldPtr8Uint32(p+44, libc.Uint32FromInt32(1), 0, 0x1) if r >= float64(0) && r < float64(5.3734845e+06) { (*TDateTime)(unsafe.Pointer(p)).FiJD = int64(float64(r*libc.Float64FromFloat64(8.64e+07)) + libc.Float64FromFloat64(0.5)) (*TDateTime)(unsafe.Pointer(p)).FvalidJD = int8(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 int8) (r int8) { var aff1 int8 var v1 int32 _, _ = aff1, v1 aff1 = _sqlite3ExprAffinity(tls, pExpr) if int32(aff1) > int32(SQLITE_AFF_NONE) && int32(aff2) > int32(SQLITE_AFF_NONE) { /* Both sides of the comparison are columns. If one has numeric ** affinity, use that. Otherwise use no affinity. */ if int32(aff1) >= int32(SQLITE_AFF_NUMERIC) || int32(aff2) >= int32(SQLITE_AFF_NUMERIC) { return int8(SQLITE_AFF_NUMERIC) } else { return int8(SQLITE_AFF_BLOB) } } else { /* One side is a column, the other is not. Use the columns affinity. */ if int32(aff1) <= int32(SQLITE_AFF_NONE) { v1 = int32(aff2) } else { v1 = int32(aff1) } return int8(v1 | int32(SQLITE_AFF_NONE)) } return r } // 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]int8 F__ccgo_pad2 [1]byte })(unsafe.Pointer(&struct { f [201]int8 _ [1]byte }{f: [201]int8{'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 // // /* // ** 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(int32(**(**int8)(__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 !(**(**int8)(__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 int8 _ = quote /* Quote character (if any ) */ quote = **(**int8)(__ccgo_up(z)) if int32(quote) == int32('[') || int32(quote) == int32('\'') || int32(quote) == int32('"') || int32(quote) == int32('`') { _fts5Dequote(tls, z) } } // C documentation // // /* // ** Insert or remove data to or from the index. Each time a document is // ** added to or removed from the index, this function is called one or more // ** times. // ** // ** For an insert, it must be called once for each token in the new document. // ** If the operation is a delete, it must be called (at least) once for each // ** unique token in the document with an iCol value less than zero. The iPos // ** argument is ignored for a delete. // */ func _sqlite3Fts5IndexWrite(tls *libc.TLS, p uintptr, iCol int32, iPos int32, pToken uintptr, nToken int32) (r int32) { var i, nByte, nChar, rc int32 var pConfig uintptr _, _, _, _, _ = i, nByte, nChar, pConfig, rc /* Used to iterate through indexes */ rc = SQLITE_OK /* Return code */ pConfig = (*TFts5Index)(unsafe.Pointer(p)).FpConfig /* Add the entry to the main terms index. */ rc = _sqlite3Fts5HashWrite(tls, (*TFts5Index)(unsafe.Pointer(p)).FpHash, (*TFts5Index)(unsafe.Pointer(p)).FiWriteRowid, iCol, iPos, int8('0'), pToken, nToken) i = 0 for { if !(i < (*TFts5Config)(unsafe.Pointer(pConfig)).FnPrefix && rc == SQLITE_OK) { break } nChar = **(**int32)(__ccgo_up((*TFts5Config)(unsafe.Pointer(pConfig)).FaPrefix + uintptr(i)*4)) nByte = _sqlite3Fts5IndexCharlenToBytelen(tls, pToken, nToken, nChar) if nByte != 0 { rc = _sqlite3Fts5HashWrite(tls, (*TFts5Index)(unsafe.Pointer(p)).FpHash, (*TFts5Index)(unsafe.Pointer(p)).FiWriteRowid, iCol, iPos, int8(libc.Int32FromUint8('0')+i+libc.Int32FromInt32(1)), pToken, nByte) } goto _1 _1: ; i = i + 1 } return rc } // C documentation // // /* // ** Return true if character 't' may be part of an FTS5 bareword, or false // ** otherwise. Characters that may be part of barewords: // ** // ** * All non-ASCII characters, // ** * The 52 upper and lower case ASCII characters, and // ** * The 10 integer ASCII characters. // ** * The underscore character "_" (0x5F). // ** * The unicode "substitute" character (0x1A). // */ func _sqlite3Fts5IsBareword(tls *libc.TLS, t int8) (r int32) { var aBareword [128]Tu8 _ = aBareword aBareword = [128]Tu8{ 26: uint8(1), 48: uint8(1), 49: uint8(1), 50: uint8(1), 51: uint8(1), 52: uint8(1), 53: uint8(1), 54: uint8(1), 55: uint8(1), 56: uint8(1), 57: uint8(1), 65: uint8(1), 66: uint8(1), 67: uint8(1), 68: uint8(1), 69: uint8(1), 70: uint8(1), 71: uint8(1), 72: uint8(1), 73: uint8(1), 74: uint8(1), 75: uint8(1), 76: uint8(1), 77: uint8(1), 78: uint8(1), 79: uint8(1), 80: uint8(1), 81: uint8(1), 82: uint8(1), 83: uint8(1), 84: uint8(1), 85: uint8(1), 86: uint8(1), 87: uint8(1), 88: uint8(1), 89: uint8(1), 90: uint8(1), 95: uint8(1), 97: uint8(1), 98: uint8(1), 99: uint8(1), 100: uint8(1), 101: uint8(1), 102: uint8(1), 103: uint8(1), 104: uint8(1), 105: uint8(1), 106: uint8(1), 107: uint8(1), 108: uint8(1), 109: uint8(1), 110: uint8(1), 111: uint8(1), 112: uint8(1), 113: uint8(1), 114: uint8(1), 115: uint8(1), 116: uint8(1), 117: uint8(1), 118: uint8(1), 119: uint8(1), 120: uint8(1), 121: uint8(1), 122: uint8(1), } return libc.BoolInt32(int32(t)&int32(0x80) != 0 || aBareword[int32(t)] != 0) } func _sqlite3Fts5UnicodeCatParse(tls *libc.TLS, zCat uintptr, aArray uintptr) (r int32) { **(**Tu8)(__ccgo_up(aArray)) = uint8(1) switch int32(**(**int8)(__ccgo_up(zCat))) { case int32('C'): switch int32(**(**int8)(__ccgo_up(zCat + 1))) { case int32('c'): **(**Tu8)(__ccgo_up(aArray + 1)) = uint8(1) case int32('f'): **(**Tu8)(__ccgo_up(aArray + 2)) = uint8(1) case int32('n'): **(**Tu8)(__ccgo_up(aArray + 3)) = uint8(1) case int32('s'): **(**Tu8)(__ccgo_up(aArray + 4)) = uint8(1) case int32('o'): **(**Tu8)(__ccgo_up(aArray + 31)) = uint8(1) case int32('*'): **(**Tu8)(__ccgo_up(aArray + 1)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 2)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 3)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 4)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 31)) = uint8(1) default: return int32(1) } case int32('L'): switch int32(**(**int8)(__ccgo_up(zCat + 1))) { case int32('l'): **(**Tu8)(__ccgo_up(aArray + 5)) = uint8(1) case int32('m'): **(**Tu8)(__ccgo_up(aArray + 6)) = uint8(1) case int32('o'): **(**Tu8)(__ccgo_up(aArray + 7)) = uint8(1) case int32('t'): **(**Tu8)(__ccgo_up(aArray + 8)) = uint8(1) case int32('u'): **(**Tu8)(__ccgo_up(aArray + 9)) = uint8(1) case int32('C'): **(**Tu8)(__ccgo_up(aArray + 30)) = uint8(1) case int32('*'): **(**Tu8)(__ccgo_up(aArray + 5)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 6)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 7)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 8)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 9)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 30)) = uint8(1) default: return int32(1) } case int32('M'): switch int32(**(**int8)(__ccgo_up(zCat + 1))) { case int32('c'): **(**Tu8)(__ccgo_up(aArray + 10)) = uint8(1) case int32('e'): **(**Tu8)(__ccgo_up(aArray + 11)) = uint8(1) case int32('n'): **(**Tu8)(__ccgo_up(aArray + 12)) = uint8(1) case int32('*'): **(**Tu8)(__ccgo_up(aArray + 10)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 11)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 12)) = uint8(1) default: return int32(1) } case int32('N'): switch int32(**(**int8)(__ccgo_up(zCat + 1))) { case int32('d'): **(**Tu8)(__ccgo_up(aArray + 13)) = uint8(1) case int32('l'): **(**Tu8)(__ccgo_up(aArray + 14)) = uint8(1) case int32('o'): **(**Tu8)(__ccgo_up(aArray + 15)) = uint8(1) case int32('*'): **(**Tu8)(__ccgo_up(aArray + 13)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 14)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 15)) = uint8(1) default: return int32(1) } case int32('P'): switch int32(**(**int8)(__ccgo_up(zCat + 1))) { case int32('c'): **(**Tu8)(__ccgo_up(aArray + 16)) = uint8(1) case int32('d'): **(**Tu8)(__ccgo_up(aArray + 17)) = uint8(1) case int32('e'): **(**Tu8)(__ccgo_up(aArray + 18)) = uint8(1) case int32('f'): **(**Tu8)(__ccgo_up(aArray + 19)) = uint8(1) case int32('i'): **(**Tu8)(__ccgo_up(aArray + 20)) = uint8(1) case int32('o'): **(**Tu8)(__ccgo_up(aArray + 21)) = uint8(1) case int32('s'): **(**Tu8)(__ccgo_up(aArray + 22)) = uint8(1) case int32('*'): **(**Tu8)(__ccgo_up(aArray + 16)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 17)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 18)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 19)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 20)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 21)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 22)) = uint8(1) default: return int32(1) } case int32('S'): switch int32(**(**int8)(__ccgo_up(zCat + 1))) { case int32('c'): **(**Tu8)(__ccgo_up(aArray + 23)) = uint8(1) case int32('k'): **(**Tu8)(__ccgo_up(aArray + 24)) = uint8(1) case int32('m'): **(**Tu8)(__ccgo_up(aArray + 25)) = uint8(1) case int32('o'): **(**Tu8)(__ccgo_up(aArray + 26)) = uint8(1) case int32('*'): **(**Tu8)(__ccgo_up(aArray + 23)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 24)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 25)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 26)) = uint8(1) default: return int32(1) } case int32('Z'): switch int32(**(**int8)(__ccgo_up(zCat + 1))) { case int32('l'): **(**Tu8)(__ccgo_up(aArray + 27)) = uint8(1) case int32('p'): **(**Tu8)(__ccgo_up(aArray + 28)) = uint8(1) case int32('s'): **(**Tu8)(__ccgo_up(aArray + 29)) = uint8(1) case int32('*'): **(**Tu8)(__ccgo_up(aArray + 27)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 28)) = uint8(1) **(**Tu8)(__ccgo_up(aArray + 29)) = uint8(1) default: return int32(1) } default: return int32(1) } return 0 } // C documentation // // /* // ** pExpr is a comparison expression, eg. '=', '<', IN(...) etc. // ** idx_affinity is the affinity of an indexed column. Return true // ** if the index with affinity idx_affinity may be used to implement // ** the comparison in pExpr. // */ func _sqlite3IndexAffinityOk(tls *libc.TLS, pExpr uintptr, idx_affinity int8) (r int32) { var aff int8 _ = aff aff = _comparisonAffinity(tls, pExpr) if int32(aff) < int32(SQLITE_AFF_TEXT) { return int32(1) } if int32(aff) == int32(SQLITE_AFF_TEXT) { return libc.BoolInt32(int32(idx_affinity) == int32(SQLITE_AFF_TEXT)) } return libc.BoolInt32(int32(idx_affinity) >= 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 int8) { if !((*TIndex)(unsafe.Pointer(pIdx)).FzColAff != 0) { if _sqlite3IndexAffinityStr(tls, db, pIdx) == uintptr(0) { return int8(SQLITE_AFF_BLOB) } } return **(**int8)(__ccgo_up((*TIndex)(unsafe.Pointer(pIdx)).FzColAff + uintptr(iCol))) } func _sqlite3OsFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nPathOut int32, zPathOut uintptr) (r int32) { **(**int8)(__ccgo_up(zPathOut)) = 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]int8{ 0: int8(SQLITE_AFF_NUMERIC), 1: int8(SQLITE_AFF_BLOB), 2: int8(SQLITE_AFF_INTEGER), 3: int8(SQLITE_AFF_INTEGER), 4: int8(SQLITE_AFF_REAL), 5: int8(SQLITE_AFF_TEXT), } // C documentation // // /* // ** Name of the default collating sequence // */ var _sqlite3StrBINARY = [7]int8{'B', 'I', 'N', 'A', 'R', 'Y'} // 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 int8 var i, v3 int32 var z uintptr _, _, _, _, _, _ = ap, c, i, z, v2, v3 ap = va i = 0 for { v2 = **(**int8)(__ccgo_up(zTypes + uintptr(i))) c = v2 if !(int32(v2) != 0) { break } if int32(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 int32(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]int8{ 1: int8(1), 2: int8(1), 7: int8(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 // // /* // ** time( TIMESTRING, MOD, MOD, ...) // ** // ** Return HH:MM:SS // */ func _timeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { bp := tls.Alloc(64) defer tls.Free(64) var n, s int32 var _ /* x at bp+0 */ TDateTime var _ /* zBuf at bp+48 */ [16]int8 _, _ = n, s if _isDate(tls, context, argc, argv, bp) == 0 { _computeHMS(tls, bp) (**(**[16]int8)(__ccgo_up(bp + 48)))[0] = int8(int32('0') + (**(**TDateTime)(__ccgo_up(bp))).Fh/int32(10)%int32(10)) (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(1)] = int8(int32('0') + (**(**TDateTime)(__ccgo_up(bp))).Fh%int32(10)) (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(2)] = int8(':') (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(3)] = int8(int32('0') + (**(**TDateTime)(__ccgo_up(bp))).Fm/int32(10)%int32(10)) (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(4)] = int8(int32('0') + (**(**TDateTime)(__ccgo_up(bp))).Fm%int32(10)) (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(5)] = int8(':') if int32(uint32(*(*uint8)(unsafe.Pointer(bp + 44))&0x4>>2)) != 0 { s = int32(float64(libc.Float64FromFloat64(1000)*(**(**TDateTime)(__ccgo_up(bp))).Fs) + libc.Float64FromFloat64(0.5)) (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(6)] = int8(int32('0') + s/int32(10000)%int32(10)) (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(7)] = int8(int32('0') + s/int32(1000)%int32(10)) (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(8)] = int8('.') (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(9)] = int8(int32('0') + s/int32(100)%int32(10)) (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(10)] = int8(int32('0') + s/int32(10)%int32(10)) (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(11)] = int8(int32('0') + s%int32(10)) (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(12)] = 0 n = int32(12) } else { s = int32((**(**TDateTime)(__ccgo_up(bp))).Fs) (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(6)] = int8(int32('0') + s/int32(10)%int32(10)) (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(7)] = int8(int32('0') + s%int32(10)) (**(**[16]int8)(__ccgo_up(bp + 48)))[int32(8)] = 0 n = int32(8) } Xsqlite3_result_text(tls, context, bp+48, n, uintptr(-libc.Int32FromInt32(1))) } } // 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 int32(_sqlite3CompareAffinity(tls, p, **(**int8)(__ccgo_up(zAff + uintptr(i))))) == int32(SQLITE_AFF_BLOB) || _sqlite3ExprNeedsNoAffinityChange(tls, p, **(**int8)(__ccgo_up(zAff + uintptr(i)))) != 0 { **(**int8)(__ccgo_up(zAff + uintptr(i))) = int8(SQLITE_AFF_BLOB) } goto _1 _1: ; i = i + 1 } } // 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) && **(**int8)(__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]int8 _sqlite3Put4byte(tls, bp, val) return _sqlite3OsWrite(tls, fd, bp, int32(4), offset) } var _zAff = [10]int8{'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]int8{'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]int8{} // 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]int8{ 0: int8('R'), 1: int8('E'), 2: int8('I'), 3: int8('N'), 4: int8('D'), 5: int8('E'), 6: int8('X'), 7: int8('E'), 8: int8('D'), 9: int8('E'), 10: int8('S'), 11: int8('C'), 12: int8('A'), 13: int8('P'), 14: int8('E'), 15: int8('A'), 16: int8('C'), 17: int8('H'), 18: int8('E'), 19: int8('C'), 20: int8('K'), 21: int8('E'), 22: int8('Y'), 23: int8('B'), 24: int8('E'), 25: int8('F'), 26: int8('O'), 27: int8('R'), 28: int8('E'), 29: int8('I'), 30: int8('G'), 31: int8('N'), 32: int8('O'), 33: int8('R'), 34: int8('E'), 35: int8('G'), 36: int8('E'), 37: int8('X'), 38: int8('P'), 39: int8('L'), 40: int8('A'), 41: int8('I'), 42: int8('N'), 43: int8('S'), 44: int8('T'), 45: int8('E'), 46: int8('A'), 47: int8('D'), 48: int8('D'), 49: int8('A'), 50: int8('T'), 51: int8('A'), 52: int8('B'), 53: int8('A'), 54: int8('S'), 55: int8('E'), 56: int8('L'), 57: int8('E'), 58: int8('C'), 59: int8('T'), 60: int8('A'), 61: int8('B'), 62: int8('L'), 63: int8('E'), 64: int8('F'), 65: int8('T'), 66: int8('H'), 67: int8('E'), 68: int8('N'), 69: int8('D'), 70: int8('E'), 71: int8('F'), 72: int8('E'), 73: int8('R'), 74: int8('R'), 75: int8('A'), 76: int8('B'), 77: int8('L'), 78: int8('E'), 79: int8('L'), 80: int8('S'), 81: int8('E'), 82: int8('X'), 83: int8('C'), 84: int8('L'), 85: int8('U'), 86: int8('D'), 87: int8('E'), 88: int8('L'), 89: int8('E'), 90: int8('T'), 91: int8('E'), 92: int8('M'), 93: int8('P'), 94: int8('O'), 95: int8('R'), 96: int8('A'), 97: int8('R'), 98: int8('Y'), 99: int8('I'), 100: int8('S'), 101: int8('N'), 102: int8('U'), 103: int8('L'), 104: int8('L'), 105: int8('S'), 106: int8('A'), 107: int8('V'), 108: int8('E'), 109: int8('P'), 110: int8('O'), 111: int8('I'), 112: int8('N'), 113: int8('T'), 114: int8('E'), 115: int8('R'), 116: int8('S'), 117: int8('E'), 118: int8('C'), 119: int8('T'), 120: int8('I'), 121: int8('E'), 122: int8('S'), 123: int8('N'), 124: int8('O'), 125: int8('T'), 126: int8('N'), 127: int8('U'), 128: int8('L'), 129: int8('L'), 130: int8('I'), 131: int8('K'), 132: int8('E'), 133: int8('X'), 134: int8('C'), 135: int8('E'), 136: int8('P'), 137: int8('T'), 138: int8('R'), 139: int8('A'), 140: int8('N'), 141: int8('S'), 142: int8('A'), 143: int8('C'), 144: int8('T'), 145: int8('I'), 146: int8('O'), 147: int8('N'), 148: int8('A'), 149: int8('T'), 150: int8('U'), 151: int8('R'), 152: int8('A'), 153: int8('L'), 154: int8('T'), 155: int8('E'), 156: int8('R'), 157: int8('A'), 158: int8('I'), 159: int8('S'), 160: int8('E'), 161: int8('X'), 162: int8('C'), 163: int8('L'), 164: int8('U'), 165: int8('S'), 166: int8('I'), 167: int8('V'), 168: int8('E'), 169: int8('X'), 170: int8('I'), 171: int8('S'), 172: int8('T'), 173: int8('S'), 174: int8('C'), 175: int8('O'), 176: int8('N'), 177: int8('S'), 178: int8('T'), 179: int8('R'), 180: int8('A'), 181: int8('I'), 182: int8('N'), 183: int8('T'), 184: int8('O'), 185: int8('F'), 186: int8('F'), 187: int8('S'), 188: int8('E'), 189: int8('T'), 190: int8('R'), 191: int8('I'), 192: int8('G'), 193: int8('G'), 194: int8('E'), 195: int8('R'), 196: int8('A'), 197: int8('N'), 198: int8('G'), 199: int8('E'), 200: int8('N'), 201: int8('E'), 202: int8('R'), 203: int8('A'), 204: int8('T'), 205: int8('E'), 206: int8('D'), 207: int8('E'), 208: int8('T'), 209: int8('A'), 210: int8('C'), 211: int8('H'), 212: int8('A'), 213: int8('V'), 214: int8('I'), 215: int8('N'), 216: int8('G'), 217: int8('L'), 218: int8('O'), 219: int8('B'), 220: int8('E'), 221: int8('G'), 222: int8('I'), 223: int8('N'), 224: int8('N'), 225: int8('E'), 226: int8('R'), 227: int8('E'), 228: int8('F'), 229: int8('E'), 230: int8('R'), 231: int8('E'), 232: int8('N'), 233: int8('C'), 234: int8('E'), 235: int8('S'), 236: int8('U'), 237: int8('N'), 238: int8('I'), 239: int8('Q'), 240: int8('U'), 241: int8('E'), 242: int8('R'), 243: int8('Y'), 244: int8('W'), 245: int8('I'), 246: int8('T'), 247: int8('H'), 248: int8('O'), 249: int8('U'), 250: int8('T'), 251: int8('E'), 252: int8('R'), 253: int8('E'), 254: int8('L'), 255: int8('E'), 256: int8('A'), 257: int8('S'), 258: int8('E'), 259: int8('A'), 260: int8('T'), 261: int8('T'), 262: int8('A'), 263: int8('C'), 264: int8('H'), 265: int8('B'), 266: int8('E'), 267: int8('T'), 268: int8('W'), 269: int8('E'), 270: int8('E'), 271: int8('N'), 272: int8('O'), 273: int8('T'), 274: int8('H'), 275: int8('I'), 276: int8('N'), 277: int8('G'), 278: int8('R'), 279: int8('O'), 280: int8('U'), 281: int8('P'), 282: int8('S'), 283: int8('C'), 284: int8('A'), 285: int8('S'), 286: int8('C'), 287: int8('A'), 288: int8('D'), 289: int8('E'), 290: int8('F'), 291: int8('A'), 292: int8('U'), 293: int8('L'), 294: int8('T'), 295: int8('C'), 296: int8('A'), 297: int8('S'), 298: int8('E'), 299: int8('C'), 300: int8('O'), 301: int8('L'), 302: int8('L'), 303: int8('A'), 304: int8('T'), 305: int8('E'), 306: int8('C'), 307: int8('R'), 308: int8('E'), 309: int8('A'), 310: int8('T'), 311: int8('E'), 312: int8('C'), 313: int8('U'), 314: int8('R'), 315: int8('R'), 316: int8('E'), 317: int8('N'), 318: int8('T'), 319: int8('_'), 320: int8('D'), 321: int8('A'), 322: int8('T'), 323: int8('E'), 324: int8('I'), 325: int8('M'), 326: int8('M'), 327: int8('E'), 328: int8('D'), 329: int8('I'), 330: int8('A'), 331: int8('T'), 332: int8('E'), 333: int8('J'), 334: int8('O'), 335: int8('I'), 336: int8('N'), 337: int8('S'), 338: int8('E'), 339: int8('R'), 340: int8('T'), 341: int8('M'), 342: int8('A'), 343: int8('T'), 344: int8('C'), 345: int8('H'), 346: int8('P'), 347: int8('L'), 348: int8('A'), 349: int8('N'), 350: int8('A'), 351: int8('L'), 352: int8('Y'), 353: int8('Z'), 354: int8('E'), 355: int8('P'), 356: int8('R'), 357: int8('A'), 358: int8('G'), 359: int8('M'), 360: int8('A'), 361: int8('T'), 362: int8('E'), 363: int8('R'), 364: int8('I'), 365: int8('A'), 366: int8('L'), 367: int8('I'), 368: int8('Z'), 369: int8('E'), 370: int8('D'), 371: int8('E'), 372: int8('F'), 373: int8('E'), 374: int8('R'), 375: int8('R'), 376: int8('E'), 377: int8('D'), 378: int8('I'), 379: int8('S'), 380: int8('T'), 381: int8('I'), 382: int8('N'), 383: int8('C'), 384: int8('T'), 385: int8('U'), 386: int8('P'), 387: int8('D'), 388: int8('A'), 389: int8('T'), 390: int8('E'), 391: int8('V'), 392: int8('A'), 393: int8('L'), 394: int8('U'), 395: int8('E'), 396: int8('S'), 397: int8('V'), 398: int8('I'), 399: int8('R'), 400: int8('T'), 401: int8('U'), 402: int8('A'), 403: int8('L'), 404: int8('W'), 405: int8('A'), 406: int8('Y'), 407: int8('S'), 408: int8('W'), 409: int8('H'), 410: int8('E'), 411: int8('N'), 412: int8('W'), 413: int8('H'), 414: int8('E'), 415: int8('R'), 416: int8('E'), 417: int8('C'), 418: int8('U'), 419: int8('R'), 420: int8('S'), 421: int8('I'), 422: int8('V'), 423: int8('E'), 424: int8('A'), 425: int8('B'), 426: int8('O'), 427: int8('R'), 428: int8('T'), 429: int8('A'), 430: int8('F'), 431: int8('T'), 432: int8('E'), 433: int8('R'), 434: int8('E'), 435: int8('N'), 436: int8('A'), 437: int8('M'), 438: int8('E'), 439: int8('A'), 440: int8('N'), 441: int8('D'), 442: int8('R'), 443: int8('O'), 444: int8('P'), 445: int8('A'), 446: int8('R'), 447: int8('T'), 448: int8('I'), 449: int8('T'), 450: int8('I'), 451: int8('O'), 452: int8('N'), 453: int8('A'), 454: int8('U'), 455: int8('T'), 456: int8('O'), 457: int8('I'), 458: int8('N'), 459: int8('C'), 460: int8('R'), 461: int8('E'), 462: int8('M'), 463: int8('E'), 464: int8('N'), 465: int8('T'), 466: int8('C'), 467: int8('A'), 468: int8('S'), 469: int8('T'), 470: int8('C'), 471: int8('O'), 472: int8('L'), 473: int8('U'), 474: int8('M'), 475: int8('N'), 476: int8('C'), 477: int8('O'), 478: int8('M'), 479: int8('M'), 480: int8('I'), 481: int8('T'), 482: int8('C'), 483: int8('O'), 484: int8('N'), 485: int8('F'), 486: int8('L'), 487: int8('I'), 488: int8('C'), 489: int8('T'), 490: int8('C'), 491: int8('R'), 492: int8('O'), 493: int8('S'), 494: int8('S'), 495: int8('C'), 496: int8('U'), 497: int8('R'), 498: int8('R'), 499: int8('E'), 500: int8('N'), 501: int8('T'), 502: int8('_'), 503: int8('T'), 504: int8('I'), 505: int8('M'), 506: int8('E'), 507: int8('S'), 508: int8('T'), 509: int8('A'), 510: int8('M'), 511: int8('P'), 512: int8('R'), 513: int8('E'), 514: int8('C'), 515: int8('E'), 516: int8('D'), 517: int8('I'), 518: int8('N'), 519: int8('G'), 520: int8('F'), 521: int8('A'), 522: int8('I'), 523: int8('L'), 524: int8('A'), 525: int8('S'), 526: int8('T'), 527: int8('F'), 528: int8('I'), 529: int8('L'), 530: int8('T'), 531: int8('E'), 532: int8('R'), 533: int8('E'), 534: int8('P'), 535: int8('L'), 536: int8('A'), 537: int8('C'), 538: int8('E'), 539: int8('F'), 540: int8('I'), 541: int8('R'), 542: int8('S'), 543: int8('T'), 544: int8('F'), 545: int8('O'), 546: int8('L'), 547: int8('L'), 548: int8('O'), 549: int8('W'), 550: int8('I'), 551: int8('N'), 552: int8('G'), 553: int8('F'), 554: int8('R'), 555: int8('O'), 556: int8('M'), 557: int8('F'), 558: int8('U'), 559: int8('L'), 560: int8('L'), 561: int8('I'), 562: int8('M'), 563: int8('I'), 564: int8('T'), 565: int8('I'), 566: int8('F'), 567: int8('O'), 568: int8('R'), 569: int8('D'), 570: int8('E'), 571: int8('R'), 572: int8('E'), 573: int8('S'), 574: int8('T'), 575: int8('R'), 576: int8('I'), 577: int8('C'), 578: int8('T'), 579: int8('O'), 580: int8('T'), 581: int8('H'), 582: int8('E'), 583: int8('R'), 584: int8('S'), 585: int8('O'), 586: int8('V'), 587: int8('E'), 588: int8('R'), 589: int8('E'), 590: int8('T'), 591: int8('U'), 592: int8('R'), 593: int8('N'), 594: int8('I'), 595: int8('N'), 596: int8('G'), 597: int8('R'), 598: int8('I'), 599: int8('G'), 600: int8('H'), 601: int8('T'), 602: int8('R'), 603: int8('O'), 604: int8('L'), 605: int8('L'), 606: int8('B'), 607: int8('A'), 608: int8('C'), 609: int8('K'), 610: int8('R'), 611: int8('O'), 612: int8('W'), 613: int8('S'), 614: int8('U'), 615: int8('N'), 616: int8('B'), 617: int8('O'), 618: int8('U'), 619: int8('N'), 620: int8('D'), 621: int8('E'), 622: int8('D'), 623: int8('U'), 624: int8('N'), 625: int8('I'), 626: int8('O'), 627: int8('N'), 628: int8('U'), 629: int8('S'), 630: int8('I'), 631: int8('N'), 632: int8('G'), 633: int8('V'), 634: int8('A'), 635: int8('C'), 636: int8('U'), 637: int8('U'), 638: int8('M'), 639: int8('V'), 640: int8('I'), 641: int8('E'), 642: int8('W'), 643: int8('I'), 644: int8('N'), 645: int8('D'), 646: int8('O'), 647: int8('W'), 648: int8('B'), 649: int8('Y'), 650: int8('I'), 651: int8('N'), 652: int8('I'), 653: int8('T'), 654: int8('I'), 655: int8('A'), 656: int8('L'), 657: int8('L'), 658: int8('Y'), 659: int8('P'), 660: int8('R'), 661: int8('I'), 662: int8('M'), 663: int8('A'), 664: int8('R'), 665: int8('Y'), } /* 0123456789 123456789 123456789 123 */ var _zKeyText = [34]int8{'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]int8{'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]int8{'t', 'h', 's', 't', 'n', 'd', 'r', 'd'} /* End of function */ /* 123456789 123456789 123 */ var _zText = [25]int8{'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]int8{}