Fixes GO-2026-6629 (golang.org/x/text precis panic). Bumps bun and bun/dialect/pgdialect together to v1.3.0; go directive now 1.26.0.
136 lines
5.3 KiB
Go
136 lines
5.3 KiB
Go
// Code generated by modernc.org/undup from the per-target sqlite_*.go files; DO NOT EDIT.
|
|
|
|
//go:build (darwin && amd64) || (darwin && arm64) || (freebsd && 386) || (freebsd && amd64) || (freebsd && arm) || (freebsd && arm64) || (linux && 386) || (linux && amd64) || (linux && arm) || (linux && arm64) || (linux && loong64) || (linux && ppc64le) || (linux && riscv64) || (netbsd && amd64) || (openbsd && amd64) || (openbsd && arm64) || (windows && (amd64 || arm64)) || (windows && 386)
|
|
|
|
package sqlite3
|
|
|
|
import (
|
|
"unsafe"
|
|
|
|
"modernc.org/libc"
|
|
)
|
|
|
|
const SQLITE_BIGENDIAN = 0
|
|
|
|
const SQLITE_BYTEORDER = 1234
|
|
|
|
const SQLITE_LITTLEENDIAN = 1
|
|
|
|
const SQLITE_UTF16NATIVE = 2
|
|
|
|
// C documentation
|
|
//
|
|
// /*
|
|
// ** This routine is the same as the sqlite3_complete() routine described
|
|
// ** above, except that the parameter is required to be UTF-16 encoded, not
|
|
// ** UTF-8.
|
|
// */
|
|
func Xsqlite3_complete16(tls *libc.TLS, zSql uintptr) (r int32) {
|
|
var pVal, zSql8 uintptr
|
|
var rc int32
|
|
_, _, _ = pVal, rc, zSql8
|
|
rc = Xsqlite3_initialize(tls)
|
|
if rc != 0 {
|
|
return rc
|
|
}
|
|
pVal = _sqlite3ValueNew(tls, uintptr(0))
|
|
_sqlite3ValueSetStr(tls, pVal, -int32(1), zSql, uint8(SQLITE_UTF16LE), libc.UintptrFromInt32(0))
|
|
zSql8 = _sqlite3ValueText(tls, pVal, uint8(SQLITE_UTF8))
|
|
if zSql8 != 0 {
|
|
rc = Xsqlite3_complete(tls, zSql8)
|
|
} else {
|
|
rc = int32(SQLITE_NOMEM)
|
|
}
|
|
_sqlite3ValueFree(tls, pVal)
|
|
return rc & int32(0xff)
|
|
}
|
|
|
|
/************** End of rtree.h ***********************************************/
|
|
/************** Continuing where we left off in main.c ***********************/
|
|
|
|
func Xsqlite3_create_function16(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg int32, eTextRep int32, p uintptr, __ccgo_fp_xSFunc uintptr, __ccgo_fp_xStep uintptr, __ccgo_fp_xFinal uintptr) (r int32) {
|
|
var rc int32
|
|
var zFunc8 uintptr
|
|
_, _ = rc, zFunc8
|
|
Xsqlite3_mutex_enter(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex)
|
|
zFunc8 = _sqlite3Utf16to8(tls, db, zFunctionName, -int32(1), uint8(SQLITE_UTF16LE))
|
|
rc = _sqlite3CreateFunc(tls, db, zFunc8, nArg, eTextRep, p, __ccgo_fp_xSFunc, __ccgo_fp_xStep, __ccgo_fp_xFinal, uintptr(0), uintptr(0), uintptr(0))
|
|
_sqlite3DbFree(tls, db, zFunc8)
|
|
rc = _sqlite3ApiExit(tls, db, rc)
|
|
Xsqlite3_mutex_leave(tls, (*Tsqlite3)(unsafe.Pointer(db)).Fmutex)
|
|
return rc
|
|
}
|
|
|
|
func Xsqlite3_result_error16(tls *libc.TLS, pCtx uintptr, z uintptr, n int32) {
|
|
(*Tsqlite3_context)(unsafe.Pointer(pCtx)).FisError = int32(SQLITE_ERROR)
|
|
_sqlite3VdbeMemSetStr(tls, (*Tsqlite3_context)(unsafe.Pointer(pCtx)).FpOut, z, int64(n), uint8(SQLITE_UTF16LE), uintptr(-libc.Int32FromInt32(1)))
|
|
}
|
|
|
|
func Xsqlite3_value_bytes16(tls *libc.TLS, pVal uintptr) (r int32) {
|
|
return _sqlite3ValueBytes(tls, pVal, uint8(SQLITE_UTF16LE))
|
|
}
|
|
|
|
func Xsqlite3_value_text16(tls *libc.TLS, pVal uintptr) (r uintptr) {
|
|
return _sqlite3ValueText(tls, pVal, uint8(SQLITE_UTF16LE))
|
|
}
|
|
|
|
const __BYTE_ORDER__ = 1234
|
|
|
|
func _freeCursorWithCache(tls *libc.TLS, p uintptr, pCx uintptr) {
|
|
var pCache uintptr
|
|
_ = pCache
|
|
pCache = (*TVdbeCursor)(unsafe.Pointer(pCx)).FpCache
|
|
libc.SetBitFieldPtr8Uint32(pCx+8, libc.Uint32FromInt32(0), 4, 0x10)
|
|
(*TVdbeCursor)(unsafe.Pointer(pCx)).FpCache = uintptr(0)
|
|
if (*TVdbeTxtBlbCache)(unsafe.Pointer(pCache)).FpCValue != 0 {
|
|
_sqlite3RCStrUnref(tls, (*TVdbeTxtBlbCache)(unsafe.Pointer(pCache)).FpCValue)
|
|
(*TVdbeTxtBlbCache)(unsafe.Pointer(pCache)).FpCValue = uintptr(0)
|
|
}
|
|
_sqlite3DbFree(tls, (*TVdbe)(unsafe.Pointer(p)).Fdb, pCache)
|
|
_sqlite3VdbeFreeCursorNN(tls, p, pCx)
|
|
}
|
|
|
|
func _readCoord(tls *libc.TLS, p uintptr, pCoord uintptr) {
|
|
*(*Tu32)(unsafe.Pointer(pCoord)) = uint32(**(**Tu8)(__ccgo_up(p)))<<libc.Int32FromInt32(24) + uint32(**(**Tu8)(__ccgo_up(p + 1)))<<libc.Int32FromInt32(16) + uint32(**(**Tu8)(__ccgo_up(p + 2)))<<libc.Int32FromInt32(8) + uint32(**(**Tu8)(__ccgo_up(p + 3)))<<libc.Int32FromInt32(0)
|
|
}
|
|
|
|
func _sqlite3Put4byte(tls *libc.TLS, p uintptr, v Tu32) {
|
|
**(**uint8)(__ccgo_up(p)) = uint8(v >> libc.Int32FromInt32(24))
|
|
**(**uint8)(__ccgo_up(p + 1)) = uint8(v >> libc.Int32FromInt32(16))
|
|
**(**uint8)(__ccgo_up(p + 2)) = uint8(v >> libc.Int32FromInt32(8))
|
|
**(**uint8)(__ccgo_up(p + 3)) = uint8(v)
|
|
}
|
|
|
|
// C documentation
|
|
//
|
|
// /*
|
|
// ** unixepoch( TIMESTRING, MOD, MOD, ...)
|
|
// **
|
|
// ** Return the number of seconds (including fractional seconds) since
|
|
// ** the unix epoch of 1970-01-01 00:00:00 GMT.
|
|
// */
|
|
func _unixepochFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) {
|
|
bp := tls.Alloc(48)
|
|
defer tls.Free(48)
|
|
var _ /* x at bp+0 */ TDateTime
|
|
if _isDate(tls, context, argc, argv, bp) == 0 {
|
|
_computeJD(tls, bp)
|
|
if int32(uint32(*(*uint8)(unsafe.Pointer(bp + 44))&0x4>>2)) != 0 {
|
|
Xsqlite3_result_double(tls, context, float64((**(**TDateTime)(__ccgo_up(bp))).FiJD-libc.Int64FromInt32(21086676)*libc.Int64FromInt32(10000000))/float64(1000))
|
|
} else {
|
|
Xsqlite3_result_int64(tls, context, (**(**TDateTime)(__ccgo_up(bp))).FiJD/int64(1000)-libc.Int64FromInt32(21086676)*libc.Int64FromInt32(10000))
|
|
}
|
|
}
|
|
}
|
|
|
|
func _writeCoord(tls *libc.TLS, p uintptr, pCoord uintptr) (r int32) {
|
|
var i Tu32
|
|
_ = i
|
|
i = *(*Tu32)(unsafe.Pointer(pCoord))
|
|
**(**Tu8)(__ccgo_up(p)) = uint8(i >> libc.Int32FromInt32(24) & uint32(0xFF))
|
|
**(**Tu8)(__ccgo_up(p + 1)) = uint8(i >> libc.Int32FromInt32(16) & uint32(0xFF))
|
|
**(**Tu8)(__ccgo_up(p + 2)) = uint8(i >> libc.Int32FromInt32(8) & uint32(0xFF))
|
|
**(**Tu8)(__ccgo_up(p + 3)) = uint8(i >> libc.Int32FromInt32(0) & uint32(0xFF))
|
|
return int32(4)
|
|
}
|