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.
675 lines
14 KiB
Go
675 lines
14 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) || (netbsd && amd64) || (openbsd && amd64) || (openbsd && arm64)
|
|
|
|
package sqlite3
|
|
|
|
import (
|
|
"unsafe"
|
|
|
|
"modernc.org/libc"
|
|
)
|
|
|
|
const ACCESSPERMS = 511
|
|
|
|
const ALLPERMS = 4095
|
|
|
|
const DEFFILEMODE = 438
|
|
|
|
const EADDRINUSE = 48
|
|
|
|
const EADDRNOTAVAIL = 49
|
|
|
|
const EAFNOSUPPORT = 47
|
|
|
|
const EAGAIN = 35
|
|
|
|
const EALREADY = 37
|
|
|
|
const EAUTH = 80
|
|
|
|
const EBADRPC = 72
|
|
|
|
const ECONNABORTED = 53
|
|
|
|
const ECONNREFUSED = 61
|
|
|
|
const ECONNRESET = 54
|
|
|
|
const EDEADLK = 11
|
|
|
|
const EDESTADDRREQ = 39
|
|
|
|
const EDQUOT = 69
|
|
|
|
const EFTYPE = 79
|
|
|
|
const EHOSTDOWN = 64
|
|
|
|
const EHOSTUNREACH = 65
|
|
|
|
const EINPROGRESS = 36
|
|
|
|
const EISCONN = 56
|
|
|
|
const ELOOP = 62
|
|
|
|
const EMSGSIZE = 40
|
|
|
|
const ENAMETOOLONG = 63
|
|
|
|
const ENEEDAUTH = 81
|
|
|
|
const ENETDOWN = 50
|
|
|
|
const ENETRESET = 52
|
|
|
|
const ENETUNREACH = 51
|
|
|
|
const ENOBUFS = 55
|
|
|
|
const ENOLCK = 77
|
|
|
|
const ENOPROTOOPT = 42
|
|
|
|
const ENOSYS = 78
|
|
|
|
const ENOTCONN = 57
|
|
|
|
const ENOTEMPTY = 66
|
|
|
|
const ENOTSOCK = 38
|
|
|
|
const EPFNOSUPPORT = 46
|
|
|
|
const EPROCLIM = 67
|
|
|
|
const EPROCUNAVAIL = 76
|
|
|
|
const EPROGMISMATCH = 75
|
|
|
|
const EPROGUNAVAIL = 74
|
|
|
|
const EPROTONOSUPPORT = 43
|
|
|
|
const EPROTOTYPE = 41
|
|
|
|
const EREMOTE = 71
|
|
|
|
const ERPCMISMATCH = 73
|
|
|
|
const ESHUTDOWN = 58
|
|
|
|
const ESOCKTNOSUPPORT = 44
|
|
|
|
const ESTALE = 70
|
|
|
|
const ETIMEDOUT = 60
|
|
|
|
const ETOOMANYREFS = 59
|
|
|
|
const EUSERS = 68
|
|
|
|
const EWOULDBLOCK = 35
|
|
|
|
const FAPPEND = 8
|
|
|
|
const FASYNC = 64
|
|
|
|
const FILENAME_MAX = 1024
|
|
|
|
const FIOGETOWN = 1074030203
|
|
|
|
const FIOSETOWN = 2147772028
|
|
|
|
const FNDELAY = 4
|
|
|
|
const FREAD = 1
|
|
|
|
const FWRITE = 2
|
|
|
|
const F_GETOWN = 5
|
|
|
|
const F_RDLCK = 1
|
|
|
|
const F_SETOWN = 6
|
|
|
|
const F_WRLCK = 3
|
|
|
|
const HAVE_MREMAP = 0
|
|
|
|
const IOCPARM_MASK = 8191
|
|
|
|
const IOC_DIRMASK = 3758096384
|
|
|
|
const LOCK_EX = 2
|
|
|
|
const LOCK_NB = 4
|
|
|
|
const LOCK_SH = 1
|
|
|
|
const LOCK_UN = 8
|
|
|
|
const L_ctermid = 1024
|
|
|
|
const L_tmpnam = 1024
|
|
|
|
const MAP_ANON = 4096
|
|
|
|
const MAP_ANONYMOUS = 4096
|
|
|
|
const O_ACCMODE = 3
|
|
|
|
const O_APPEND = 8
|
|
|
|
const O_ASYNC = 64
|
|
|
|
const O_CREAT = 512
|
|
|
|
const O_EXCL = 2048
|
|
|
|
const O_EXLOCK = 32
|
|
|
|
const O_FSYNC = 128
|
|
|
|
const O_LARGEFILE = 0
|
|
|
|
const O_NDELAY = 4
|
|
|
|
const O_NOFOLLOW = 256
|
|
|
|
const O_NONBLOCK = 4
|
|
|
|
const O_SHLOCK = 16
|
|
|
|
const O_SYNC = 128
|
|
|
|
const O_TRUNC = 1024
|
|
|
|
const PPPDISC = 5
|
|
|
|
const RTLD_DEFAULT = 18446744073709551614
|
|
|
|
const RTLD_SELF = 18446744073709551613
|
|
|
|
const SF_APPEND = 262144
|
|
|
|
const SF_ARCHIVED = 65536
|
|
|
|
const SF_IMMUTABLE = 131072
|
|
|
|
const SIOCGPGRP = 1074033417
|
|
|
|
const SIOCSPGRP = 2147775240
|
|
|
|
const SLIPDISC = 4
|
|
|
|
const SQLITE_MAX_PATHLEN = 1024
|
|
|
|
const S_BLKSIZE = 512
|
|
|
|
const S_ISTXT = 512
|
|
|
|
const TIOCCBRK = 536900730
|
|
|
|
const TIOCCDTR = 536900728
|
|
|
|
const TIOCCONS = 2147775586
|
|
|
|
const TIOCDRAIN = 536900702
|
|
|
|
const TIOCEXCL = 536900621
|
|
|
|
const TIOCEXT = 2147775584
|
|
|
|
const TIOCFLUSH = 2147775504
|
|
|
|
const TIOCGETD = 1074033690
|
|
|
|
const TIOCMBIC = 2147775595
|
|
|
|
const TIOCMBIS = 2147775596
|
|
|
|
const TIOCMGET = 1074033770
|
|
|
|
const TIOCMSET = 2147775597
|
|
|
|
const TIOCNOTTY = 536900721
|
|
|
|
const TIOCNXCL = 536900622
|
|
|
|
const TIOCPKT = 2147775600
|
|
|
|
const TIOCSBRK = 536900731
|
|
|
|
const TIOCSCTTY = 536900705
|
|
|
|
const TIOCSDTR = 536900729
|
|
|
|
const TIOCSETD = 2147775515
|
|
|
|
const TIOCUCNTL = 2147775590
|
|
|
|
type TSQLiteThread = struct {
|
|
FxTask uintptr
|
|
FpIn uintptr
|
|
FpResult uintptr
|
|
}
|
|
|
|
const TTYDISC = 0
|
|
|
|
type Tfixpt_t = uint32
|
|
|
|
const UF_APPEND = 4
|
|
|
|
const UF_IMMUTABLE = 2
|
|
|
|
const UF_NODUMP = 1
|
|
|
|
const UF_OPAQUE = 8
|
|
|
|
const UF_SETTABLE = 65535
|
|
|
|
const WINT_MAX = 2147483647
|
|
|
|
const WINT_MIN = -2147483648
|
|
|
|
// C documentation
|
|
//
|
|
// /*
|
|
// ** Open File Description (OFD) locks, F_OFD_SETLK & co., on Linux instead of
|
|
// ** POSIX record locks. A POSIX lock belongs to the process and is dropped by
|
|
// ** any close() of any descriptor of the file; an OFD lock belongs to the open
|
|
// ** file description that placed it. See https://gitlab.com/cznic/sqlite/-/issues/255
|
|
// **
|
|
// ** Opt-in, and process-wide by necessity: POSIX and OFD locks are different
|
|
// ** owners even within one process, so all connections to a file must use the
|
|
// ** same kind. Enabled by the environment variable MODERNC_SQLITE_OFD_LOCK
|
|
// ** (any value but the empty string or one starting with "0"), which is read
|
|
// ** once from sqlite3_os_init(), or by modernc_ofd_locking(1), which overrides
|
|
// ** it. Both must happen before the first database file is opened.
|
|
// **
|
|
// ** The kind of lock in use cannot change under a held lock - a POSIX F_UNLCK
|
|
// ** does not release an OFD lock and vice versa - so from the first lock
|
|
// ** attempt in the process until sqlite3_shutdown() the setting is frozen and
|
|
// ** modernc_ofd_locking() refuses to change it.
|
|
// **
|
|
// ** Kernels before 3.15 reject F_OFD_* with EINVAL: if the very first OFD
|
|
// ** fcntl() fails that way the library falls back to POSIX locks for good.
|
|
// ** Once an OFD fcntl() has succeeded the mode is fixed: a later EINVAL is
|
|
// ** returned to the caller as the I/O error it is, because switching modes
|
|
// ** while OFD locks are held would leave them behind.
|
|
// **
|
|
// ** Database-file locks go through osFcntlOfd() rather than
|
|
// ** osSetPosixAdvisoryLock(), which only the -shm locks still use; with
|
|
// ** SQLITE_ENABLE_SETLK_TIMEOUT that would silently drop the blocking-lock
|
|
// ** timeout for the database file, hence the tripwire.
|
|
// */
|
|
func Xmodernc_ofd_locking(tls *libc.TLS, onoff int32) (r int32) {
|
|
_ = onoff
|
|
return -int32(1)
|
|
}
|
|
|
|
// C documentation
|
|
//
|
|
// /*
|
|
// ** Shutdown the operating system interface.
|
|
// **
|
|
// ** Some operating systems might need to do some cleanup in this routine,
|
|
// ** to release dynamically allocated objects. But not on unix.
|
|
// ** This routine is a no-op for unix.
|
|
// */
|
|
func Xsqlite3_os_end(tls *libc.TLS) (r int32) {
|
|
_unixBigLock = uintptr(0)
|
|
return SQLITE_OK
|
|
}
|
|
|
|
/************** End of os_unix.c *********************************************/
|
|
/************** Begin file os_win.c ******************************************/
|
|
/*
|
|
** 2004 May 22
|
|
**
|
|
** The author disclaims copyright to this source code. In place of
|
|
** a legal notice, here is a blessing:
|
|
**
|
|
** May you do good and not evil.
|
|
** May you find forgiveness for yourself and forgive others.
|
|
** May you share freely, never taking more than you give.
|
|
**
|
|
******************************************************************************
|
|
**
|
|
** This file contains code that is specific to Windows.
|
|
*/
|
|
/* #include "sqliteInt.h" */
|
|
|
|
/************** End of os_win.c **********************************************/
|
|
/************** Begin file memdb.c *******************************************/
|
|
/*
|
|
** 2016-09-07
|
|
**
|
|
** The author disclaims copyright to this source code. In place of
|
|
** a legal notice, here is a blessing:
|
|
**
|
|
** May you do good and not evil.
|
|
** May you find forgiveness for yourself and forgive others.
|
|
** May you share freely, never taking more than you give.
|
|
**
|
|
******************************************************************************
|
|
**
|
|
** This file implements an in-memory VFS. A database is held as a contiguous
|
|
** block of memory.
|
|
**
|
|
** This file also implements interface sqlite3_serialize() and
|
|
** sqlite3_deserialize().
|
|
*/
|
|
/* #include "sqliteInt.h" */
|
|
|
|
const _CS_PATH = 1
|
|
|
|
const _PC_CHOWN_RESTRICTED = 7
|
|
|
|
const _PC_LINK_MAX = 1
|
|
|
|
const _PC_MAX_CANON = 2
|
|
|
|
const _PC_MAX_INPUT = 3
|
|
|
|
const _PC_NAME_MAX = 4
|
|
|
|
const _PC_NO_TRUNC = 8
|
|
|
|
const _PC_PATH_MAX = 5
|
|
|
|
const _PC_PIPE_BUF = 6
|
|
|
|
const _PC_VDISABLE = 9
|
|
|
|
const _POSIX2_C_BIND = 200112
|
|
|
|
const _POSIX_CLOCK_SELECTION = -1
|
|
|
|
const _POSIX_PRIORITIZED_IO = -1
|
|
|
|
const _POSIX_READER_WRITER_LOCKS = 200112
|
|
|
|
const _POSIX_THREADS = 200112
|
|
|
|
const _POSIX_THREAD_ATTR_STACKADDR = 200112
|
|
|
|
const _POSIX_THREAD_ATTR_STACKSIZE = 200112
|
|
|
|
const _POSIX_VDISABLE = 255
|
|
|
|
const _QUAD_HIGHWORD = 1
|
|
|
|
const _QUAD_LOWWORD = 0
|
|
|
|
const _SC_2_CHAR_TERM = 20
|
|
|
|
const _SC_2_C_BIND = 18
|
|
|
|
const _SC_2_C_DEV = 19
|
|
|
|
const _SC_2_FORT_DEV = 21
|
|
|
|
const _SC_2_FORT_RUN = 22
|
|
|
|
const _SC_2_LOCALEDEF = 23
|
|
|
|
const _SC_2_SW_DEV = 24
|
|
|
|
const _SC_2_UPE = 25
|
|
|
|
const _SC_2_VERSION = 17
|
|
|
|
const _SC_ARG_MAX = 1
|
|
|
|
const _SC_BC_BASE_MAX = 9
|
|
|
|
const _SC_BC_DIM_MAX = 10
|
|
|
|
const _SC_BC_SCALE_MAX = 11
|
|
|
|
const _SC_BC_STRING_MAX = 12
|
|
|
|
const _SC_CHILD_MAX = 2
|
|
|
|
const _SC_COLL_WEIGHTS_MAX = 13
|
|
|
|
const _SC_EXPR_NEST_MAX = 14
|
|
|
|
const _SC_JOB_CONTROL = 6
|
|
|
|
const _SC_LINE_MAX = 15
|
|
|
|
const _SC_NGROUPS_MAX = 4
|
|
|
|
const _SC_OPEN_MAX = 5
|
|
|
|
const _SC_RE_DUP_MAX = 16
|
|
|
|
const _SC_SAVED_IDS = 7
|
|
|
|
const _SC_STREAM_MAX = 26
|
|
|
|
const _SC_TZNAME_MAX = 27
|
|
|
|
const _SC_VERSION = 8
|
|
|
|
const __WINT_MAX__ = 2147483647
|
|
|
|
const __WINT_TYPE__ = "int"
|
|
|
|
const __volatile = "volatile"
|
|
|
|
// C documentation
|
|
//
|
|
// /* This variable holds the process id (pid) from when the xRandomness()
|
|
// ** method was called. If xOpen() is called from a different process id,
|
|
// ** indicating that a fork() has occurred, the PRNG will be reset.
|
|
// */
|
|
var _randomnessPid = int32(0)
|
|
|
|
/*
|
|
** Allowed values for the unixFile.ctrlFlags bitmask:
|
|
*/
|
|
|
|
/*
|
|
** Include code that is common to all os_*.c files
|
|
*/
|
|
/* #include "os_common.h" */
|
|
|
|
/*
|
|
** Define various macros that are missing from some systems.
|
|
*/
|
|
|
|
/*
|
|
** The threadid macro resolves to the thread-id or to 0. Used for
|
|
** testing and debugging only.
|
|
*/
|
|
|
|
/*
|
|
** HAVE_MREMAP defaults to true on Linux and false everywhere else.
|
|
*/
|
|
|
|
/*
|
|
** Explicitly call the 64-bit version of lseek() on Android. Otherwise, lseek()
|
|
** is the 32-bit version, even if _FILE_OFFSET_BITS=64 is defined.
|
|
*/
|
|
|
|
// C documentation
|
|
//
|
|
// /*
|
|
// ** If compiled with SQLITE_MUTEX_NOOP, then the no-op mutex implementation
|
|
// ** is used regardless of the run-time threadsafety setting.
|
|
// */
|
|
func _sqlite3DefaultMutex(tls *libc.TLS) (r uintptr) {
|
|
return _sqlite3NoopMutex(tls)
|
|
}
|
|
|
|
/************** End of mutex_noop.c ******************************************/
|
|
/************** Begin file mutex_unix.c **************************************/
|
|
/*
|
|
** 2007 August 28
|
|
**
|
|
** The author disclaims copyright to this source code. In place of
|
|
** a legal notice, here is a blessing:
|
|
**
|
|
** May you do good and not evil.
|
|
** May you find forgiveness for yourself and forgive others.
|
|
** May you share freely, never taking more than you give.
|
|
**
|
|
*************************************************************************
|
|
** This file contains the C functions that implement mutexes for pthreads
|
|
*/
|
|
/* #include "sqliteInt.h" */
|
|
|
|
/*
|
|
** The code in this file is only used if we are compiling threadsafe
|
|
** under unix with pthreads.
|
|
**
|
|
** Note that this implementation requires a version of pthreads that
|
|
** supports recursive mutexes.
|
|
*/
|
|
|
|
/************** End of mutex_unix.c ******************************************/
|
|
/************** Begin file mutex_w32.c ***************************************/
|
|
/*
|
|
** 2007 August 14
|
|
**
|
|
** The author disclaims copyright to this source code. In place of
|
|
** a legal notice, here is a blessing:
|
|
**
|
|
** May you do good and not evil.
|
|
** May you find forgiveness for yourself and forgive others.
|
|
** May you share freely, never taking more than you give.
|
|
**
|
|
*************************************************************************
|
|
** This file contains the C functions that implement mutexes for Win32.
|
|
*/
|
|
/* #include "sqliteInt.h" */
|
|
|
|
/*
|
|
** The code in this file is only used if we are compiling multithreaded
|
|
** on a Win32 system.
|
|
*/
|
|
|
|
/************** End of mutex_w32.c *******************************************/
|
|
/************** Begin file malloc.c ******************************************/
|
|
/*
|
|
** 2001 September 15
|
|
**
|
|
** The author disclaims copyright to this source code. In place of
|
|
** a legal notice, here is a blessing:
|
|
**
|
|
** May you do good and not evil.
|
|
** May you find forgiveness for yourself and forgive others.
|
|
** May you share freely, never taking more than you give.
|
|
**
|
|
*************************************************************************
|
|
**
|
|
** Memory allocation functions used throughout sqlite.
|
|
*/
|
|
/* #include "sqliteInt.h" */
|
|
/* #include <stdarg.h> */
|
|
|
|
// C documentation
|
|
//
|
|
// /* Get the results of the thread */
|
|
func _sqlite3ThreadJoin(tls *libc.TLS, p uintptr, ppOut uintptr) (r int32) {
|
|
if p == uintptr(0) {
|
|
return int32(SQLITE_NOMEM)
|
|
}
|
|
if (*TSQLiteThread)(unsafe.Pointer(p)).FxTask != 0 {
|
|
**(**uintptr)(__ccgo_up(ppOut)) = (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TSQLiteThread)(unsafe.Pointer(p)).FxTask})))(tls, (*TSQLiteThread)(unsafe.Pointer(p)).FpIn)
|
|
} else {
|
|
**(**uintptr)(__ccgo_up(ppOut)) = (*TSQLiteThread)(unsafe.Pointer(p)).FpResult
|
|
}
|
|
Xsqlite3_free(tls, p)
|
|
return SQLITE_OK
|
|
}
|
|
|
|
/****************************** End Single-Threaded *************************/
|
|
|
|
/************** End of threads.c *********************************************/
|
|
/************** Begin file utf.c *********************************************/
|
|
/*
|
|
** 2004 April 13
|
|
**
|
|
** The author disclaims copyright to this source code. In place of
|
|
** a legal notice, here is a blessing:
|
|
**
|
|
** May you do good and not evil.
|
|
** May you find forgiveness for yourself and forgive others.
|
|
** May you share freely, never taking more than you give.
|
|
**
|
|
*************************************************************************
|
|
** This file contains routines used to translate between UTF-8,
|
|
** UTF-16, UTF-16BE, and UTF-16LE.
|
|
**
|
|
** Notes on UTF-8:
|
|
**
|
|
** Byte-0 Byte-1 Byte-2 Byte-3 Value
|
|
** 0xxxxxxx 00000000 00000000 0xxxxxxx
|
|
** 110yyyyy 10xxxxxx 00000000 00000yyy yyxxxxxx
|
|
** 1110zzzz 10yyyyyy 10xxxxxx 00000000 zzzzyyyy yyxxxxxx
|
|
** 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx 000uuuuu zzzzyyyy yyxxxxxx
|
|
**
|
|
**
|
|
** Notes on UTF-16: (with wwww+1==uuuuu)
|
|
**
|
|
** Word-0 Word-1 Value
|
|
** 110110ww wwzzzzyy 110111yy yyxxxxxx 000uuuuu zzzzyyyy yyxxxxxx
|
|
** zzzzyyyy yyxxxxxx 00000000 zzzzyyyy yyxxxxxx
|
|
**
|
|
**
|
|
** BOM or Byte Order Mark:
|
|
** 0xff 0xfe little-endian utf-16 follows
|
|
** 0xfe 0xff big-endian utf-16 follows
|
|
**
|
|
*/
|
|
/* #include "sqliteInt.h" */
|
|
/* #include <assert.h> */
|
|
/* #include "vdbeInt.h" */
|
|
|
|
// C documentation
|
|
//
|
|
// /*
|
|
// ** Implement a memory barrier or memory fence on shared memory.
|
|
// **
|
|
// ** All loads and stores begun before the barrier must complete before
|
|
// ** any load or store begun after the barrier.
|
|
// */
|
|
func _unixShmBarrier(tls *libc.TLS, fd uintptr) {
|
|
_ = fd
|
|
/* compiler-defined memory barrier */
|
|
_unixEnterMutex(tls) /* Also mutex, for redundancy */
|
|
_unixLeaveMutex(tls)
|
|
}
|
|
|
|
type daddr_t = Tdaddr_t
|
|
|
|
type fixpt_t = Tfixpt_t
|
|
|
|
const osFcntlOfd = "osFcntl"
|
|
|
|
type rlim_t = Trlim_t
|
|
|
|
type segsz_t = Tsegsz_t
|
|
|
|
type t__int16_t = int16
|
|
|
|
type t__int32_t = int32
|
|
|
|
type t__int64_t = int64
|
|
|
|
type t__int8_t = int8
|
|
|
|
type t__uint16_t = uint16
|
|
|
|
type t__uint32_t = uint32
|
|
|
|
type t__uint64_t = uint64
|
|
|
|
type t__uint8_t = uint8
|