forked from lug/matterbridge
		
	Add dependencies/vendor (whatsapp)
This commit is contained in:
		
							
								
								
									
										18
									
								
								vendor/modernc.org/sqlite/AUTHORS
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								vendor/modernc.org/sqlite/AUTHORS
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| # This file lists authors for copyright purposes.  This file is distinct from | ||||
| # the CONTRIBUTORS files.  See the latter for an explanation. | ||||
| # | ||||
| # Names should be added to this file as: | ||||
| #     Name or Organization <email address> | ||||
| # | ||||
| # The email address is not required for organizations. | ||||
| # | ||||
| # Please keep the list sorted. | ||||
|  | ||||
| Dan Peterson <danp@danp.net> | ||||
| Davsk Ltd Co <skinner.david@gmail.com> | ||||
| Jaap Aarts <jaap.aarts1@gmail.com> | ||||
| Jan Mercl <0xjnml@gmail.com> | ||||
| Logan Snow <logansnow@protonmail.com> | ||||
| Ross Light <ross@zombiezen.com> | ||||
| Steffen Butzer <steffen(dot)butzer@outlook.com> | ||||
| Saed SayedAhmed <saadmtsa@gmail.com> | ||||
							
								
								
									
										19
									
								
								vendor/modernc.org/sqlite/CONTRIBUTORS
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								vendor/modernc.org/sqlite/CONTRIBUTORS
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| # This file lists people who contributed code to this repository.  The AUTHORS | ||||
| # file lists the copyright holders; this file lists people. | ||||
| # | ||||
| # Names should be added to this file like so: | ||||
| #     Name <email address> | ||||
| # | ||||
| # Please keep the list sorted. | ||||
|  | ||||
| Alexander Menzhinsky <amenzhinsky@gmail.com> | ||||
| Dan Peterson <danp@danp.net> | ||||
| David Skinner <skinner.david@gmail.com> | ||||
| Gleb Sakhnov <gleb.sakhnov@gmail.com> | ||||
| Jaap Aarts <jaap.aarts1@gmail.com> | ||||
| Jan Mercl <0xjnml@gmail.com> | ||||
| Logan Snow <logansnow@protonmail.com> | ||||
| Ross Light <ross@zombiezen.com> | ||||
| Steffen Butzer <steffen(dot)butzer@outlook.com> | ||||
| Yaacov Akiba Slama <ya@slamail.org> | ||||
| Saed SayedAhmed <saadmtsa@gmail.com> | ||||
							
								
								
									
										26
									
								
								vendor/modernc.org/sqlite/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								vendor/modernc.org/sqlite/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| Copyright (c) 2017 The Sqlite Authors. All rights reserved. | ||||
|  | ||||
| Redistribution and use in source and binary forms, with or without | ||||
| modification, are permitted provided that the following conditions are met: | ||||
|  | ||||
| 1. Redistributions of source code must retain the above copyright notice, this | ||||
| list of conditions and the following disclaimer. | ||||
|  | ||||
| 2. Redistributions in binary form must reproduce the above copyright notice, | ||||
| this list of conditions and the following disclaimer in the documentation | ||||
| and/or other materials provided with the distribution. | ||||
|  | ||||
| 3. Neither the name of the copyright holder nor the names of its contributors | ||||
| may be used to endorse or promote products derived from this software without | ||||
| specific prior written permission. | ||||
|  | ||||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||||
| ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||||
| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||||
| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||||
| FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||||
| DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||||
| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||||
| CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||||
| OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||||
| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
							
								
								
									
										205
									
								
								vendor/modernc.org/sqlite/Makefile
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										205
									
								
								vendor/modernc.org/sqlite/Makefile
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,205 @@ | ||||
| # 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. | ||||
|  | ||||
| .PHONY:	all clean cover cpu editor internalError later mem nuke todo edit tcl extraquick full | ||||
|  | ||||
| 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) | ||||
|  | ||||
| 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 | ||||
| 	GOOS=linux GOARCH=386 go build -v ./... | ||||
| 	GOOS=linux GOARCH=386 go build -v ./... | ||||
| 	GOOS=linux GOARCH=amd64 go build -v ./... | ||||
| 	GOOS=linux GOARCH=amd64 go build -v ./... | ||||
| 	GOOS=linux GOARCH=arm go build -v ./... | ||||
| 	GOOS=linux GOARCH=arm64 go build -v ./... | ||||
| 	GOOS=linux GOARCH=s390x go build -v ./... | ||||
| 	GOOS=windows GOARCH=386 go build -v ./... | ||||
| 	GOOS=windows GOARCH=amd64 go build -v ./... | ||||
| 	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 | ||||
|  | ||||
| build_all_targets: | ||||
| 	GOOS=darwin GOARCH=amd64 go build -v ./... | ||||
| 	GOOS=darwin GOARCH=amd64 go test -c -o /dev/null | ||||
| 	GOOS=darwin GOARCH=arm64 go build -v ./... | ||||
| 	GOOS=darwin GOARCH=arm64 go test -c -o /dev/null | ||||
| 	GOOS=freebsd GOARCH=amd64 go build -v ./... | ||||
| 	GOOS=freebsd GOARCH=amd64 go test -c -o /dev/null | ||||
| 	GOOS=freebsd GOARCH=386 go build -v ./... | ||||
| 	GOOS=freebsd GOARCH=386 go test -c -o /dev/null | ||||
| 	GOOS=linux GOARCH=386 go build -v ./... | ||||
| 	GOOS=linux GOARCH=386 go test -c -o /dev/null | ||||
| 	GOOS=linux GOARCH=amd64 go build -v ./... | ||||
| 	GOOS=linux GOARCH=amd64 go test -c -o /dev/null | ||||
| 	GOOS=linux GOARCH=arm go build -v ./... | ||||
| 	GOOS=linux GOARCH=arm go test -c -o /dev/null | ||||
| 	GOOS=linux GOARCH=arm64 go build -v ./... | ||||
| 	GOOS=linux GOARCH=arm64 go test -c -o /dev/null | ||||
| 	GOOS=linux GOARCH=s390x go build -v ./... | ||||
| 	GOOS=linux GOARCH=s390x go test -c -o /dev/null | ||||
| 	GOOS=netbsd GOARCH=amd64 go build -v ./... | ||||
| 	GOOS=netbsd GOARCH=amd64 go test -c -o /dev/null | ||||
| 	GOOS=windows GOARCH=386 go build -v ./... | ||||
| 	GOOS=windows GOARCH=386 go test -c -o /dev/null | ||||
| 	GOOS=windows GOARCH=amd64 go build -v ./... | ||||
| 	GOOS=windows GOARCH=amd64 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 build -v ./... | ||||
|  | ||||
| # 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 build -v ./... | ||||
|  | ||||
| # 3900x/qemu | ||||
| darwin_amd64: | ||||
| 	@echo "Should be executed only on darwin/amd64." | ||||
| 	go generate 2>&1 | tee log-generate | ||||
| 	go build -v ./... | ||||
|  | ||||
| # 3900x/qemu | ||||
| netbsd_amd64: | ||||
| 	@echo "Should be executed only on netbsd/amd64." | ||||
| 	go generate 2>&1 | tee log-generate | ||||
| 	go build -v ./... | ||||
|  | ||||
| # darwin-m1 | ||||
| darwin_arm64: | ||||
| 	@echo "Should be executed only on darwin/arm64." | ||||
| 	go generate 2>&1 | tee log-generate | ||||
| 	go build -v ./... | ||||
|  | ||||
| # 3900x/VBox | ||||
| freebsd_amd64: | ||||
| 	@echo "Should be executed only on freebsd/amd64." | ||||
| 	go generate 2>&1 | tee log-generate | ||||
| 	go build -v ./... | ||||
|  | ||||
| # 3900x/qemu | ||||
| freebsd_386: | ||||
| 	@echo "Should be executed only on freebsd/386." | ||||
| 	go generate 2>&1 | tee log-generate | ||||
| 	go build -v ./... | ||||
|  | ||||
| # 3900x | ||||
| linux_amd64: | ||||
| 	@echo "Should be executed only on linux/amd64." | ||||
| 	go generate 2>&1 | tee log-generate | ||||
| 	go build -v ./... | ||||
|  | ||||
| # 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 build -v ./... | ||||
|  | ||||
| # 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 build -v ./... | ||||
|  | ||||
| # 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 build -v ./... | ||||
|  | ||||
| # 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 build -v ./... | ||||
|  | ||||
| generate_all_targets_on_linux_amd64: linux_amd64 linux_386 linux_arm_on_linux_amd64 linux_arm64 linux_s390x windows_amd64 #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: | ||||
| 	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 *.go & fi | ||||
|  | ||||
| editor: | ||||
| 	gofmt -l -s -w *.go | ||||
| 	go install -v ./... | ||||
|  | ||||
| internalError: | ||||
| 	egrep -ho '"internal error.*"' *.go | sort | cat -n | ||||
|  | ||||
| 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 | ||||
							
								
								
									
										14
									
								
								vendor/modernc.org/sqlite/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								vendor/modernc.org/sqlite/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| # sqlite | ||||
|  | ||||
| Package sqlite is a CGo-free port of SQLite. | ||||
|  | ||||
| SQLite is an in-process implementation of a self-contained, serverless, | ||||
| zero-configuration, transactional SQL database engine. | ||||
|  | ||||
| Installation | ||||
|  | ||||
|     $ go get modernc.org/sqlite | ||||
|  | ||||
| Documentation: [godoc.org/modernc.org/sqlite](http://godoc.org/modernc.org/sqlite) | ||||
|  | ||||
| Builders: [modern-c.appspot.com/-/builder/?importpath=modernc.org%2fsqlite](https://modern-c.appspot.com/-/builder/?importpath=modernc.org%2fsqlite) | ||||
							
								
								
									
										25
									
								
								vendor/modernc.org/sqlite/SQLITE-LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								vendor/modernc.org/sqlite/SQLITE-LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| SQLite Is Public Domain | ||||
|  | ||||
| All of the code and documentation in SQLite has been dedicated to the public | ||||
| domain by the authors. All code authors, and representatives of the companies | ||||
| they work for, have signed affidavits dedicating their contributions to the | ||||
| public domain and originals of those signed affidavits are stored in a firesafe | ||||
| at the main offices of Hwaci. Anyone is free to copy, modify, publish, use, | ||||
| compile, sell, or distribute the original SQLite code, either in source code | ||||
| form or as a compiled binary, for any purpose, commercial or non-commercial, | ||||
| and by any means. | ||||
|  | ||||
| The previous paragraph applies to the deliverable code and documentation in | ||||
| SQLite - those parts of the SQLite library that you actually bundle and ship | ||||
| with a larger application. Some scripts used as part of the build process (for | ||||
| example the "configure" scripts generated by autoconf) might fall under other | ||||
| open-source licenses. Nothing from these build scripts ever reaches the final | ||||
| deliverable SQLite library, however, and so the licenses associated with those | ||||
| scripts should not be a factor in assessing your rights to copy and use the | ||||
| SQLite library. | ||||
|  | ||||
| All of the deliverable code in SQLite has been written from scratch. No code | ||||
| has been taken from other projects or from the open internet. Every line of | ||||
| code can be traced back to its original author, and all of those authors have | ||||
| public domain dedications on file. So the SQLite code base is clean and is | ||||
| uncontaminated with licensed code from other projects. | ||||
							
								
								
									
										167
									
								
								vendor/modernc.org/sqlite/doc.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										167
									
								
								vendor/modernc.org/sqlite/doc.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,167 @@ | ||||
| // 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. | ||||
|  | ||||
| // Package sqlite is a sql/database driver using a CGo-free port of the C | ||||
| // SQLite3 library. | ||||
| // | ||||
| // SQLite is an in-process implementation of a self-contained, serverless, | ||||
| // zero-configuration, transactional SQL database engine. | ||||
| // | ||||
| // Supported platforms and architectures | ||||
| // | ||||
| // These combinations of GOOS and GOARCH are currently supported | ||||
| // | ||||
| //	OS      Arch    SQLite version | ||||
| //	------------------------------ | ||||
| //	darwin	amd64   3.37.2 | ||||
| //	darwin	arm64   3.37.2 | ||||
| //	freebsd	amd64   3.37.2 | ||||
| //	linux	386     3.37.2 | ||||
| //	linux	amd64   3.37.2 | ||||
| //	linux	arm     3.37.2 | ||||
| //	linux	arm64   3.37.2 | ||||
| //	windows	amd64   3.37.2 | ||||
| // | ||||
| // Builders | ||||
| // | ||||
| // Builder results available at | ||||
| // | ||||
| //	https://modern-c.appspot.com/-/builder/?importpath=modernc.org%2fsqlite | ||||
| // | ||||
| // Changelog | ||||
| // | ||||
| // 2021-11-13 v1.14.0: | ||||
| // | ||||
| // Support windows/amd64. This target had previously only experimental status | ||||
| // because of a now resolved memory leak. | ||||
| // | ||||
| // 2021-09-07 v1.13.0: | ||||
| // | ||||
| // Support freebsd/amd64. | ||||
| // | ||||
| // Changelog | ||||
| // | ||||
| // 2021-06-23 v1.11.0: | ||||
| // | ||||
| // Upgrade to use sqlite 3.36.0, release notes at https://www.sqlite.org/releaselog/3_36_0.html. | ||||
| // | ||||
| // 2021-05-06 v1.10.6: | ||||
| // | ||||
| // Fixes a memory corruption issue | ||||
| // (https://gitlab.com/cznic/sqlite/-/issues/53).  Versions since v1.8.6 were | ||||
| // affected and should be updated to v1.10.6. | ||||
| // | ||||
| // 2021-03-14 v1.10.0: | ||||
| // | ||||
| // Update to use sqlite 3.35.0, release notes at https://www.sqlite.org/releaselog/3_35_0.html. | ||||
| // | ||||
| // 2021-03-11 v1.9.0: | ||||
| // | ||||
| // Support darwin/arm64. | ||||
| // | ||||
| // 2021-01-08 v1.8.0: | ||||
| // | ||||
| // Support darwin/amd64. | ||||
| // | ||||
| // 2020-09-13 v1.7.0: | ||||
| // | ||||
| // Support linux/arm and linux/arm64. | ||||
| // | ||||
| // 2020-09-08 v1.6.0: | ||||
| // | ||||
| // Support linux/386. | ||||
| // | ||||
| // 2020-09-03 v1.5.0: | ||||
| // | ||||
| // This project is now completely CGo-free, including the Tcl tests. | ||||
| // | ||||
| // 2020-08-26 v1.4.0: | ||||
| // | ||||
| // First stable release for linux/amd64.  The database/sql driver and its tests | ||||
| // are CGo free.  Tests of the translated sqlite3.c library still require CGo. | ||||
| // | ||||
| //	$ make full | ||||
| // | ||||
| //	... | ||||
| // | ||||
| //	SQLite 2020-08-14 13:23:32 fca8dc8b578f215a969cd899336378966156154710873e68b3d9ac5881b0ff3f | ||||
| //	0 errors out of 928271 tests on 3900x Linux 64-bit little-endian | ||||
| //	WARNING: Multi-threaded tests skipped: Linked against a non-threadsafe Tcl build | ||||
| //	All memory allocations freed - no leaks | ||||
| //	Maximum memory usage: 9156360 bytes | ||||
| //	Current memory usage: 0 bytes | ||||
| //	Number of malloc()  : -1 calls | ||||
| //	--- PASS: TestTclTest (1785.04s) | ||||
| //	PASS | ||||
| //	ok  	modernc.org/sqlite	1785.041s | ||||
| //	$ | ||||
| // | ||||
| // 2020-07-26 v1.4.0-beta1: | ||||
| // | ||||
| // The project has reached beta status while supporting linux/amd64 only at the | ||||
| // moment. The 'extraquick' Tcl testsuite reports | ||||
| // | ||||
| //	630 errors out of 200177 tests on  Linux 64-bit little-endian | ||||
| // | ||||
| // and some memory leaks | ||||
| // | ||||
| //	Unfreed memory: 698816 bytes in 322 allocations | ||||
| // | ||||
| // 2019-12-28 v1.2.0-alpha.3: Third alpha fixes issue #19. | ||||
| // | ||||
| // It also bumps the minor version as the repository was wrongly already tagged | ||||
| // with v1.1.0 before.  Even though the tag was deleted there are proxies that | ||||
| // cached that tag. Thanks /u/garaktailor for detecting the problem and | ||||
| // suggesting this solution. | ||||
| // | ||||
| // 2019-12-26 v1.1.0-alpha.2: Second alpha release adds support for accessing a | ||||
| // database concurrently by multiple goroutines and/or processes. v1.1.0 is now | ||||
| // considered feature-complete. Next planed release should be a beta with a | ||||
| // proper test suite. | ||||
| // | ||||
| // 2019-12-18 v1.1.0-alpha.1: First alpha release using the new cc/v3, gocc, | ||||
| // qbe toolchain. Some primitive tests pass on linux_{amd64,386}. Not yet safe | ||||
| // for concurrent access by multiple goroutines. Next alpha release is planed | ||||
| // to arrive before the end of this year. | ||||
| // | ||||
| // 2017-06-10 Windows/Intel no more uses the VM (thanks Steffen Butzer). | ||||
| // | ||||
| // 2017-06-05 Linux/Intel no more uses the VM (cznic/virtual). | ||||
| // | ||||
| // Connecting to a database | ||||
| // | ||||
| // To access a Sqlite database do something like | ||||
| // | ||||
| //	import ( | ||||
| //		"database/sql" | ||||
| // | ||||
| //		_ "modernc.org/sqlite" | ||||
| //	) | ||||
| // | ||||
| //	... | ||||
| // | ||||
| // | ||||
| //	db, err := sql.Open("sqlite", dsnURI) | ||||
| // | ||||
| //	... | ||||
| // | ||||
| // Debug and development versions | ||||
| // | ||||
| // A comma separated list of options can be passed to `go generate` via the | ||||
| // environment variable GO_GENERATE. Some useful options include for example: | ||||
| // | ||||
| //	-DSQLITE_DEBUG | ||||
| //	-DSQLITE_MEM_DEBUG | ||||
| //	-ccgo-verify-structs | ||||
| // | ||||
| // To create a debug/development version, issue for example: | ||||
| // | ||||
| //	$ GO_GENERATE=-DSQLITE_DEBUG,-DSQLITE_MEM_DEBUG go generate | ||||
| // | ||||
| // Note: To run `go generate` you need to have modernc.org/ccgo/v3 installed. | ||||
| // | ||||
| // Sqlite documentation | ||||
| // | ||||
| // See https://sqlite.org/docs.html | ||||
| package sqlite // import "modernc.org/sqlite" | ||||
							
								
								
									
										782
									
								
								vendor/modernc.org/sqlite/generator.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										782
									
								
								vendor/modernc.org/sqlite/generator.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,782 @@ | ||||
| // 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 | ||||
|  | ||||
| package main | ||||
|  | ||||
| import ( | ||||
| 	"archive/zip" | ||||
| 	"bufio" | ||||
| 	"fmt" | ||||
| 	"io" | ||||
| 	"io/ioutil" | ||||
| 	"net/http" | ||||
| 	"os" | ||||
| 	"os/exec" | ||||
| 	"path/filepath" | ||||
| 	"runtime" | ||||
| 	"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" | ||||
| ) | ||||
|  | ||||
| var ( | ||||
| 	configProduction = []string{ | ||||
| 		"-DHAVE_USLEEP", | ||||
| 		"-DLONGDOUBLE_TYPE=double", | ||||
| 		"-DSQLITE_CORE", | ||||
| 		"-DSQLITE_ENABLE_COLUMN_METADATA", | ||||
| 		"-DSQLITE_ENABLE_FTS5", | ||||
| 		"-DSQLITE_ENABLE_GEOPOLY", | ||||
| 		"-DSQLITE_ENABLE_JSON1", | ||||
| 		"-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=0",    // bug reported https://sqlite.org/forum/info/d8dfd4771689be35, fixed in https://sqlite.org/src/info/3c5e63c22ffbfeb6 | ||||
| 		"-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_JSON1", | ||||
| 		"-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_STMTVTAB",      // testfixture | ||||
| 		"-DSQLITE_ENABLE_UNLOCK_NOTIFY", // Adds sqlite3_unlock_notify(). | ||||
| 		"-DSQLITE_HAVE_ZLIB=1",          // testfixture | ||||
| 		"-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_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/2022/sqlite-amalgamation-3370200.zip", 2457, false}, | ||||
| 		{sqliteSrcDir, "https://www.sqlite.org/2022/sqlite-src-3370200.zip", 12814, false}, | ||||
| 	} | ||||
|  | ||||
| 	sqliteDir    = filepath.FromSlash("testdata/sqlite-amalgamation-3370200") | ||||
| 	sqliteSrcDir = filepath.FromSlash("testdata/sqlite-src-3370200") | ||||
| ) | ||||
|  | ||||
| func download() { | ||||
| 	tmp, err := ioutil.TempDir("", "") | ||||
| 	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) | ||||
| } | ||||
|  | ||||
| func main() { | ||||
| 	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": | ||||
| 		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": | ||||
| 		// 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/appendvfs.c", | ||||
| 		"ext/misc/amatch.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/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/misc/zipfile.c", | ||||
| 		"ext/rbu/test_rbu.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/test7.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_server.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": | ||||
| 		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", | ||||
| 			"-DSQLITE_OMIT_LOAD_EXTENSION", | ||||
| 			"-DSQLITE_SERIES_CONSTRAINT_VERIFY=1", | ||||
| 			"-DSQLITE_SERVER=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), | ||||
| 		}, | ||||
| 		files, | ||||
| 		more, | ||||
| 		configTest, | ||||
| 	) | ||||
| 	task := ccgo.NewTask(args, nil, nil) | ||||
| 	if err := task.Main(); err != nil { | ||||
| 		fail("%s\n", err) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| 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", | ||||
| 			}, | ||||
| 			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"), | ||||
| 				fmt.Sprintf("-I%s", sqliteDir), | ||||
| 				"-l", "modernc.org/sqlite/lib", | ||||
| 			}, | ||||
| 			more, | ||||
| 			configProduction, | ||||
| 		), | ||||
| 		nil, | ||||
| 		nil, | ||||
| 	) | ||||
| 	if err := task.Main(); err != nil { | ||||
| 		fail("%s\n", err) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func makeSqliteProduction(goos, goarch string, more []string) { | ||||
| 	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", | ||||
| 				"-o", filepath.FromSlash(fmt.Sprintf("lib/sqlite_%s_%s.go", goos, goarch)), | ||||
| 				"-trace-translation-units", | ||||
| 				filepath.Join(sqliteDir, "sqlite3.c"), | ||||
| 			}, | ||||
| 			more, | ||||
| 			configProduction, | ||||
| 		), | ||||
| 		nil, | ||||
| 		nil, | ||||
| 	) | ||||
| 	if err := task.Main(); err != nil { | ||||
| 		fail("%s\n", err) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func makeSqliteTest(goos, goarch string, more []string) { | ||||
| 	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", | ||||
| 				"-o", filepath.FromSlash(fmt.Sprintf("libtest/sqlite_%s_%s.go", goos, goarch)), | ||||
| 				"-trace-translation-units", | ||||
| 				volatiles, | ||||
| 				filepath.Join(sqliteDir, "sqlite3.c"), | ||||
| 			}, | ||||
| 			more, | ||||
| 			configTest, | ||||
| 		), | ||||
| 		nil, | ||||
| 		nil, | ||||
| 	) | ||||
| 	if err := task.Main(); 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 | ||||
| } | ||||
							
								
								
									
										1349
									
								
								vendor/modernc.org/sqlite/lib/capi_darwin_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1349
									
								
								vendor/modernc.org/sqlite/lib/capi_darwin_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1349
									
								
								vendor/modernc.org/sqlite/lib/capi_darwin_arm64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1349
									
								
								vendor/modernc.org/sqlite/lib/capi_darwin_arm64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1325
									
								
								vendor/modernc.org/sqlite/lib/capi_freebsd_386.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1325
									
								
								vendor/modernc.org/sqlite/lib/capi_freebsd_386.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1325
									
								
								vendor/modernc.org/sqlite/lib/capi_freebsd_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1325
									
								
								vendor/modernc.org/sqlite/lib/capi_freebsd_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1325
									
								
								vendor/modernc.org/sqlite/lib/capi_linux_386.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1325
									
								
								vendor/modernc.org/sqlite/lib/capi_linux_386.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1325
									
								
								vendor/modernc.org/sqlite/lib/capi_linux_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1325
									
								
								vendor/modernc.org/sqlite/lib/capi_linux_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1325
									
								
								vendor/modernc.org/sqlite/lib/capi_linux_arm.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1325
									
								
								vendor/modernc.org/sqlite/lib/capi_linux_arm.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1325
									
								
								vendor/modernc.org/sqlite/lib/capi_linux_arm64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1325
									
								
								vendor/modernc.org/sqlite/lib/capi_linux_arm64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1326
									
								
								vendor/modernc.org/sqlite/lib/capi_linux_s390x.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1326
									
								
								vendor/modernc.org/sqlite/lib/capi_linux_s390x.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1324
									
								
								vendor/modernc.org/sqlite/lib/capi_netbsd_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1324
									
								
								vendor/modernc.org/sqlite/lib/capi_netbsd_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1246
									
								
								vendor/modernc.org/sqlite/lib/capi_windows_386.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1246
									
								
								vendor/modernc.org/sqlite/lib/capi_windows_386.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1344
									
								
								vendor/modernc.org/sqlite/lib/capi_windows_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1344
									
								
								vendor/modernc.org/sqlite/lib/capi_windows_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										14
									
								
								vendor/modernc.org/sqlite/lib/hooks.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								vendor/modernc.org/sqlite/lib/hooks.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| // Copyright 2019 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. | ||||
|  | ||||
| package sqlite3 | ||||
|  | ||||
| import ( | ||||
| 	"modernc.org/libc" | ||||
| ) | ||||
|  | ||||
| // Format and write a message to the log if logging is enabled. | ||||
| func X__ccgo_sqlite3_log(t *libc.TLS, iErrCode int32, zFormat uintptr, va uintptr) { /* sqlite3.c:29405:17: */ | ||||
| 	libc.X__ccgo_sqlite3_log(t, iErrCode, zFormat, va) | ||||
| } | ||||
							
								
								
									
										337
									
								
								vendor/modernc.org/sqlite/lib/mutex.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										337
									
								
								vendor/modernc.org/sqlite/lib/mutex.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,337 @@ | ||||
| // Copyright 2021 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. | ||||
|  | ||||
| package sqlite3 | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"sync" | ||||
| 	"sync/atomic" | ||||
| 	"unsafe" | ||||
|  | ||||
| 	"modernc.org/libc" | ||||
| 	"modernc.org/libc/sys/types" | ||||
| ) | ||||
|  | ||||
| func init() { | ||||
| 	tls := libc.NewTLS() | ||||
| 	if Xsqlite3_threadsafe(tls) == 0 { | ||||
| 		panic(fmt.Errorf("sqlite: thread safety configuration error")) | ||||
| 	} | ||||
|  | ||||
| 	varArgs := libc.Xmalloc(tls, types.Size_t(unsafe.Sizeof(uintptr(0)))) | ||||
| 	if varArgs == 0 { | ||||
| 		panic(fmt.Errorf("cannot allocate memory")) | ||||
| 	} | ||||
|  | ||||
| 	// int sqlite3_config(int, ...); | ||||
| 	if rc := Xsqlite3_config(tls, SQLITE_CONFIG_MUTEX, libc.VaList(varArgs, uintptr(unsafe.Pointer(&mutexMethods)))); rc != SQLITE_OK { | ||||
| 		p := Xsqlite3_errstr(tls, rc) | ||||
| 		str := libc.GoString(p) | ||||
| 		panic(fmt.Errorf("sqlite: failed to configure mutex methods: %v", str)) | ||||
| 	} | ||||
|  | ||||
| 	libc.Xfree(tls, varArgs) | ||||
| 	tls.Close() | ||||
| } | ||||
|  | ||||
| var ( | ||||
| 	mutexMethods = Sqlite3_mutex_methods{ | ||||
| 		FxMutexInit: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS) int32 }{mutexInit})), | ||||
| 		FxMutexEnd:  *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS) int32 }{mutexEnd})), | ||||
| 		FxMutexAlloc: *(*uintptr)(unsafe.Pointer(&struct { | ||||
| 			f func(*libc.TLS, int32) uintptr | ||||
| 		}{mutexAlloc})), | ||||
| 		FxMutexFree:  *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{mutexFree})), | ||||
| 		FxMutexEnter: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{mutexEnter})), | ||||
| 		FxMutexTry: *(*uintptr)(unsafe.Pointer(&struct { | ||||
| 			f func(*libc.TLS, uintptr) int32 | ||||
| 		}{mutexTry})), | ||||
| 		FxMutexLeave: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{mutexLeave})), | ||||
| 		FxMutexHeld: *(*uintptr)(unsafe.Pointer(&struct { | ||||
| 			f func(*libc.TLS, uintptr) int32 | ||||
| 		}{mutexHeld})), | ||||
| 		FxMutexNotheld: *(*uintptr)(unsafe.Pointer(&struct { | ||||
| 			f func(*libc.TLS, uintptr) int32 | ||||
| 		}{mutexNotheld})), | ||||
| 	} | ||||
|  | ||||
| 	mutexApp1   mutex | ||||
| 	mutexApp2   mutex | ||||
| 	mutexApp3   mutex | ||||
| 	mutexLRU    mutex | ||||
| 	mutexMaster mutex | ||||
| 	mutexMem    mutex | ||||
| 	mutexOpen   mutex | ||||
| 	mutexPMem   mutex | ||||
| 	mutexPRNG   mutex | ||||
| 	mutexVFS1   mutex | ||||
| 	mutexVFS2   mutex | ||||
| 	mutexVFS3   mutex | ||||
| ) | ||||
|  | ||||
| type mutex struct { | ||||
| 	cnt int32 | ||||
| 	id  int32 | ||||
| 	sync.Mutex | ||||
| 	wait      sync.Mutex | ||||
| 	recursive bool | ||||
| } | ||||
|  | ||||
| func (m *mutex) enter(id int32) { | ||||
| 	if !m.recursive { | ||||
| 		m.Lock() | ||||
| 		m.id = id | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	for { | ||||
| 		m.Lock() | ||||
| 		switch m.id { | ||||
| 		case 0: | ||||
| 			m.cnt = 1 | ||||
| 			m.id = id | ||||
| 			m.wait.Lock() | ||||
| 			m.Unlock() | ||||
| 			return | ||||
| 		case id: | ||||
| 			m.cnt++ | ||||
| 			m.Unlock() | ||||
| 			return | ||||
| 		} | ||||
|  | ||||
| 		m.Unlock() | ||||
| 		m.wait.Lock() | ||||
| 		//lint:ignore SA2001 TODO report staticcheck issue | ||||
| 		m.wait.Unlock() | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (m *mutex) try(id int32) int32 { | ||||
| 	if !m.recursive { | ||||
| 		return SQLITE_BUSY | ||||
| 	} | ||||
|  | ||||
| 	m.Lock() | ||||
| 	switch m.id { | ||||
| 	case 0: | ||||
| 		m.cnt = 1 | ||||
| 		m.id = id | ||||
| 		m.wait.Lock() | ||||
| 		m.Unlock() | ||||
| 		return SQLITE_OK | ||||
| 	case id: | ||||
| 		m.cnt++ | ||||
| 		m.Unlock() | ||||
| 		return SQLITE_OK | ||||
| 	} | ||||
|  | ||||
| 	m.Unlock() | ||||
| 	return SQLITE_BUSY | ||||
| } | ||||
|  | ||||
| func (m *mutex) leave(id int32) { | ||||
| 	if !m.recursive { | ||||
| 		m.id = 0 | ||||
| 		m.Unlock() | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	m.Lock() | ||||
| 	m.cnt-- | ||||
| 	if m.cnt == 0 { | ||||
| 		m.id = 0 | ||||
| 		m.wait.Unlock() | ||||
| 	} | ||||
| 	m.Unlock() | ||||
| } | ||||
|  | ||||
| // int (*xMutexInit)(void); | ||||
| // | ||||
| // The xMutexInit method defined by this structure is invoked as part of system | ||||
| // initialization by the sqlite3_initialize() function. The xMutexInit routine | ||||
| // is called by SQLite exactly once for each effective call to | ||||
| // sqlite3_initialize(). | ||||
| // | ||||
| // The xMutexInit() method must be threadsafe. It must be harmless to invoke | ||||
| // xMutexInit() multiple times within the same process and without intervening | ||||
| // calls to xMutexEnd(). Second and subsequent calls to xMutexInit() must be | ||||
| // no-ops. xMutexInit() must not use SQLite memory allocation (sqlite3_malloc() | ||||
| // and its associates). | ||||
| // | ||||
| // If xMutexInit fails in any way, it is expected to clean up after itself | ||||
| // prior to returning. | ||||
| func mutexInit(tls *libc.TLS) int32 { return SQLITE_OK } | ||||
|  | ||||
| // int (*xMutexEnd)(void); | ||||
| func mutexEnd(tls *libc.TLS) int32 { return SQLITE_OK } | ||||
|  | ||||
| // sqlite3_mutex *(*xMutexAlloc)(int); | ||||
| // | ||||
| // The sqlite3_mutex_alloc() routine allocates a new mutex and returns a | ||||
| // pointer to it. The sqlite3_mutex_alloc() routine returns NULL if it is | ||||
| // unable to allocate the requested mutex. The argument to | ||||
| // sqlite3_mutex_alloc() must one of these integer constants: | ||||
| // | ||||
| //	SQLITE_MUTEX_FAST | ||||
| //	SQLITE_MUTEX_RECURSIVE | ||||
| //	SQLITE_MUTEX_STATIC_MASTER | ||||
| //	SQLITE_MUTEX_STATIC_MEM | ||||
| //	SQLITE_MUTEX_STATIC_OPEN | ||||
| //	SQLITE_MUTEX_STATIC_PRNG | ||||
| //	SQLITE_MUTEX_STATIC_LRU | ||||
| //	SQLITE_MUTEX_STATIC_PMEM | ||||
| //	SQLITE_MUTEX_STATIC_APP1 | ||||
| //	SQLITE_MUTEX_STATIC_APP2 | ||||
| //	SQLITE_MUTEX_STATIC_APP3 | ||||
| //	SQLITE_MUTEX_STATIC_VFS1 | ||||
| //	SQLITE_MUTEX_STATIC_VFS2 | ||||
| //	SQLITE_MUTEX_STATIC_VFS3 | ||||
| // | ||||
| // The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) cause | ||||
| // sqlite3_mutex_alloc() to create a new mutex. The new mutex is recursive when | ||||
| // SQLITE_MUTEX_RECURSIVE is used but not necessarily so when SQLITE_MUTEX_FAST | ||||
| // is used. The mutex implementation does not need to make a distinction | ||||
| // between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does not want to. | ||||
| // SQLite will only request a recursive mutex in cases where it really needs | ||||
| // one. If a faster non-recursive mutex implementation is available on the host | ||||
| // platform, the mutex subsystem might return such a mutex in response to | ||||
| // SQLITE_MUTEX_FAST. | ||||
| // | ||||
| // The other allowed parameters to sqlite3_mutex_alloc() (anything other than | ||||
| // SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return a pointer to a | ||||
| // static preexisting mutex. Nine static mutexes are used by the current | ||||
| // version of SQLite. Future versions of SQLite may add additional static | ||||
| // mutexes. Static mutexes are for internal use by SQLite only. Applications | ||||
| // that use SQLite mutexes should use only the dynamic mutexes returned by | ||||
| // SQLITE_MUTEX_FAST or SQLITE_MUTEX_RECURSIVE. | ||||
| // | ||||
| // Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST or | ||||
| // SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc() returns a | ||||
| // different mutex on every call. For the static mutex types, the same mutex is | ||||
| // returned on every call that has the same type number. | ||||
| func mutexAlloc(tls *libc.TLS, typ int32) uintptr { | ||||
| 	defer func() { | ||||
| 	}() | ||||
| 	switch typ { | ||||
| 	case SQLITE_MUTEX_FAST: | ||||
| 		return libc.Xcalloc(tls, 1, types.Size_t(unsafe.Sizeof(mutex{}))) | ||||
| 	case SQLITE_MUTEX_RECURSIVE: | ||||
| 		p := libc.Xcalloc(tls, 1, types.Size_t(unsafe.Sizeof(mutex{}))) | ||||
| 		(*mutex)(unsafe.Pointer(p)).recursive = true | ||||
| 		return p | ||||
| 	case SQLITE_MUTEX_STATIC_MASTER: | ||||
| 		return uintptr(unsafe.Pointer(&mutexMaster)) | ||||
| 	case SQLITE_MUTEX_STATIC_MEM: | ||||
| 		return uintptr(unsafe.Pointer(&mutexMem)) | ||||
| 	case SQLITE_MUTEX_STATIC_OPEN: | ||||
| 		return uintptr(unsafe.Pointer(&mutexOpen)) | ||||
| 	case SQLITE_MUTEX_STATIC_PRNG: | ||||
| 		return uintptr(unsafe.Pointer(&mutexPRNG)) | ||||
| 	case SQLITE_MUTEX_STATIC_LRU: | ||||
| 		return uintptr(unsafe.Pointer(&mutexLRU)) | ||||
| 	case SQLITE_MUTEX_STATIC_PMEM: | ||||
| 		return uintptr(unsafe.Pointer(&mutexPMem)) | ||||
| 	case SQLITE_MUTEX_STATIC_APP1: | ||||
| 		return uintptr(unsafe.Pointer(&mutexApp1)) | ||||
| 	case SQLITE_MUTEX_STATIC_APP2: | ||||
| 		return uintptr(unsafe.Pointer(&mutexApp2)) | ||||
| 	case SQLITE_MUTEX_STATIC_APP3: | ||||
| 		return uintptr(unsafe.Pointer(&mutexApp3)) | ||||
| 	case SQLITE_MUTEX_STATIC_VFS1: | ||||
| 		return uintptr(unsafe.Pointer(&mutexVFS1)) | ||||
| 	case SQLITE_MUTEX_STATIC_VFS2: | ||||
| 		return uintptr(unsafe.Pointer(&mutexVFS2)) | ||||
| 	case SQLITE_MUTEX_STATIC_VFS3: | ||||
| 		return uintptr(unsafe.Pointer(&mutexVFS3)) | ||||
| 	default: | ||||
| 		return 0 | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // void (*xMutexFree)(sqlite3_mutex *); | ||||
| func mutexFree(tls *libc.TLS, m uintptr) { libc.Xfree(tls, m) } | ||||
|  | ||||
| // The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt to enter | ||||
| // a mutex. If another thread is already within the mutex, | ||||
| // sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return | ||||
| // SQLITE_BUSY. The sqlite3_mutex_try() interface returns SQLITE_OK upon | ||||
| // successful entry. Mutexes created using SQLITE_MUTEX_RECURSIVE can be | ||||
| // entered multiple times by the same thread. In such cases, the mutex must be | ||||
| // exited an equal number of times before another thread can enter. If the same | ||||
| // thread tries to enter any mutex other than an SQLITE_MUTEX_RECURSIVE more | ||||
| // than once, the behavior is undefined. | ||||
| // | ||||
| // If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or | ||||
| // sqlite3_mutex_leave() is a NULL pointer, then all three routines behave as | ||||
| // no-ops. | ||||
|  | ||||
| // void (*xMutexEnter)(sqlite3_mutex *); | ||||
| func mutexEnter(tls *libc.TLS, m uintptr) { | ||||
| 	if m == 0 { | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	(*mutex)(unsafe.Pointer(m)).enter(tls.ID) | ||||
| } | ||||
|  | ||||
| // int (*xMutexTry)(sqlite3_mutex *); | ||||
| func mutexTry(tls *libc.TLS, m uintptr) int32 { | ||||
| 	if m == 0 { | ||||
| 		return SQLITE_OK | ||||
| 	} | ||||
|  | ||||
| 	return (*mutex)(unsafe.Pointer(m)).try(tls.ID) | ||||
| } | ||||
|  | ||||
| // void (*xMutexLeave)(sqlite3_mutex *); | ||||
| func mutexLeave(tls *libc.TLS, m uintptr) { | ||||
| 	if m == 0 { | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	(*mutex)(unsafe.Pointer(m)).leave(tls.ID) | ||||
| } | ||||
|  | ||||
| // The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines are intended | ||||
| // for use inside assert() statements. The SQLite core never uses these | ||||
| // routines except inside an assert() and applications are advised to follow | ||||
| // the lead of the core. The SQLite core only provides implementations for | ||||
| // these routines when it is compiled with the SQLITE_DEBUG flag. External | ||||
| // mutex implementations are only required to provide these routines if | ||||
| // SQLITE_DEBUG is defined and if NDEBUG is not defined. | ||||
| // | ||||
| // These routines should return true if the mutex in their argument is held or | ||||
| // not held, respectively, by the calling thread. | ||||
| // | ||||
| // The implementation is not required to provide versions of these routines | ||||
| // that actually work. If the implementation does not provide working versions | ||||
| // of these routines, it should at least provide stubs that always return true | ||||
| // so that one does not get spurious assertion failures. | ||||
| // | ||||
| // If the argument to sqlite3_mutex_held() is a NULL pointer then the routine | ||||
| // should return 1. This seems counter-intuitive since clearly the mutex cannot | ||||
| // be held if it does not exist. But the reason the mutex does not exist is | ||||
| // because the build is not using mutexes. And we do not want the assert() | ||||
| // containing the call to sqlite3_mutex_held() to fail, so a non-zero return is | ||||
| // the appropriate thing to do. The sqlite3_mutex_notheld() interface should | ||||
| // also return 1 when given a NULL pointer. | ||||
|  | ||||
| // int (*xMutexHeld)(sqlite3_mutex *); | ||||
| func mutexHeld(tls *libc.TLS, m uintptr) int32 { | ||||
| 	if m == 0 { | ||||
| 		return 1 | ||||
| 	} | ||||
|  | ||||
| 	return libc.Bool32(atomic.LoadInt32(&(*mutex)(unsafe.Pointer(m)).id) == tls.ID) | ||||
| } | ||||
|  | ||||
| // int (*xMutexNotheld)(sqlite3_mutex *); | ||||
| func mutexNotheld(tls *libc.TLS, m uintptr) int32 { | ||||
| 	if m == 0 { | ||||
| 		return 1 | ||||
| 	} | ||||
|  | ||||
| 	return libc.Bool32(atomic.LoadInt32(&(*mutex)(unsafe.Pointer(m)).id) != tls.ID) | ||||
| } | ||||
							
								
								
									
										209864
									
								
								vendor/modernc.org/sqlite/lib/sqlite_darwin_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										209864
									
								
								vendor/modernc.org/sqlite/lib/sqlite_darwin_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										208569
									
								
								vendor/modernc.org/sqlite/lib/sqlite_darwin_arm64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										208569
									
								
								vendor/modernc.org/sqlite/lib/sqlite_darwin_arm64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										193693
									
								
								vendor/modernc.org/sqlite/lib/sqlite_freebsd_386.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										193693
									
								
								vendor/modernc.org/sqlite/lib/sqlite_freebsd_386.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										193789
									
								
								vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										193789
									
								
								vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										194838
									
								
								vendor/modernc.org/sqlite/lib/sqlite_linux_386.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										194838
									
								
								vendor/modernc.org/sqlite/lib/sqlite_linux_386.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										195048
									
								
								vendor/modernc.org/sqlite/lib/sqlite_linux_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										195048
									
								
								vendor/modernc.org/sqlite/lib/sqlite_linux_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										195106
									
								
								vendor/modernc.org/sqlite/lib/sqlite_linux_arm.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										195106
									
								
								vendor/modernc.org/sqlite/lib/sqlite_linux_arm.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										195265
									
								
								vendor/modernc.org/sqlite/lib/sqlite_linux_arm64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										195265
									
								
								vendor/modernc.org/sqlite/lib/sqlite_linux_arm64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										195218
									
								
								vendor/modernc.org/sqlite/lib/sqlite_linux_s390x.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										195218
									
								
								vendor/modernc.org/sqlite/lib/sqlite_linux_s390x.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										194468
									
								
								vendor/modernc.org/sqlite/lib/sqlite_netbsd_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										194468
									
								
								vendor/modernc.org/sqlite/lib/sqlite_netbsd_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										229849
									
								
								vendor/modernc.org/sqlite/lib/sqlite_windows_386.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										229849
									
								
								vendor/modernc.org/sqlite/lib/sqlite_windows_386.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										240521
									
								
								vendor/modernc.org/sqlite/lib/sqlite_windows_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										240521
									
								
								vendor/modernc.org/sqlite/lib/sqlite_windows_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										23
									
								
								vendor/modernc.org/sqlite/mutex.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								vendor/modernc.org/sqlite/mutex.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| // Copyright 2019 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. | ||||
|  | ||||
| package sqlite // import "modernc.org/sqlite" | ||||
|  | ||||
| import ( | ||||
| 	"sync" | ||||
| 	"unsafe" | ||||
|  | ||||
| 	"modernc.org/libc" | ||||
| 	"modernc.org/libc/sys/types" | ||||
| ) | ||||
|  | ||||
| type mutex struct { | ||||
| 	sync.Mutex | ||||
| } | ||||
|  | ||||
| func mutexAlloc(tls *libc.TLS) uintptr { | ||||
| 	return libc.Xcalloc(tls, 1, types.Size_t(unsafe.Sizeof(mutex{}))) | ||||
| } | ||||
|  | ||||
| func mutexFree(tls *libc.TLS, m uintptr) { libc.Xfree(tls, m) } | ||||
							
								
								
									
										10
									
								
								vendor/modernc.org/sqlite/rlimit.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								vendor/modernc.org/sqlite/rlimit.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| // Copyright 2021 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 !freebsd | ||||
| // +build !freebsd | ||||
|  | ||||
| package sqlite // import "modernc.org/sqlite" | ||||
|  | ||||
| func setMaxOpenFiles(n int) error { return nil } | ||||
							
								
								
									
										16
									
								
								vendor/modernc.org/sqlite/rlimit_freebsd.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								vendor/modernc.org/sqlite/rlimit_freebsd.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| // Copyright 2021 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. | ||||
|  | ||||
| package sqlite // import "modernc.org/sqlite" | ||||
|  | ||||
| import ( | ||||
| 	"golang.org/x/sys/unix" | ||||
| ) | ||||
|  | ||||
| func setMaxOpenFiles(n int64) error { | ||||
| 	var rLimit unix.Rlimit | ||||
| 	rLimit.Max = n | ||||
| 	rLimit.Cur = n | ||||
| 	return unix.Setrlimit(unix.RLIMIT_NOFILE, &rLimit) | ||||
| } | ||||
							
								
								
									
										1391
									
								
								vendor/modernc.org/sqlite/sqlite.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1391
									
								
								vendor/modernc.org/sqlite/sqlite.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										49
									
								
								vendor/modernc.org/sqlite/sqlite_go18.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								vendor/modernc.org/sqlite/sqlite_go18.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | ||||
| // 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 go1.8 | ||||
| // +build go1.8 | ||||
|  | ||||
| package sqlite // import "modernc.org/sqlite" | ||||
|  | ||||
| import ( | ||||
| 	"context" | ||||
| 	"database/sql/driver" | ||||
| ) | ||||
|  | ||||
| // Ping implements driver.Pinger | ||||
| func (c *conn) Ping(ctx context.Context) error { | ||||
| 	_, err := c.ExecContext(ctx, "select 1", nil) | ||||
| 	return err | ||||
| } | ||||
|  | ||||
| // BeginTx implements driver.ConnBeginTx | ||||
| func (c *conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) { | ||||
| 	return c.begin(ctx, opts) | ||||
| } | ||||
|  | ||||
| // PrepareContext implements driver.ConnPrepareContext | ||||
| func (c *conn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) { | ||||
| 	return c.prepare(ctx, query) | ||||
| } | ||||
|  | ||||
| // ExecContext implements driver.ExecerContext | ||||
| func (c *conn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) { | ||||
| 	return c.exec(ctx, query, args) | ||||
| } | ||||
|  | ||||
| // QueryContext implements driver.QueryerContext | ||||
| func (c *conn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) { | ||||
| 	return c.query(ctx, query, args) | ||||
| } | ||||
|  | ||||
| // ExecContext implements driver.StmtExecContext | ||||
| func (s *stmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error) { | ||||
| 	return s.exec(ctx, args) | ||||
| } | ||||
|  | ||||
| // QueryContext implements driver.StmtQueryContext | ||||
| func (s *stmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) { | ||||
| 	return s.query(ctx, args) | ||||
| } | ||||
							
								
								
									
										20
									
								
								vendor/modernc.org/sqlite/tpch.sh
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								vendor/modernc.org/sqlite/tpch.sh
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| set -e | ||||
| echo "See http://www.tpc.org/tpc_documents_current_versions/pdf/tpc-h_v2.17.1.pdf for details" | ||||
| tmp=$(mktemp -d) | ||||
| cd $tmp | ||||
| echo "installing modernc.org/sqlite/tpch@latest into $tmp" | ||||
| GOBIN=$tmp go install modernc.org/sqlite/tpch@latest | ||||
| echo "generating pseudotext" | ||||
| ./tpch -pseudotext | ||||
| for sf in 1 10 ; do | ||||
| 	for sut in sqlite3 sqlite ; do | ||||
| 		echo "$sut: generating a $sf GB test DB" | ||||
| 		time -p ./tpch -sut $sut -dbgen -sf $sf | ||||
| 		for q in 1 2 ; do | ||||
| 			echo -n "$sut: running query $q: " | ||||
| 			./tpch -sut $sut -q $q -sf $sf | ||||
| 		done | ||||
| 	done | ||||
| done | ||||
| cd - | ||||
| rm -rf $tmp | ||||
							
								
								
									
										4
									
								
								vendor/modernc.org/sqlite/unconvert.sh
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								vendor/modernc.org/sqlite/unconvert.sh
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| until unconvert -fastmath . &> /dev/null | ||||
| do | ||||
| 	unconvert -fastmath -apply . &> /dev/null | ||||
| done | ||||
		Reference in New Issue
	
	Block a user
	 Wim
					Wim