mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 00:02:25 -05:00
[chore]: Bump modernc.org/sqlite from 1.28.0 to 1.29.2 (#2718)
This commit is contained in:
parent
ea0efb8094
commit
adb4cdcf6c
356 changed files with 2619858 additions and 1869411 deletions
231
vendor/modernc.org/sqlite/Makefile
generated
vendored
231
vendor/modernc.org/sqlite/Makefile
generated
vendored
|
|
@ -1,42 +1,12 @@
|
|||
# Copyright 2017 The Sqlite Authors. All rights reserved.
|
||||
# Copyright 2024 The Sqlite Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
.PHONY: all clean cover cpu editor internalError later mem nuke todo edit tcl extraquick full tidy uncomment unconvert
|
||||
|
||||
grep=--include=*.go --include=*.l --include=*.y --include=*.yy
|
||||
ngrep='TODOOK\|internal\/vfs\|internal\/bin\|internal\/mptest\|.*stringer.*\.go'
|
||||
host=$(shell go env GOOS)-$(shell go env GOARCH)
|
||||
testlog=testdata/testlog-$(shell echo $$GOOS)-$(shell echo $$GOARCH)$(shell echo $$SQLITE_TEST_SUFFIX)
|
||||
.PHONY: all build_all_targets clean edit editor test vendor work
|
||||
|
||||
all: editor
|
||||
date
|
||||
go version 2>&1 | tee log
|
||||
./unconvert.sh
|
||||
gofmt -l -s -w *.go
|
||||
go test -i
|
||||
go test -v 2>&1 -timeout 24h | tee -a log
|
||||
go run speedtest1/main_$(shell go env GOOS)_$(shell go env GOARCH).go
|
||||
golint 2>&1 | grep -v $(ngrep) || true
|
||||
misspell *.go
|
||||
staticcheck || true
|
||||
maligned || true
|
||||
git diff --unified=0 testdata *.golden
|
||||
grep -n --color=always 'FAIL\|PASS' log
|
||||
go version
|
||||
date 2>&1 | tee -a log
|
||||
|
||||
# $ go install modernc.org/uncomment@latest
|
||||
uncomment:
|
||||
uncomment -v -gofmt libtest/sqlite*.go internal/mptest/main*.go internal/testfixture/testfixture*.go speedtest1/main*.go vfs/vfs*.go
|
||||
uncomment -v -gofmt -keep-godoc lib/sqlite*.go
|
||||
|
||||
# $ go install github.com/mdempsky/unconvert@latest
|
||||
unconvert:
|
||||
./unconvert.sh && echo ok || echo fail
|
||||
|
||||
tidy: uncomment unconvert
|
||||
gofmt -l -s -w .
|
||||
golint 2>&1
|
||||
staticcheck 2>&1
|
||||
|
||||
build_all_targets:
|
||||
GOOS=darwin GOARCH=amd64 go test -c -o /dev/null
|
||||
|
|
@ -60,183 +30,34 @@ build_all_targets:
|
|||
GOOS=windows GOARCH=arm64 go test -c -o /dev/null
|
||||
echo done
|
||||
|
||||
# 3900x
|
||||
windows_amd64:
|
||||
@echo "Should be executed only on linux/amd64."
|
||||
CCGO_CPP=x86_64-w64-mingw32-cpp TARGET_GOOS=windows TARGET_GOARCH=amd64 go generate 2>&1 | tee log-generate
|
||||
GOOS=windows GOARCH=amd64 go test -c -o /dev/null
|
||||
|
||||
windows_arm64:
|
||||
go run addport.go windows_amd64 windows_arm64
|
||||
GOOS=windows GOARCH=arm64 go test -c -o /dev/null
|
||||
|
||||
# 3900x
|
||||
windows_386:
|
||||
@echo "Should be executed only on linux/amd64."
|
||||
CCGO_CPP=i686-w64-mingw32-cpp TARGET_GOOS=windows TARGET_GOARCH=386 go generate 2>&1 | tee log-generate
|
||||
GOOS=windows GOARCH=386 go test -c -o /dev/null
|
||||
|
||||
# 3900x/qemu
|
||||
darwin_amd64:
|
||||
@echo "Should be executed only on darwin/amd64."
|
||||
go generate 2>&1 | tee log-generate
|
||||
go test -c -o /dev/null
|
||||
|
||||
# 3900x/qemu
|
||||
netbsd_amd64:
|
||||
@echo "Should be executed only on netbsd/amd64."
|
||||
go generate 2>&1 | tee log-generate
|
||||
go test -c -o /dev/null
|
||||
|
||||
# darwin-m1
|
||||
darwin_arm64:
|
||||
@echo "Should be executed only on darwin/arm64."
|
||||
go generate 2>&1 | tee log-generate
|
||||
go test -c -o /dev/null
|
||||
|
||||
# 3900x/qemu
|
||||
freebsd_amd64:
|
||||
@echo "Should be executed only on freebsd/amd64."
|
||||
go generate 2>&1 | tee log-generate
|
||||
go test -c -o /dev/null
|
||||
|
||||
freebsd_arm64:
|
||||
go run addport.go freebsd_amd64 freebsd_arm64
|
||||
GOOS=freebsd GOARCH=arm64 go test -c -o /dev/null
|
||||
|
||||
# 3900x/qemu
|
||||
freebsd_386:
|
||||
@echo "Should be executed only on freebsd/386."
|
||||
go generate 2>&1 | tee log-generate
|
||||
go test -c -o /dev/null
|
||||
|
||||
# 3900x/qemu
|
||||
freebsd_arm:
|
||||
@echo "Should be executed only on freebsd/arm."
|
||||
go generate 2>&1 | tee log-generate
|
||||
go test -c -o /dev/null
|
||||
|
||||
# 3900x
|
||||
linux_amd64:
|
||||
@echo "Should be executed only on linux/amd64."
|
||||
go generate 2>&1 | tee log-generate
|
||||
go test -c -o /dev/null
|
||||
|
||||
# 3900x
|
||||
linux_386:
|
||||
@echo "Should be executed only on linux/amd64."
|
||||
CCGO_CPP=i686-linux-gnu-cpp TARGET_GOARCH=386 TARGET_GOOS=linux go generate 2>&1 | tee log-generate
|
||||
GOOS=linux GOARCH=386 go test -c -o /dev/null
|
||||
|
||||
# 3900x
|
||||
linux_arm:
|
||||
@echo "Should be executed only on linux/amd64."
|
||||
CCGO_CPP=arm-linux-gnueabi-cpp TARGET_GOARCH=arm TARGET_GOOS=linux go generate 2>&1 | tee log-generate
|
||||
GOOS=linux GOARCH=arm go test -c -o /dev/null
|
||||
|
||||
# 3900x
|
||||
linux_arm64:
|
||||
@echo "Should be executed only on linux/amd64."
|
||||
CCGO_CPP=aarch64-linux-gnu-cpp TARGET_GOARCH=arm64 TARGET_GOOS=linux go generate 2>&1 | tee log-generate
|
||||
GOOS=linux GOARCH=arm64 go test -c -o /dev/null
|
||||
|
||||
# 3900x
|
||||
linux_ppc64le:
|
||||
@echo "Should be executed only on linux/amd64."
|
||||
CCGO_CPP=powerpc64le-linux-gnu-cpp TARGET_GOARCH=ppc64le TARGET_GOOS=linux go generate 2>&1 | tee log-generate
|
||||
GOOS=linux GOARCH=ppc64le go test -c -o /dev/null
|
||||
|
||||
# linux/riscv64
|
||||
linux_riscv64:
|
||||
@echo "Should be executed only on linux/amd64."
|
||||
CCGO_CPP=riscv64-linux-gnu-cpp TARGET_GOARCH=riscv64 TARGET_GOOS=linux go generate 2>&1 | tee log-generate
|
||||
GOOS=linux GOARCH=riscv64 go test -c -o /dev/null
|
||||
|
||||
# 3900x
|
||||
linux_s390x:
|
||||
@echo "Should be executed only on linux/amd64."
|
||||
CCGO_CPP=s390x-linux-gnu-cpp TARGET_GOARCH=s390x TARGET_GOOS=linux go generate 2>&1 | tee log-generate
|
||||
GOOS=linux GOARCH=s390x go test -c -o /dev/null
|
||||
|
||||
# 3900x/qemu
|
||||
openbsd_amd64:
|
||||
@echo "Should be executed only on openbsd/amd64."
|
||||
go generate 2>&1 | tee log-generate
|
||||
go test -c -o /dev/null
|
||||
|
||||
# 3900x/qemu
|
||||
openbsd_arm64:
|
||||
@echo "Should be executed only on openbsd/arm64."
|
||||
GOGC=10 GOMEMLIMIT=6GiB go generate 2>&1 | tee log-generate
|
||||
go test -c -o /dev/null
|
||||
|
||||
generate_all_targets_on_linux_amd64: linux_amd64 linux_386 linux_arm linux_arm64 linux_s390x linux_ppc64le linux_riscv64 windows_amd64 windows_arm64 #TODO windows_386
|
||||
gofmt -l -s -w .
|
||||
echo done
|
||||
|
||||
tcl_test_wine:
|
||||
GOOS=windows GOARCH=amd64 go build -o testfixture.exe modernc.org/sqlite/internal/testfixture
|
||||
|
||||
run_tcl_test_wine:
|
||||
TCL_LIBRARY=Z:/home/jnml/src/modernc.org/tcl/assets wine testfixture.exe ./testdata/tcl/zipfile.test
|
||||
|
||||
extraquick:
|
||||
go test -timeout 24h -v -failfast -suite extraquick -maxerror 1 2>&1 | tee log-extraquick
|
||||
date
|
||||
|
||||
full:
|
||||
go test -timeout 24h -v -run Tcl -suite full 2>&1 | tee log-full
|
||||
date
|
||||
|
||||
clean:
|
||||
rm -f log-* cpu.test mem.test *.out go.work*
|
||||
go clean
|
||||
rm -f *~ *.test *.out test.db* tt4-test*.db* test_sv.* testdb-*
|
||||
|
||||
cover:
|
||||
t=$(shell tempfile) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t
|
||||
|
||||
cpu: clean
|
||||
go test -run @ -bench . -cpuprofile cpu.out
|
||||
go tool pprof -lines *.test cpu.out
|
||||
|
||||
edit:
|
||||
@touch log
|
||||
@if [ -f "Session.vim" ]; then gvim -S & else gvim -p Makefile all_test.go sqlite.go & fi
|
||||
@if [ -f "Session.vim" ]; then novim -S & else novim -p Makefile all_test.go generator.go & fi
|
||||
|
||||
editor:
|
||||
gofmt -l -s -w *.go
|
||||
go install -v ./...
|
||||
go test -c -o /dev/null -tags=cgo,cgotest
|
||||
gofmt -l -s -w . 2>&1 | tee log-editor
|
||||
go test -c -o /dev/null 2>&1 | tee -a log-editor
|
||||
go build -v -o /dev/null ./... 2>&1 | tee -a log-editor
|
||||
go build -o /dev/null migrate.go
|
||||
|
||||
internalError:
|
||||
egrep -ho '"internal error.*"' *.go | sort | cat -n
|
||||
test:
|
||||
go test -v -timeout 24h 2>&1 | tee log-test
|
||||
|
||||
vendor:
|
||||
go run vendor_libsqlite3.go && make build_all_targets
|
||||
|
||||
later:
|
||||
@grep -n $(grep) LATER * || true
|
||||
@grep -n $(grep) MAYBE * || true
|
||||
|
||||
mem: clean
|
||||
go test -run @ -bench . -memprofile mem.out -memprofilerate 1 -timeout 24h
|
||||
go tool pprof -lines -web -alloc_space *.test mem.out
|
||||
|
||||
memgrind:
|
||||
go test -v -timeout 24h -tags libc.memgrind,cgobench -bench . -suite extraquick -xtags=libc.memgrind
|
||||
|
||||
regression_base_release:
|
||||
GO111MODULE=on go test -v -timeout 24h -tags=cgobench -run @ -bench '(Reading1|InsertComparative)/sqlite[^3]' -recs_per_sec_as_mbps 2>&1 | tee log-regression-base
|
||||
|
||||
regression_base_master:
|
||||
GO111MODULE=off go test -v -timeout 24h -tags=cgobench -run @ -bench '(Reading1|InsertComparative)/sqlite[^3]' -recs_per_sec_as_mbps 2>&1 | tee log-regression-base
|
||||
|
||||
regression_check:
|
||||
GO111MODULE=off go test -v -timeout 24h -tags=cgobench -run @ -bench '(Reading1|InsertComparative)/sqlite[^3]' -recs_per_sec_as_mbps 2>&1 | tee log-regression
|
||||
benchcmp -changed -mag log-regression-base log-regression
|
||||
|
||||
nuke: clean
|
||||
go clean -i
|
||||
|
||||
todo:
|
||||
@grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * | grep -v $(ngrep) || true
|
||||
@grep -nr $(grep) TODO * | grep -v $(ngrep) || true
|
||||
@grep -nr $(grep) BUG * | grep -v $(ngrep) || true
|
||||
@grep -nr $(grep) [^[:alpha:]]println * | grep -v $(ngrep) || true
|
||||
work:
|
||||
rm -f go.work*
|
||||
go work init
|
||||
go work use .
|
||||
go work use ../cc/v4
|
||||
go work use ../ccgo/v3
|
||||
go work use ../ccgo/v4
|
||||
go work use ../libc
|
||||
go work use ../libtcl8.6
|
||||
go work use ../libsqlite3
|
||||
go work use ../libz
|
||||
|
|
|
|||
85
vendor/modernc.org/sqlite/doc.go
generated
vendored
85
vendor/modernc.org/sqlite/doc.go
generated
vendored
|
|
@ -19,19 +19,19 @@
|
|||
//
|
||||
// OS Arch SQLite version
|
||||
// ------------------------------
|
||||
// darwin amd64 3.41.2
|
||||
// darwin arm64 3.41.2
|
||||
// freebsd amd64 3.41.2
|
||||
// freebsd arm64 3.41.2
|
||||
// linux 386 3.41.2
|
||||
// linux amd64 3.41.2
|
||||
// linux arm 3.41.2
|
||||
// linux arm64 3.41.2
|
||||
// linux ppc64le 3.41.2
|
||||
// linux riscv64 3.41.2
|
||||
// linux s390x 3.41.2
|
||||
// windows amd64 3.41.2
|
||||
// windows arm64 3.41.2
|
||||
// darwin amd64 3.45.1
|
||||
// darwin arm64 3.45.1
|
||||
// freebsd amd64 3.45.1
|
||||
// freebsd arm64 3.45.1
|
||||
// linux 386 3.45.1
|
||||
// linux amd64 3.45.1
|
||||
// linux arm 3.45.1
|
||||
// linux arm64 3.45.1
|
||||
// linux ppc64le 3.45.1
|
||||
// linux riscv64 3.45.1
|
||||
// linux s390x 3.45.1
|
||||
// windows amd64 3.45.1
|
||||
// windows arm64 3.45.1
|
||||
//
|
||||
// # Builders
|
||||
//
|
||||
|
|
@ -39,62 +39,13 @@
|
|||
//
|
||||
// https://modern-c.appspot.com/-/builder/?importpath=modernc.org%2fsqlite
|
||||
//
|
||||
// # Speedtest1
|
||||
//
|
||||
// Numbers for the pure Go version were produced by
|
||||
//
|
||||
// ~/src/modernc.org/sqlite/speedtest1$ go build && ./speedtest1
|
||||
//
|
||||
// Numbers for the pure C version were produced by
|
||||
//
|
||||
// ~/src/modernc.org/sqlite/testdata/sqlite-src-3410200/test$ gcc speedtest1.c ../../sqlite-amalgamation-3410200/sqlite3.c -lpthread -ldl && ./a.out
|
||||
//
|
||||
// The results are from Go version 1.20.4 and GCC version 10.2.1 on a
|
||||
// Linux/amd64 machine, CPU: AMD Ryzen 9 3900X 12-Core Processor × 24, 128GB
|
||||
// RAM. Shown are the best of 3 runs.
|
||||
//
|
||||
// Go C
|
||||
//
|
||||
// -- Speedtest1 for SQLite 3.41.2 2023-03-22 11:56:21 0d1fc92f94cb6b76bffe3ec34d69 -- Speedtest1 for SQLite 3.41.2 2023-03-22 11:56:21 0d1fc92f94cb6b76bffe3ec34d69
|
||||
// 100 - 50000 INSERTs into table with no index...................... 0.071s 100 - 50000 INSERTs into table with no index...................... 0.077s
|
||||
// 110 - 50000 ordered INSERTS with one index/PK..................... 0.114s 110 - 50000 ordered INSERTS with one index/PK..................... 0.082s
|
||||
// 120 - 50000 unordered INSERTS with one index/PK................... 0.137s 120 - 50000 unordered INSERTS with one index/PK................... 0.099s
|
||||
// 130 - 25 SELECTS, numeric BETWEEN, unindexed...................... 0.083s 130 - 25 SELECTS, numeric BETWEEN, unindexed...................... 0.091s
|
||||
// 140 - 10 SELECTS, LIKE, unindexed................................. 0.210s 140 - 10 SELECTS, LIKE, unindexed................................. 0.120s
|
||||
// 142 - 10 SELECTS w/ORDER BY, unindexed............................ 0.276s 142 - 10 SELECTS w/ORDER BY, unindexed............................ 0.182s
|
||||
// 145 - 10 SELECTS w/ORDER BY and LIMIT, unindexed.................. 0.183s 145 - 10 SELECTS w/ORDER BY and LIMIT, unindexed.................. 0.099s
|
||||
// 150 - CREATE INDEX five times..................................... 0.172s 150 - CREATE INDEX five times..................................... 0.127s
|
||||
// 160 - 10000 SELECTS, numeric BETWEEN, indexed..................... 0.080s 160 - 10000 SELECTS, numeric BETWEEN, indexed..................... 0.078s
|
||||
// 161 - 10000 SELECTS, numeric BETWEEN, PK.......................... 0.080s 161 - 10000 SELECTS, numeric BETWEEN, PK.......................... 0.078s
|
||||
// 170 - 10000 SELECTS, text BETWEEN, indexed........................ 0.187s 170 - 10000 SELECTS, text BETWEEN, indexed........................ 0.169s
|
||||
// 180 - 50000 INSERTS with three indexes............................ 0.196s 180 - 50000 INSERTS with three indexes............................ 0.154s
|
||||
// 190 - DELETE and REFILL one table................................. 0.200s 190 - DELETE and REFILL one table................................. 0.155s
|
||||
// 200 - VACUUM...................................................... 0.180s 200 - VACUUM...................................................... 0.142s
|
||||
// 210 - ALTER TABLE ADD COLUMN, and query........................... 0.004s 210 - ALTER TABLE ADD COLUMN, and query........................... 0.005s
|
||||
// 230 - 10000 UPDATES, numeric BETWEEN, indexed..................... 0.093s 230 - 10000 UPDATES, numeric BETWEEN, indexed..................... 0.080s
|
||||
// 240 - 50000 UPDATES of individual rows............................ 0.153s 240 - 50000 UPDATES of individual rows............................ 0.137s
|
||||
// 250 - One big UPDATE of the whole 50000-row table................. 0.024s 250 - One big UPDATE of the whole 50000-row table................. 0.019s
|
||||
// 260 - Query added column after filling............................ 0.004s 260 - Query added column after filling............................ 0.005s
|
||||
// 270 - 10000 DELETEs, numeric BETWEEN, indexed..................... 0.278s 270 - 10000 DELETEs, numeric BETWEEN, indexed..................... 0.263s
|
||||
// 280 - 50000 DELETEs of individual rows............................ 0.188s 280 - 50000 DELETEs of individual rows............................ 0.180s
|
||||
// 290 - Refill two 50000-row tables using REPLACE................... 0.411s 290 - Refill two 50000-row tables using REPLACE................... 0.359s
|
||||
// 300 - Refill a 50000-row table using (b&1)==(a&1)................. 0.175s 300 - Refill a 50000-row table using (b&1)==(a&1)................. 0.151s
|
||||
// 310 - 10000 four-ways joins....................................... 0.427s 310 - 10000 four-ways joins....................................... 0.365s
|
||||
// 320 - subquery in result set...................................... 0.440s 320 - subquery in result set...................................... 0.521s
|
||||
// 400 - 70000 REPLACE ops on an IPK................................. 0.125s 400 - 70000 REPLACE ops on an IPK................................. 0.106s
|
||||
// 410 - 70000 SELECTS on an IPK..................................... 0.081s 410 - 70000 SELECTS on an IPK..................................... 0.078s
|
||||
// 500 - 70000 REPLACE on TEXT PK.................................... 0.174s 500 - 70000 REPLACE on TEXT PK.................................... 0.116s
|
||||
// 510 - 70000 SELECTS on a TEXT PK.................................. 0.153s 510 - 70000 SELECTS on a TEXT PK.................................. 0.117s
|
||||
// 520 - 70000 SELECT DISTINCT....................................... 0.083s 520 - 70000 SELECT DISTINCT....................................... 0.067s
|
||||
// 980 - PRAGMA integrity_check...................................... 0.436s 980 - PRAGMA integrity_check...................................... 0.377s
|
||||
// 990 - ANALYZE..................................................... 0.107s 990 - ANALYZE..................................................... 0.038s
|
||||
// TOTAL....................................................... 5.525s TOTAL....................................................... 4.637s
|
||||
//
|
||||
// This particular test executes 16.1% faster in the C version.
|
||||
//
|
||||
// # Changelog
|
||||
//
|
||||
// 2023-12-14 v1.28.0:
|
||||
// 2024-02-13: v1.29.0
|
||||
//
|
||||
// Upgrade to SQLite 3.45.1, release notes at https://sqlite.org/releaselog/3_45_1.html.
|
||||
//
|
||||
// 2023-12-14 v1.28.0:
|
||||
//
|
||||
// (*Driver).RegisterConnectionHook: added
|
||||
// ConnectionHookFn: added
|
||||
|
|
|
|||
887
vendor/modernc.org/sqlite/generator.go
generated
vendored
887
vendor/modernc.org/sqlite/generator.go
generated
vendored
|
|
@ -1,887 +0,0 @@
|
|||
// Copyright 2017 The Sqlite Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build generator
|
||||
// +build generator
|
||||
|
||||
//TODO 2023-02-23, netbsd/amd64 fails generating SQLite 3.41:
|
||||
//
|
||||
// C front end 36/85: testdata/sqlite-src-3410000/ext/recover/sqlite3recover.c ... testdata/sqlite-src-3410000/ext/recover/sqlite3recover.c:2023:41: front-end: undefined: SQLITE_FCNTL_RESET_CACHE
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"archive/zip"
|
||||
"bufio"
|
||||
"bytes"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"modernc.org/ccgo/v3/lib"
|
||||
)
|
||||
|
||||
// gcc
|
||||
// -g
|
||||
// -O2
|
||||
// -DSQLITE_OS_UNIX=1
|
||||
// -I.
|
||||
// -I/home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src
|
||||
// -I/home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/rtree
|
||||
// -I/home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/icu
|
||||
// -I/home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/fts3
|
||||
// -I/home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/async
|
||||
// -I/home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/session
|
||||
// -I/home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/userauth
|
||||
// -D_HAVE_SQLITE_CONFIG_H
|
||||
// -DBUILD_sqlite
|
||||
// -DNDEBUG
|
||||
// -I/usr/include/tcl8.6
|
||||
// -DSQLITE_THREADSAFE=1
|
||||
// -DSQLITE_HAVE_ZLIB=1
|
||||
// -DSQLITE_NO_SYNC=1
|
||||
// -DSQLITE_TEMP_STORE=1
|
||||
// -DSQLITE_TEST=1
|
||||
// -DSQLITE_CRASH_TEST=1
|
||||
// -DTCLSH_INIT_PROC=sqlite3TestInit
|
||||
// -DSQLITE_SERVER=1
|
||||
// -DSQLITE_PRIVATE=
|
||||
// -DSQLITE_CORE
|
||||
// -DBUILD_sqlite
|
||||
// -DSQLITE_SERIES_CONSTRAINT_VERIFY=1
|
||||
// -DSQLITE_DEFAULT_PAGE_SIZE=1024
|
||||
// -DSQLITE_ENABLE_STMTVTAB
|
||||
// -DSQLITE_ENABLE_DBPAGE_VTAB
|
||||
// -DSQLITE_ENABLE_BYTECODE_VTAB
|
||||
// -DSQLITE_ENABLE_DESERIALIZE
|
||||
// -o testfixture
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test1.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test2.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test3.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test4.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test5.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test6.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test7.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test8.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test9.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_autoext.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_async.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_backup.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_bestindex.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_blob.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_btree.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_config.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_delete.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_demovfs.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_devsym.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_fs.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_func.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_hexio.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_init.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_intarray.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_journal.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_malloc.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_md5.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_multiplex.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_mutex.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_onefile.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_osinst.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_pcache.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_quota.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_rtree.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_schema.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_server.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_superlock.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_syscall.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_tclsh.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_tclvar.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_thread.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_vdbecov.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_vfs.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_windirent.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_window.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/test_wsd.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/fts3/fts3_term.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/fts3/fts3_test.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/session/test_session.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/rbu/test_rbu.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/expert/sqlite3expert.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/expert/test_expert.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/amatch.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/carray.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/closure.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/csv.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/decimal.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/eval.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/explain.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/fileio.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/fuzzer.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/fts5/fts5_tcl.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/fts5/fts5_test_mi.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/fts5/fts5_test_tok.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/ieee754.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/mmapwarm.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/nextchar.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/normalize.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/percentile.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/prefixes.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/regexp.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/remember.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/series.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/spellfix.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/totype.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/unionvtab.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/wholenumber.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/misc/zipfile.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/ext/userauth/userauth.c
|
||||
// /home/jnml/src/modernc.org/sqlite/testdata/SQLite-3c5e63c2/src/tclsqlite.c
|
||||
// sqlite3.c
|
||||
// -L/usr/lib/x86_64-linux-gnu
|
||||
// -ltcl8.6
|
||||
// -ldl
|
||||
// -lz
|
||||
// -lpthread
|
||||
|
||||
const (
|
||||
volatiles = "-volatile=sqlite3_io_error_pending,sqlite3_open_file_count,sqlite3_pager_readdb_count,sqlite3_pager_writedb_count,sqlite3_pager_writej_count,sqlite3_search_count,sqlite3_sort_count,saved_cnt,randomnessPid"
|
||||
)
|
||||
|
||||
// 2022-11-27 Removing -DSQLITE_ENABLE_SNAPSHOT from configTest. This #define
|
||||
// makes a single test fail on linux/ppc64le. That test is run only when the
|
||||
// -DSQLITE_ENABLE_SNAPSHOT is present when compiling the testfixture. When
|
||||
// investigating the failure it turns out this #define is actually NOT present
|
||||
// when doing '$ ./configure && make tcltest' in sqlite-src-3400000, ie. in the
|
||||
// original C code.
|
||||
//
|
||||
// libtool: link: gcc -g -O2 -DSQLITE_OS_UNIX=1 -I. -I/home/jnml/sqlite-src-3400000/src -I/home/jnml/sqlite-src-3400000/ext/rtree -I/home/jnml/sqlite-src-3400000/ext/icu -I/home/jnml/sqlite-src-3400000/ext/fts3 -I/home/jnml/sqlite-src-3400000/ext/async -I/home/jnml/sqlite-src-3400000/ext/session -I/home/jnml/sqlite-src-3400000/ext/userauth -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -I/usr/include/tcl8.6 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_HAVE_ZLIB=1 -DSQLITE_NO_SYNC=1 -DSQLITE_TEMP_STORE=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 -DTCLSH_INIT_PROC=sqlite3TestInit -DSQLITE_SERVER=1 -DSQLITE_PRIVATE= -DSQLITE_CORE -DBUILD_sqlite -DSQLITE_SERIES_CONSTRAINT_VERIFY=1 -DSQLITE_DEFAULT_PAGE_SIZE=1024 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_ENABLE_BYTECODE_VTAB -DSQLITE_CKSUMVFS_STATIC -o testfixture ...
|
||||
|
||||
var (
|
||||
configProduction = []string{
|
||||
"-DHAVE_USLEEP",
|
||||
"-DLONGDOUBLE_TYPE=double",
|
||||
"-DSQLITE_CORE",
|
||||
"-DSQLITE_DEFAULT_MEMSTATUS=0",
|
||||
"-DSQLITE_ENABLE_COLUMN_METADATA",
|
||||
"-DSQLITE_ENABLE_DBSTAT_VTAB",
|
||||
"-DSQLITE_ENABLE_FTS5",
|
||||
"-DSQLITE_ENABLE_GEOPOLY",
|
||||
"-DSQLITE_ENABLE_MATH_FUNCTIONS",
|
||||
"-DSQLITE_ENABLE_MEMORY_MANAGEMENT",
|
||||
"-DSQLITE_ENABLE_OFFSET_SQL_FUNC",
|
||||
"-DSQLITE_ENABLE_PREUPDATE_HOOK",
|
||||
"-DSQLITE_ENABLE_RBU",
|
||||
"-DSQLITE_ENABLE_RTREE",
|
||||
"-DSQLITE_ENABLE_SESSION",
|
||||
"-DSQLITE_ENABLE_SNAPSHOT",
|
||||
"-DSQLITE_ENABLE_STAT4",
|
||||
"-DSQLITE_ENABLE_UNLOCK_NOTIFY", // Adds sqlite3_unlock_notify().
|
||||
"-DSQLITE_LIKE_DOESNT_MATCH_BLOBS",
|
||||
"-DSQLITE_MUTEX_APPDEF=1",
|
||||
"-DSQLITE_MUTEX_NOOP",
|
||||
"-DSQLITE_SOUNDEX",
|
||||
"-DSQLITE_THREADSAFE=1",
|
||||
//DONT "-DNDEBUG", // To enable GO_GENERATE=-DSQLITE_DEBUG
|
||||
//DONT "-DSQLITE_DQS=0", // testfixture
|
||||
//DONT "-DSQLITE_NO_SYNC=1",
|
||||
//DONT "-DSQLITE_OMIT_DECLTYPE", // testfixture
|
||||
//DONT "-DSQLITE_OMIT_DEPRECATED", // mptest
|
||||
//DONT "-DSQLITE_OMIT_LOAD_EXTENSION", // mptest
|
||||
//DONT "-DSQLITE_OMIT_SHARED_CACHE",
|
||||
//DONT "-DSQLITE_USE_ALLOCA",
|
||||
//TODO "-DHAVE_MALLOC_USABLE_SIZE"
|
||||
//TODO "-DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1", //TODO report bug
|
||||
//TODO "-DSQLITE_ENABLE_FTS3",
|
||||
//TODO "-DSQLITE_ENABLE_FTS3_PARENTHESIS",
|
||||
//TODO "-DSQLITE_ENABLE_FTS3_TOKENIZER",
|
||||
//TODO "-DSQLITE_ENABLE_FTS4",
|
||||
//TODO "-DSQLITE_ENABLE_ICU",
|
||||
//TODO "-DSQLITE_MAX_EXPR_DEPTH=0", // bug reported https://sqlite.org/forum/forumpost/87b9262f66, fixed in https://sqlite.org/src/info/5f58dd3a19605b6f
|
||||
//TODO "-DSQLITE_MAX_MMAP_SIZE=8589934592", // testfixture, bug reported https://sqlite.org/forum/forumpost/34380589f7, fixed in https://sqlite.org/src/info/d8e47382160e98be
|
||||
//TODO- "-DSQLITE_DEBUG",
|
||||
//TODO- "-DSQLITE_ENABLE_API_ARMOR",
|
||||
//TODO- "-DSQLITE_MEMDEBUG",
|
||||
}
|
||||
|
||||
configTest = []string{
|
||||
"-DHAVE_USLEEP",
|
||||
"-DLONGDOUBLE_TYPE=double",
|
||||
"-DSQLITE_CKSUMVFS_STATIC",
|
||||
"-DSQLITE_CORE", // testfixture
|
||||
"-DSQLITE_DEFAULT_MEMSTATUS=1",
|
||||
"-DSQLITE_DEFAULT_PAGE_SIZE=1024", // testfixture, hardcoded. See file_pages in autovacuum.test.
|
||||
"-DSQLITE_ENABLE_BYTECODE_VTAB", // testfixture
|
||||
"-DSQLITE_ENABLE_COLUMN_METADATA",
|
||||
"-DSQLITE_ENABLE_DBPAGE_VTAB", // testfixture
|
||||
"-DSQLITE_ENABLE_DBSTAT_VTAB",
|
||||
"-DSQLITE_ENABLE_DESERIALIZE", // testfixture
|
||||
"-DSQLITE_ENABLE_EXPLAIN_COMMENTS",
|
||||
"-DSQLITE_ENABLE_FTS5",
|
||||
"-DSQLITE_ENABLE_GEOPOLY",
|
||||
"-DSQLITE_ENABLE_MATH_FUNCTIONS",
|
||||
"-DSQLITE_ENABLE_MEMORY_MANAGEMENT",
|
||||
"-DSQLITE_ENABLE_OFFSET_SQL_FUNC",
|
||||
"-DSQLITE_ENABLE_PREUPDATE_HOOK",
|
||||
"-DSQLITE_ENABLE_RBU",
|
||||
"-DSQLITE_ENABLE_RTREE",
|
||||
"-DSQLITE_ENABLE_SESSION",
|
||||
"-DSQLITE_ENABLE_STAT4",
|
||||
"-DSQLITE_ENABLE_STMTVTAB", // testfixture
|
||||
"-DSQLITE_ENABLE_UNLOCK_NOTIFY", // Adds sqlite3_unlock_notify().
|
||||
"-DSQLITE_LIKE_DOESNT_MATCH_BLOBS",
|
||||
"-DSQLITE_MUTEX_APPDEF=1",
|
||||
"-DSQLITE_MUTEX_NOOP",
|
||||
"-DSQLITE_SOUNDEX",
|
||||
"-DSQLITE_TEMP_STORE=1", // testfixture
|
||||
"-DSQLITE_TEST",
|
||||
"-DSQLITE_THREADSAFE=1",
|
||||
//DONT "-DNDEBUG", // To enable GO_GENERATE=-DSQLITE_DEBUG
|
||||
//DONT "-DSQLITE_DQS=0", // testfixture
|
||||
//DONT "-DSQLITE_ENABLE_SNAPSHOT",
|
||||
//DONT "-DSQLITE_NO_SYNC=1",
|
||||
//DONT "-DSQLITE_OMIT_DECLTYPE", // testfixture
|
||||
//DONT "-DSQLITE_OMIT_DEPRECATED", // mptest
|
||||
//DONT "-DSQLITE_OMIT_LOAD_EXTENSION", // mptest
|
||||
//DONT "-DSQLITE_OMIT_SHARED_CACHE",
|
||||
//DONT "-DSQLITE_USE_ALLOCA",
|
||||
//TODO "-DHAVE_MALLOC_USABLE_SIZE"
|
||||
//TODO "-DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1", //TODO report bug
|
||||
//TODO "-DSQLITE_ENABLE_FTS3",
|
||||
//TODO "-DSQLITE_ENABLE_FTS3_PARENTHESIS",
|
||||
//TODO "-DSQLITE_ENABLE_FTS3_TOKENIZER",
|
||||
//TODO "-DSQLITE_ENABLE_FTS4",
|
||||
//TODO "-DSQLITE_ENABLE_ICU",
|
||||
//TODO "-DSQLITE_MAX_EXPR_DEPTH=0", // bug reported https://sqlite.org/forum/forumpost/87b9262f66, fixed in https://sqlite.org/src/info/5f58dd3a19605b6f
|
||||
//TODO "-DSQLITE_MAX_MMAP_SIZE=8589934592", // testfixture, bug reported https://sqlite.org/forum/forumpost/34380589f7, fixed in https://sqlite.org/src/info/d8e47382160e98be
|
||||
//TODO- "-DSQLITE_DEBUG",
|
||||
//TODO- "-DSQLITE_ENABLE_API_ARMOR",
|
||||
//TODO- "-DSQLITE_MEMDEBUG",
|
||||
}
|
||||
|
||||
downloads = []struct {
|
||||
dir, url string
|
||||
sz int
|
||||
dev bool
|
||||
}{
|
||||
{sqliteDir, "https://www.sqlite.org/2023/sqlite-amalgamation-3410200.zip", 2457, false},
|
||||
{sqliteSrcDir, "https://www.sqlite.org/2023/sqlite-src-3410200.zip", 12814, false},
|
||||
}
|
||||
|
||||
sqliteDir = filepath.FromSlash("testdata/sqlite-amalgamation-3410200")
|
||||
sqliteSrcDir = filepath.FromSlash("testdata/sqlite-src-3410200")
|
||||
)
|
||||
|
||||
func download() {
|
||||
tmp, err := os.MkdirTemp("", "")
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%s\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
defer os.RemoveAll(tmp)
|
||||
|
||||
for _, v := range downloads {
|
||||
dir := filepath.FromSlash(v.dir)
|
||||
root := filepath.Dir(v.dir)
|
||||
fi, err := os.Stat(dir)
|
||||
switch {
|
||||
case err == nil:
|
||||
if !fi.IsDir() {
|
||||
fmt.Fprintf(os.Stderr, "expected %s to be a directory\n", dir)
|
||||
}
|
||||
continue
|
||||
default:
|
||||
if !os.IsNotExist(err) {
|
||||
fmt.Fprintf(os.Stderr, "%s", err)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if err := func() error {
|
||||
fmt.Printf("Downloading %v MB from %s\n", float64(v.sz)/1000, v.url)
|
||||
resp, err := http.Get(v.url)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
base := filepath.Base(v.url)
|
||||
name := filepath.Join(tmp, base)
|
||||
f, err := os.Create(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer os.Remove(name)
|
||||
|
||||
n, err := io.Copy(f, resp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := f.Seek(0, io.SeekStart); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
switch {
|
||||
case strings.HasSuffix(base, ".zip"):
|
||||
r, err := zip.NewReader(f, n)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, f := range r.File {
|
||||
fi := f.FileInfo()
|
||||
if fi.IsDir() {
|
||||
if err := os.MkdirAll(filepath.Join(root, f.Name), 0770); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
if err := func() error {
|
||||
rc, err := f.Open()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer rc.Close()
|
||||
|
||||
file, err := os.OpenFile(filepath.Join(root, f.Name), os.O_CREATE|os.O_WRONLY, fi.Mode())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
w := bufio.NewWriter(file)
|
||||
if _, err = io.Copy(w, rc); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := w.Flush(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return file.Close()
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
panic("internal error") //TODOOK
|
||||
}(); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func fail(s string, args ...interface{}) {
|
||||
fmt.Fprintf(os.Stderr, s, args...)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
var (
|
||||
oFullPathComments = flag.Bool("full-path-comments", false, "")
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
fmt.Printf("Running on %s/%s.\n", runtime.GOOS, runtime.GOARCH)
|
||||
env := os.Getenv("GO_GENERATE")
|
||||
goarch := runtime.GOARCH
|
||||
goos := runtime.GOOS
|
||||
if s := os.Getenv("TARGET_GOOS"); s != "" {
|
||||
goos = s
|
||||
}
|
||||
if s := os.Getenv("TARGET_GOARCH"); s != "" {
|
||||
goarch = s
|
||||
}
|
||||
var more []string
|
||||
if env != "" {
|
||||
more = strings.Split(env, ",")
|
||||
}
|
||||
ndebug := []string{"-DNDEBUG"}
|
||||
for _, v := range more {
|
||||
if v == "-DSQLITE_DEBUG" {
|
||||
ndebug = nil
|
||||
}
|
||||
}
|
||||
more = append(more, ndebug...)
|
||||
download()
|
||||
switch goos {
|
||||
case "linux", "freebsd", "openbsd":
|
||||
configProduction = append(configProduction, "-DSQLITE_OS_UNIX=1")
|
||||
case "netbsd":
|
||||
configProduction = append(configProduction, []string{
|
||||
"-DSQLITE_OS_UNIX=1",
|
||||
"-D__libc_cond_broadcast=pthread_cond_broadcast",
|
||||
"-D__libc_cond_destroy=pthread_cond_destroy",
|
||||
"-D__libc_cond_init=pthread_cond_init",
|
||||
"-D__libc_cond_signal=pthread_cond_signal",
|
||||
"-D__libc_cond_wait=pthread_cond_wait",
|
||||
"-D__libc_mutex_destroy=pthread_mutex_destroy",
|
||||
"-D__libc_mutex_init=pthread_mutex_init",
|
||||
"-D__libc_mutex_lock=pthread_mutex_lock",
|
||||
"-D__libc_mutex_trylock=pthread_mutex_trylock",
|
||||
"-D__libc_mutex_unlock=pthread_mutex_unlock",
|
||||
"-D__libc_mutexattr_destroy=pthread_mutexattr_destroy",
|
||||
"-D__libc_mutexattr_init=pthread_mutexattr_init",
|
||||
"-D__libc_mutexattr_settype=pthread_mutexattr_settype",
|
||||
"-D__libc_thr_yield=sched_yield",
|
||||
}...)
|
||||
case "darwin":
|
||||
configProduction = append(configProduction,
|
||||
"-DSQLITE_OS_UNIX=1",
|
||||
"-DSQLITE_WITHOUT_ZONEMALLOC",
|
||||
)
|
||||
configTest = append(configTest,
|
||||
"-DSQLITE_OS_UNIX=1",
|
||||
"-DSQLITE_WITHOUT_ZONEMALLOC",
|
||||
)
|
||||
case "windows":
|
||||
configProduction = append(configProduction,
|
||||
"-DSQLITE_OS_WIN=1",
|
||||
"-D_MSC_VER=1900",
|
||||
)
|
||||
configTest = append(configTest,
|
||||
"-DSQLITE_OS_WIN=1",
|
||||
"-D_MSC_VER=1900",
|
||||
)
|
||||
default:
|
||||
fail("unknows/unsupported os: %s\n", goos)
|
||||
}
|
||||
makeSqliteProduction(goos, goarch, more)
|
||||
makeSqliteTest(goos, goarch, more)
|
||||
makeMpTest(goos, goarch, more)
|
||||
makeSpeedTest(goos, goarch, more)
|
||||
makeTestfixture(goos, goarch, more)
|
||||
ccgo.MustCopyDir(true, "testdata/tcl", sqliteSrcDir+"/test", nil)
|
||||
ccgo.MustCopyDir(true, "testdata/tcl", "testdata/overlay", nil)
|
||||
}
|
||||
|
||||
func configure(goos, goarch string) {
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
fail("%s", err)
|
||||
}
|
||||
|
||||
defer os.Chdir(wd)
|
||||
|
||||
if err := os.Chdir(sqliteSrcDir); err != nil {
|
||||
fail("%s", err)
|
||||
}
|
||||
|
||||
cmd := newCmd("make", "distclean")
|
||||
cmd.Run()
|
||||
var args []string
|
||||
switch goos {
|
||||
case "linux", "freebsd", "netbsd", "openbsd":
|
||||
// nop
|
||||
case "darwin":
|
||||
args = append(args, "--with-tcl=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework")
|
||||
case "windows":
|
||||
switch goarch {
|
||||
case "amd64":
|
||||
args = append(args, "--host=x86_64-w64-mingw32")
|
||||
case "386":
|
||||
args = append(args, "--host=i686-w64-mingw32")
|
||||
default:
|
||||
fail("unknown/unsupported os/arch: %s/%s\n", goos, goarch)
|
||||
}
|
||||
default:
|
||||
fail("unknown/unsupported os/arch: %s/%s\n", goos, goarch)
|
||||
}
|
||||
cmd = newCmd("./configure", args...)
|
||||
if err = cmd.Run(); err != nil {
|
||||
fail("%s\n", err)
|
||||
}
|
||||
|
||||
cmd = newCmd("make", "parse.h", "opcodes.h")
|
||||
if err = cmd.Run(); err != nil {
|
||||
fail("%s\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
func newCmd(bin string, args ...string) *exec.Cmd {
|
||||
fmt.Printf("==== newCmd %s\n", bin)
|
||||
for _, v := range args {
|
||||
fmt.Printf("\t%v\n", v)
|
||||
}
|
||||
r := exec.Command(bin, args...)
|
||||
r.Stdout = os.Stdout
|
||||
r.Stderr = os.Stderr
|
||||
return r
|
||||
}
|
||||
|
||||
func makeTestfixture(goos, goarch string, more []string) {
|
||||
dir := filepath.FromSlash(fmt.Sprintf("internal/testfixture"))
|
||||
files := []string{
|
||||
"ext/expert/sqlite3expert.c",
|
||||
"ext/expert/test_expert.c",
|
||||
"ext/fts3/fts3_term.c",
|
||||
"ext/fts3/fts3_test.c",
|
||||
"ext/fts5/fts5_tcl.c",
|
||||
"ext/fts5/fts5_test_mi.c",
|
||||
"ext/fts5/fts5_test_tok.c",
|
||||
"ext/misc/amatch.c",
|
||||
"ext/misc/appendvfs.c",
|
||||
"ext/misc/basexx.c",
|
||||
"ext/misc/carray.c",
|
||||
"ext/misc/cksumvfs.c",
|
||||
"ext/misc/closure.c",
|
||||
"ext/misc/csv.c",
|
||||
"ext/misc/decimal.c",
|
||||
"ext/misc/eval.c",
|
||||
"ext/misc/explain.c",
|
||||
"ext/misc/fileio.c",
|
||||
"ext/misc/fuzzer.c",
|
||||
"ext/misc/ieee754.c",
|
||||
"ext/misc/mmapwarm.c",
|
||||
"ext/misc/nextchar.c",
|
||||
"ext/misc/normalize.c",
|
||||
"ext/misc/percentile.c",
|
||||
"ext/misc/prefixes.c",
|
||||
"ext/misc/qpvtab.c",
|
||||
"ext/misc/regexp.c",
|
||||
"ext/misc/remember.c",
|
||||
"ext/misc/series.c",
|
||||
"ext/misc/spellfix.c",
|
||||
"ext/misc/totype.c",
|
||||
"ext/misc/unionvtab.c",
|
||||
"ext/misc/wholenumber.c",
|
||||
"ext/rbu/test_rbu.c",
|
||||
"ext/recover/dbdata.c",
|
||||
"ext/recover/sqlite3recover.c",
|
||||
"ext/recover/test_recover.c",
|
||||
"ext/rtree/test_rtreedoc.c",
|
||||
"ext/session/test_session.c",
|
||||
"ext/userauth/userauth.c",
|
||||
"src/tclsqlite.c",
|
||||
"src/test1.c",
|
||||
"src/test2.c",
|
||||
"src/test3.c",
|
||||
"src/test4.c",
|
||||
"src/test5.c",
|
||||
"src/test6.c",
|
||||
"src/test8.c",
|
||||
"src/test9.c",
|
||||
"src/test_async.c",
|
||||
"src/test_autoext.c",
|
||||
"src/test_backup.c",
|
||||
"src/test_bestindex.c",
|
||||
"src/test_blob.c",
|
||||
"src/test_btree.c",
|
||||
"src/test_config.c",
|
||||
"src/test_delete.c",
|
||||
"src/test_demovfs.c",
|
||||
"src/test_devsym.c",
|
||||
"src/test_fs.c",
|
||||
"src/test_func.c",
|
||||
"src/test_hexio.c",
|
||||
"src/test_init.c",
|
||||
"src/test_intarray.c",
|
||||
"src/test_journal.c",
|
||||
"src/test_malloc.c",
|
||||
"src/test_md5.c",
|
||||
"src/test_multiplex.c",
|
||||
"src/test_mutex.c",
|
||||
"src/test_onefile.c",
|
||||
"src/test_osinst.c",
|
||||
"src/test_pcache.c",
|
||||
"src/test_quota.c",
|
||||
"src/test_rtree.c",
|
||||
"src/test_schema.c",
|
||||
"src/test_superlock.c",
|
||||
"src/test_syscall.c",
|
||||
"src/test_tclsh.c",
|
||||
"src/test_tclvar.c",
|
||||
"src/test_thread.c",
|
||||
"src/test_vdbecov.c",
|
||||
"src/test_vfs.c",
|
||||
"src/test_windirent.c",
|
||||
"src/test_window.c",
|
||||
"src/test_wsd.c",
|
||||
}
|
||||
for i, v := range files {
|
||||
files[i] = filepath.Join(sqliteSrcDir, filepath.FromSlash(v))
|
||||
}
|
||||
configure(goos, goarch)
|
||||
|
||||
var defines, includes []string
|
||||
switch goos {
|
||||
case "freebsd", "openbsd":
|
||||
includes = []string{"-I/usr/local/include/tcl8.6"}
|
||||
case "linux":
|
||||
includes = []string{"-I/usr/include/tcl8.6"}
|
||||
case "windows":
|
||||
includes = []string{"-I/usr/include/tcl8.6"}
|
||||
case "netbsd":
|
||||
includes = []string{"-I/usr/pkg/include"}
|
||||
defines = []string{
|
||||
"-D__libc_cond_broadcast=pthread_cond_broadcast",
|
||||
"-D__libc_cond_destroy=pthread_cond_destroy",
|
||||
"-D__libc_cond_init=pthread_cond_init",
|
||||
"-D__libc_cond_signal=pthread_cond_signal",
|
||||
"-D__libc_cond_wait=pthread_cond_wait",
|
||||
"-D__libc_mutex_destroy=pthread_mutex_destroy",
|
||||
"-D__libc_mutex_init=pthread_mutex_init",
|
||||
"-D__libc_mutex_lock=pthread_mutex_lock",
|
||||
"-D__libc_mutex_trylock=pthread_mutex_trylock",
|
||||
"-D__libc_mutex_unlock=pthread_mutex_unlock",
|
||||
"-D__libc_mutexattr_destroy=pthread_mutexattr_destroy",
|
||||
"-D__libc_mutexattr_init=pthread_mutexattr_init",
|
||||
"-D__libc_mutexattr_settype=pthread_mutexattr_settype",
|
||||
"-D__libc_thr_yield=sched_yield",
|
||||
}
|
||||
}
|
||||
|
||||
args := join(
|
||||
[]string{
|
||||
"ccgo",
|
||||
"-DBUILD_sqlite",
|
||||
"-DNDEBUG",
|
||||
"-DSQLITE_CKSUMVFS_STATIC",
|
||||
"-DSQLITE_CORE",
|
||||
"-DSQLITE_CRASH_TEST=1",
|
||||
"-DSQLITE_DEFAULT_PAGE_SIZE=1024",
|
||||
"-DSQLITE_ENABLE_BYTECODE_VTAB",
|
||||
"-DSQLITE_ENABLE_DBPAGE_VTAB",
|
||||
"-DSQLITE_ENABLE_MATH_FUNCTIONS",
|
||||
"-DSQLITE_ENABLE_STMTVTAB",
|
||||
"-DSQLITE_NO_SYNC=1",
|
||||
"-DSQLITE_OMIT_LOAD_EXTENSION",
|
||||
"-DSQLITE_PRIVATE=\"\"",
|
||||
"-DSQLITE_SERIES_CONSTRAINT_VERIFY=1",
|
||||
"-DSQLITE_SERVER=1",
|
||||
"-DSQLITE_TEMP_STORE=1",
|
||||
"-DSQLITE_TEST=1",
|
||||
"-DSQLITE_THREADSAFE=1",
|
||||
"-DTCLSH_INIT_PROC=sqlite3TestInit",
|
||||
"-D_HAVE_SQLITE_CONFIG_H",
|
||||
},
|
||||
defines,
|
||||
includes,
|
||||
[]string{
|
||||
"-export-defines", "",
|
||||
"-export-fields", "F",
|
||||
"-ignore-unsupported-alignment",
|
||||
"-trace-translation-units",
|
||||
volatiles,
|
||||
"-lmodernc.org/sqlite/libtest",
|
||||
"-lmodernc.org/tcl/lib",
|
||||
"-lmodernc.org/z/lib",
|
||||
"-o", filepath.Join(dir, fmt.Sprintf("testfixture_%s_%s.go", goos, goarch)),
|
||||
fmt.Sprintf("-I%s", filepath.Join(sqliteSrcDir, filepath.FromSlash("ext/async"))),
|
||||
fmt.Sprintf("-I%s", filepath.Join(sqliteSrcDir, filepath.FromSlash("ext/fts3"))),
|
||||
fmt.Sprintf("-I%s", filepath.Join(sqliteSrcDir, filepath.FromSlash("ext/icu"))),
|
||||
fmt.Sprintf("-I%s", filepath.Join(sqliteSrcDir, filepath.FromSlash("ext/rtree"))),
|
||||
fmt.Sprintf("-I%s", filepath.Join(sqliteSrcDir, filepath.FromSlash("ext/session"))),
|
||||
fmt.Sprintf("-I%s", filepath.Join(sqliteSrcDir, filepath.FromSlash("ext/userauth"))),
|
||||
fmt.Sprintf("-I%s", filepath.Join(sqliteSrcDir, filepath.FromSlash("src"))),
|
||||
fmt.Sprintf("-I%s", sqliteDir),
|
||||
fmt.Sprintf("-I%s", sqliteSrcDir),
|
||||
},
|
||||
otherOpts(),
|
||||
files,
|
||||
more,
|
||||
configTest,
|
||||
)
|
||||
task := ccgo.NewTask(args, nil, nil)
|
||||
if err := task.Main(); err != nil {
|
||||
fail("%s\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
func otherOpts() (r []string) {
|
||||
if *oFullPathComments {
|
||||
r = append(r, "-full-path-comments")
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func makeSpeedTest(goos, goarch string, more []string) {
|
||||
task := ccgo.NewTask(
|
||||
join(
|
||||
[]string{
|
||||
"ccgo",
|
||||
"-export-defines", "",
|
||||
"-ignore-unsupported-alignment",
|
||||
"-o", filepath.FromSlash(fmt.Sprintf("speedtest1/main_%s_%s.go", goos, goarch)),
|
||||
"-trace-translation-units",
|
||||
filepath.Join(sqliteSrcDir, "test", "speedtest1.c"),
|
||||
fmt.Sprintf("-I%s", sqliteDir),
|
||||
"-l", "modernc.org/sqlite/lib",
|
||||
},
|
||||
otherOpts(),
|
||||
more,
|
||||
configProduction,
|
||||
),
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
if err := task.Main(); err != nil {
|
||||
fail("%s\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
func makeMpTest(goos, goarch string, more []string) {
|
||||
task := ccgo.NewTask(
|
||||
join(
|
||||
[]string{
|
||||
"ccgo",
|
||||
"-export-defines", "",
|
||||
"-ignore-unsupported-alignment",
|
||||
"-o", filepath.FromSlash(fmt.Sprintf("internal/mptest/main_%s_%s.go", goos, goarch)),
|
||||
"-trace-translation-units",
|
||||
// filepath.Join(sqliteSrcDir, "mptest", "mptest.c"),
|
||||
filepath.Join("testdata", "mptest.c"),
|
||||
fmt.Sprintf("-I%s", sqliteDir),
|
||||
"-l", "modernc.org/sqlite/lib",
|
||||
},
|
||||
otherOpts(),
|
||||
more,
|
||||
configProduction,
|
||||
),
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
if err := task.Main(); err != nil {
|
||||
fail("%s\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
func makeSqliteProduction(goos, goarch string, more []string) {
|
||||
fn := filepath.FromSlash(fmt.Sprintf("lib/sqlite_%s_%s.go", goos, goarch))
|
||||
task := ccgo.NewTask(
|
||||
join(
|
||||
[]string{
|
||||
"ccgo",
|
||||
"-DSQLITE_PRIVATE=",
|
||||
"-export-defines", "",
|
||||
"-export-enums", "",
|
||||
"-export-externs", "X",
|
||||
"-export-fields", "F",
|
||||
"-export-typedefs", "",
|
||||
"-ignore-unsupported-alignment",
|
||||
"-pkgname", "sqlite3",
|
||||
volatiles,
|
||||
"-o", fn,
|
||||
"-trace-translation-units",
|
||||
filepath.Join(sqliteDir, "sqlite3.c"),
|
||||
},
|
||||
otherOpts(),
|
||||
more,
|
||||
configProduction,
|
||||
),
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
if err := task.Main(); err != nil {
|
||||
fail("%s\n", err)
|
||||
}
|
||||
|
||||
if err := patchXsqlite3_initialize(fn); err != nil {
|
||||
fail("%s\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
func makeSqliteTest(goos, goarch string, more []string) {
|
||||
fn := filepath.FromSlash(fmt.Sprintf("libtest/sqlite_%s_%s.go", goos, goarch))
|
||||
task := ccgo.NewTask(
|
||||
join(
|
||||
[]string{
|
||||
"ccgo",
|
||||
"-DSQLITE_PRIVATE=",
|
||||
"-export-defines", "",
|
||||
"-export-enums", "",
|
||||
"-export-externs", "X",
|
||||
"-export-fields", "F",
|
||||
"-export-typedefs", "",
|
||||
"-ignore-unsupported-alignment",
|
||||
"-pkgname", "sqlite3",
|
||||
volatiles,
|
||||
"-o", fn,
|
||||
"-trace-translation-units",
|
||||
volatiles,
|
||||
filepath.Join(sqliteDir, "sqlite3.c"),
|
||||
},
|
||||
otherOpts(),
|
||||
more,
|
||||
configTest,
|
||||
),
|
||||
nil,
|
||||
nil,
|
||||
)
|
||||
if err := task.Main(); err != nil {
|
||||
fail("%s\n", err)
|
||||
}
|
||||
|
||||
if err := patchXsqlite3_initialize(fn); err != nil {
|
||||
fail("%s\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
func join(a ...[]string) (r []string) {
|
||||
n := 0
|
||||
for _, v := range a {
|
||||
n += len(v)
|
||||
}
|
||||
r = make([]string, 0, n)
|
||||
for _, v := range a {
|
||||
r = append(r, v...)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func patchXsqlite3_initialize(fn string) error {
|
||||
const s = "func Xsqlite3_initialize(tls *libc.TLS) int32 {"
|
||||
return patch(fn, func(b []byte) []diff {
|
||||
x := bytes.Index(b, []byte(s))
|
||||
return []diff{{x, x + len(s), `
|
||||
var mu mutex
|
||||
|
||||
func init() { mu.recursive = true }
|
||||
|
||||
func Xsqlite3_initialize(tls *libc.TLS) int32 {
|
||||
mu.enter(tls.ID)
|
||||
defer mu.leave(tls.ID)
|
||||
|
||||
`}}
|
||||
})
|
||||
}
|
||||
|
||||
type diff struct {
|
||||
from, to int // byte offsets
|
||||
replace string // replaces b[from:to]
|
||||
}
|
||||
|
||||
func patch(fn string, f func([]byte) []diff) error {
|
||||
b, err := os.ReadFile(fn)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
diffs := f(b)
|
||||
sort.Slice(diffs, func(i, j int) bool { return diffs[i].from < diffs[j].from })
|
||||
var patched [][]byte
|
||||
off := 0
|
||||
for _, diff := range diffs {
|
||||
from := diff.from - off
|
||||
to := diff.to - off
|
||||
patched = append(patched, b[:from])
|
||||
patched = append(patched, []byte(diff.replace))
|
||||
b = b[to:]
|
||||
off += to
|
||||
}
|
||||
patched = append(patched, b)
|
||||
return os.WriteFile(fn, bytes.Join(patched, nil), 0660)
|
||||
}
|
||||
1384
vendor/modernc.org/sqlite/lib/capi_darwin_amd64.go
generated
vendored
1384
vendor/modernc.org/sqlite/lib/capi_darwin_amd64.go
generated
vendored
File diff suppressed because it is too large
Load diff
1384
vendor/modernc.org/sqlite/lib/capi_darwin_arm64.go
generated
vendored
1384
vendor/modernc.org/sqlite/lib/capi_darwin_arm64.go
generated
vendored
File diff suppressed because it is too large
Load diff
1360
vendor/modernc.org/sqlite/lib/capi_freebsd_386.go
generated
vendored
1360
vendor/modernc.org/sqlite/lib/capi_freebsd_386.go
generated
vendored
File diff suppressed because it is too large
Load diff
1360
vendor/modernc.org/sqlite/lib/capi_freebsd_amd64.go
generated
vendored
1360
vendor/modernc.org/sqlite/lib/capi_freebsd_amd64.go
generated
vendored
File diff suppressed because it is too large
Load diff
1360
vendor/modernc.org/sqlite/lib/capi_freebsd_arm.go
generated
vendored
1360
vendor/modernc.org/sqlite/lib/capi_freebsd_arm.go
generated
vendored
File diff suppressed because it is too large
Load diff
1360
vendor/modernc.org/sqlite/lib/capi_freebsd_arm64.go
generated
vendored
1360
vendor/modernc.org/sqlite/lib/capi_freebsd_arm64.go
generated
vendored
File diff suppressed because it is too large
Load diff
1360
vendor/modernc.org/sqlite/lib/capi_linux_386.go
generated
vendored
1360
vendor/modernc.org/sqlite/lib/capi_linux_386.go
generated
vendored
File diff suppressed because it is too large
Load diff
1360
vendor/modernc.org/sqlite/lib/capi_linux_amd64.go
generated
vendored
1360
vendor/modernc.org/sqlite/lib/capi_linux_amd64.go
generated
vendored
File diff suppressed because it is too large
Load diff
1360
vendor/modernc.org/sqlite/lib/capi_linux_arm.go
generated
vendored
1360
vendor/modernc.org/sqlite/lib/capi_linux_arm.go
generated
vendored
File diff suppressed because it is too large
Load diff
1360
vendor/modernc.org/sqlite/lib/capi_linux_arm64.go
generated
vendored
1360
vendor/modernc.org/sqlite/lib/capi_linux_arm64.go
generated
vendored
File diff suppressed because it is too large
Load diff
1361
vendor/modernc.org/sqlite/lib/capi_linux_ppc64le.go
generated
vendored
1361
vendor/modernc.org/sqlite/lib/capi_linux_ppc64le.go
generated
vendored
File diff suppressed because it is too large
Load diff
1361
vendor/modernc.org/sqlite/lib/capi_linux_riscv64.go
generated
vendored
1361
vendor/modernc.org/sqlite/lib/capi_linux_riscv64.go
generated
vendored
File diff suppressed because it is too large
Load diff
1361
vendor/modernc.org/sqlite/lib/capi_linux_s390x.go
generated
vendored
1361
vendor/modernc.org/sqlite/lib/capi_linux_s390x.go
generated
vendored
File diff suppressed because it is too large
Load diff
1352
vendor/modernc.org/sqlite/lib/capi_netbsd_amd64.go
generated
vendored
1352
vendor/modernc.org/sqlite/lib/capi_netbsd_amd64.go
generated
vendored
File diff suppressed because it is too large
Load diff
1359
vendor/modernc.org/sqlite/lib/capi_openbsd_amd64.go
generated
vendored
1359
vendor/modernc.org/sqlite/lib/capi_openbsd_amd64.go
generated
vendored
File diff suppressed because it is too large
Load diff
1359
vendor/modernc.org/sqlite/lib/capi_openbsd_arm64.go
generated
vendored
1359
vendor/modernc.org/sqlite/lib/capi_openbsd_arm64.go
generated
vendored
File diff suppressed because it is too large
Load diff
1379
vendor/modernc.org/sqlite/lib/capi_windows_amd64.go
generated
vendored
1379
vendor/modernc.org/sqlite/lib/capi_windows_amd64.go
generated
vendored
File diff suppressed because it is too large
Load diff
1379
vendor/modernc.org/sqlite/lib/capi_windows_arm64.go
generated
vendored
1379
vendor/modernc.org/sqlite/lib/capi_windows_arm64.go
generated
vendored
File diff suppressed because it is too large
Load diff
327202
vendor/modernc.org/sqlite/lib/sqlite_darwin_amd64.go
generated
vendored
327202
vendor/modernc.org/sqlite/lib/sqlite_darwin_amd64.go
generated
vendored
File diff suppressed because one or more lines are too long
325379
vendor/modernc.org/sqlite/lib/sqlite_darwin_arm64.go
generated
vendored
325379
vendor/modernc.org/sqlite/lib/sqlite_darwin_arm64.go
generated
vendored
File diff suppressed because one or more lines are too long
316926
vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go
generated
vendored
316926
vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go
generated
vendored
File diff suppressed because one or more lines are too long
317119
vendor/modernc.org/sqlite/lib/sqlite_freebsd_arm64.go
generated
vendored
317119
vendor/modernc.org/sqlite/lib/sqlite_freebsd_arm64.go
generated
vendored
File diff suppressed because one or more lines are too long
323869
vendor/modernc.org/sqlite/lib/sqlite_linux_386.go
generated
vendored
323869
vendor/modernc.org/sqlite/lib/sqlite_linux_386.go
generated
vendored
File diff suppressed because one or more lines are too long
324501
vendor/modernc.org/sqlite/lib/sqlite_linux_amd64.go
generated
vendored
324501
vendor/modernc.org/sqlite/lib/sqlite_linux_amd64.go
generated
vendored
File diff suppressed because one or more lines are too long
325085
vendor/modernc.org/sqlite/lib/sqlite_linux_arm.go
generated
vendored
325085
vendor/modernc.org/sqlite/lib/sqlite_linux_arm.go
generated
vendored
File diff suppressed because one or more lines are too long
324522
vendor/modernc.org/sqlite/lib/sqlite_linux_arm64.go
generated
vendored
324522
vendor/modernc.org/sqlite/lib/sqlite_linux_arm64.go
generated
vendored
File diff suppressed because one or more lines are too long
324712
vendor/modernc.org/sqlite/lib/sqlite_linux_ppc64le.go
generated
vendored
324712
vendor/modernc.org/sqlite/lib/sqlite_linux_ppc64le.go
generated
vendored
File diff suppressed because one or more lines are too long
324682
vendor/modernc.org/sqlite/lib/sqlite_linux_riscv64.go
generated
vendored
324682
vendor/modernc.org/sqlite/lib/sqlite_linux_riscv64.go
generated
vendored
File diff suppressed because one or more lines are too long
324629
vendor/modernc.org/sqlite/lib/sqlite_linux_s390x.go
generated
vendored
324629
vendor/modernc.org/sqlite/lib/sqlite_linux_s390x.go
generated
vendored
File diff suppressed because one or more lines are too long
295766
vendor/modernc.org/sqlite/lib/sqlite_windows.go
generated
vendored
Normal file
295766
vendor/modernc.org/sqlite/lib/sqlite_windows.go
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
199250
vendor/modernc.org/sqlite/lib/sqlite_windows_amd64.go
generated
vendored
199250
vendor/modernc.org/sqlite/lib/sqlite_windows_amd64.go
generated
vendored
File diff suppressed because one or more lines are too long
199250
vendor/modernc.org/sqlite/lib/sqlite_windows_arm64.go
generated
vendored
199250
vendor/modernc.org/sqlite/lib/sqlite_windows_arm64.go
generated
vendored
File diff suppressed because one or more lines are too long
36
vendor/modernc.org/sqlite/sqlite.go
generated
vendored
36
vendor/modernc.org/sqlite/sqlite.go
generated
vendored
|
|
@ -492,10 +492,23 @@ func toNamedValues(vals []driver.Value) (r []driver.NamedValue) {
|
|||
func (s *stmt) exec(ctx context.Context, args []driver.NamedValue) (r driver.Result, err error) {
|
||||
var pstmt uintptr
|
||||
var done int32
|
||||
if ctx != nil && ctx.Done() != nil {
|
||||
defer interruptOnDone(ctx, s.c, &done)()
|
||||
if ctx != nil {
|
||||
if ctxDone := ctx.Done(); ctxDone != nil {
|
||||
select {
|
||||
case <-ctxDone:
|
||||
return nil, ctx.Err()
|
||||
default:
|
||||
}
|
||||
defer interruptOnDone(ctx, s.c, &done)()
|
||||
}
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if ctx != nil && atomic.LoadInt32(&done) != 0 {
|
||||
r, err = nil, ctx.Err()
|
||||
}
|
||||
}()
|
||||
|
||||
for psql := s.psql; *(*byte)(unsafe.Pointer(psql)) != 0 && atomic.LoadInt32(&done) == 0; {
|
||||
if pstmt, err = s.c.prepareV2(&psql); err != nil {
|
||||
return nil, err
|
||||
|
|
@ -532,7 +545,7 @@ func (s *stmt) exec(ctx context.Context, args []driver.NamedValue) (r driver.Res
|
|||
|
||||
switch rc & 0xff {
|
||||
case sqlite3.SQLITE_DONE, sqlite3.SQLITE_ROW:
|
||||
// nop
|
||||
r, err = newResult(s.c)
|
||||
default:
|
||||
return s.c.errstr(int32(rc))
|
||||
}
|
||||
|
|
@ -548,7 +561,7 @@ func (s *stmt) exec(ctx context.Context, args []driver.NamedValue) (r driver.Res
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
return newResult(s.c)
|
||||
return r, err
|
||||
}
|
||||
|
||||
// NumInput returns the number of placeholder parameters.
|
||||
|
|
@ -576,14 +589,23 @@ func (s *stmt) Query(args []driver.Value) (driver.Rows, error) { //TODO StmtQuer
|
|||
func (s *stmt) query(ctx context.Context, args []driver.NamedValue) (r driver.Rows, err error) {
|
||||
var pstmt uintptr
|
||||
var done int32
|
||||
if ctx != nil && ctx.Done() != nil {
|
||||
defer interruptOnDone(ctx, s.c, &done)()
|
||||
if ctx != nil {
|
||||
if ctxDone := ctx.Done(); ctxDone != nil {
|
||||
select {
|
||||
case <-ctxDone:
|
||||
return nil, ctx.Err()
|
||||
default:
|
||||
}
|
||||
defer interruptOnDone(ctx, s.c, &done)()
|
||||
}
|
||||
}
|
||||
|
||||
var allocs []uintptr
|
||||
|
||||
defer func() {
|
||||
if r == nil && err == nil {
|
||||
if ctx != nil && atomic.LoadInt32(&done) != 0 {
|
||||
r, err = nil, ctx.Err()
|
||||
} else if r == nil && err == nil {
|
||||
r, err = newRows(s.c, pstmt, allocs, true)
|
||||
}
|
||||
}()
|
||||
|
|
|
|||
124
vendor/modernc.org/sqlite/vendor_libsqlite3.go
generated
vendored
Normal file
124
vendor/modernc.org/sqlite/vendor_libsqlite3.go
generated
vendored
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
// Copyright 2024 The Sqlite Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build none
|
||||
// +build none
|
||||
|
||||
// Tool for 1.28+ -> 1.29+. Pulls adjusted libsqlite3 code to this repo.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"go/token"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"modernc.org/gc/v3"
|
||||
)
|
||||
|
||||
func fail(rc int, msg string, args ...any) {
|
||||
fmt.Fprintln(os.Stderr, strings.TrimSpace(fmt.Sprintf(msg, args...)))
|
||||
os.Exit(rc)
|
||||
}
|
||||
|
||||
func main() {
|
||||
for _, v := range []struct{ goos, goarch string }{
|
||||
{"darwin", "amd64"},
|
||||
{"darwin", "arm64"},
|
||||
{"freebsd", "amd64"},
|
||||
{"freebsd", "arm64"},
|
||||
{"linux", "386"},
|
||||
{"linux", "amd64"},
|
||||
{"linux", "arm"},
|
||||
{"linux", "arm64"},
|
||||
{"linux", "ppc64le"},
|
||||
{"linux", "riscv64"},
|
||||
{"linux", "s390x"},
|
||||
{"windows", "amd64"},
|
||||
} {
|
||||
fmt.Printf("%s/%s\n", v.goos, v.goarch)
|
||||
base := fmt.Sprintf("ccgo_%s_%s.go", v.goos, v.goarch)
|
||||
if v.goos == "windows" {
|
||||
base = "ccgo_windows.go"
|
||||
}
|
||||
ifn := filepath.Join("..", "libsqlite3", base)
|
||||
in, err := os.ReadFile(ifn)
|
||||
if err != nil {
|
||||
fail(1, "%s\n", err)
|
||||
}
|
||||
|
||||
ast, err := gc.ParseFile(ifn, in)
|
||||
if err != nil {
|
||||
fail(1, "%s\n", err)
|
||||
}
|
||||
|
||||
b := bytes.NewBuffer(nil)
|
||||
s := ast.SourceFile.PackageClause.Source(true)
|
||||
s = strings.Replace(s, "package libsqlite3", "package sqlite3", 1)
|
||||
fmt.Fprintln(b, s)
|
||||
fmt.Fprint(b, ast.SourceFile.ImportDeclList.Source(true))
|
||||
taken := map[string]struct{}{}
|
||||
for n := ast.SourceFile.TopLevelDeclList; n != nil; n = n.List {
|
||||
switch x := n.TopLevelDecl.(type) {
|
||||
case *gc.TypeDeclNode:
|
||||
adn := x.TypeSpecList.TypeSpec.(*gc.AliasDeclNode)
|
||||
nm := adn.IDENT.Src()
|
||||
taken[nm] = struct{}{}
|
||||
}
|
||||
}
|
||||
loop:
|
||||
for n := ast.SourceFile.TopLevelDeclList; n != nil; n = n.List {
|
||||
switch x := n.TopLevelDecl.(type) {
|
||||
case *gc.ConstDeclNode:
|
||||
switch y := x.ConstSpec.(type) {
|
||||
case *gc.ConstSpecNode:
|
||||
if y.IDENT.Src() != "SQLITE_TRANSIENT" {
|
||||
fmt.Fprintln(b, x.Source(true))
|
||||
}
|
||||
default:
|
||||
panic(fmt.Sprintf("%v: %T %q", x.Position(), y, x.Source(false)))
|
||||
}
|
||||
|
||||
case *gc.FunctionDeclNode:
|
||||
fmt.Fprintln(b, x.Source(true))
|
||||
case *gc.TypeDeclNode:
|
||||
fmt.Fprintln(b, x.Source(true))
|
||||
adn := x.TypeSpecList.TypeSpec.(*gc.AliasDeclNode)
|
||||
nm := adn.IDENT.Src()
|
||||
nm2 := nm[1:]
|
||||
if _, ok := taken[nm2]; ok {
|
||||
break
|
||||
}
|
||||
|
||||
if token.IsExported(nm) {
|
||||
fmt.Fprintf(b, "\ntype %s = %s\n", nm2, nm)
|
||||
}
|
||||
case *gc.VarDeclNode:
|
||||
fmt.Fprintln(b, x.Source(true))
|
||||
default:
|
||||
fmt.Printf("%v: TODO %T\n", n.Position(), x)
|
||||
break loop
|
||||
}
|
||||
}
|
||||
|
||||
b.WriteString(`
|
||||
type Sqlite3_int64 = sqlite3_int64
|
||||
type Sqlite3_mutex_methods = sqlite3_mutex_methods
|
||||
type Sqlite3_value = sqlite3_value
|
||||
|
||||
type Sqlite3_index_info = sqlite3_index_info
|
||||
type Sqlite3_module = sqlite3_module
|
||||
type Sqlite3_vtab = sqlite3_vtab
|
||||
type Sqlite3_vtab_cursor = sqlite3_vtab_cursor
|
||||
|
||||
`)
|
||||
base = strings.Replace(base, "ccgo_", "sqlite_", 1)
|
||||
if err := os.WriteFile(filepath.Join("lib", base), b.Bytes(), 0660); err != nil {
|
||||
fail(1, "%s\n", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue