Skip to content

Commit

Permalink
SQLite 3.48.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
ncruces committed Jan 14, 2025
1 parent 3bae1d7 commit d9b3730
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 27 deletions.
2 changes: 1 addition & 1 deletion embed/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Embeddable Wasm build of SQLite

This folder includes an embeddable Wasm build of SQLite 3.47.2 for use with
This folder includes an embeddable Wasm build of SQLite 3.48.0 for use with
[`github.com/ncruces/go-sqlite3`](https://pkg.go.dev/github.com/ncruces/go-sqlite3).

The following optional features are compiled in:
Expand Down
Binary file modified embed/bcw2/bcw2.wasm
Binary file not shown.
6 changes: 3 additions & 3 deletions embed/bcw2/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ mkdir -p build/ext/
cp "$ROOT"/sqlite3/*.[ch] build/
cp "$ROOT"/sqlite3/*.patch build/

# https://sqlite.org/src/info/ec5d7025cba9f4ac
curl -# https://sqlite.org/src/tarball/sqlite.tar.gz?r=ec5d7025 | tar xz
# https://sqlite.org/src/info/fab341c829554573
curl -# https://sqlite.org/src/tarball/sqlite.tar.gz?r=fab341c8 | tar xz

cd sqlite
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" ]]; then
Expand All @@ -38,7 +38,7 @@ mv sqlite/ext/misc/spellfix.c build/ext/
mv sqlite/ext/misc/uint.c build/ext/

cd build
cat *.patch | patch --no-backup-if-mismatch
cat *.patch | patch -p0 --no-backup-if-mismatch
cd ~-

"$WASI_SDK/clang" --target=wasm32-wasi -std=c23 -g0 -O2 \
Expand Down
2 changes: 1 addition & 1 deletion embed/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func Test_init(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if version != "3.47.2" {
if version != "3.48.0" {
t.Error(version)
}
}
Binary file modified embed/sqlite3.wasm
Binary file not shown.
11 changes: 11 additions & 0 deletions sqlite3/base64.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- ext/base64.c.orig
+++ ext/base64.c
@@ -198,7 +198,7 @@
deliberate_fall_through; /* FALLTHRU */
case 1:
pOut[0] = (qv>>16) & 0xff;
- deliberate_fall_through; /* FALLTHRU */
+ break; /* FALLTHRU */
}
pOut += nbo;
}
2 changes: 1 addition & 1 deletion sqlite3/busy_timeout.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# handle, and interrupt, sqlite3_busy_timeout.
--- sqlite3.c.orig
+++ sqlite3.c
@@ -182928,7 +182928,7 @@
@@ -183054,7 +183054,7 @@
if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
#endif
if( ms>0 ){
Expand Down
38 changes: 19 additions & 19 deletions sqlite3/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -euo pipefail

cd -P -- "$(dirname -- "$0")"

curl -#OL "https://sqlite.org/2024/sqlite-amalgamation-3470200.zip"
curl -#OL "https://sqlite.org/2025/sqlite-amalgamation-3480000.zip"
unzip -d . sqlite-amalgamation-*.zip
mv sqlite-amalgamation-*/sqlite3.c .
mv sqlite-amalgamation-*/sqlite3.h .
Expand All @@ -17,32 +17,32 @@ rm -rf sqlite-amalgamation-*
# mv sqlite-snapshot-*/sqlite3ext.h .
# rm -rf sqlite-snapshot-*

cat *.patch | patch --no-backup-if-mismatch

mkdir -p ext/
cd ext/
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.47.2/ext/misc/anycollseq.c"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.47.2/ext/misc/base64.c"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.47.2/ext/misc/decimal.c"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.47.2/ext/misc/ieee754.c"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.47.2/ext/misc/regexp.c"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.47.2/ext/misc/series.c"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.47.2/ext/misc/spellfix.c"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.47.2/ext/misc/uint.c"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.48.0/ext/misc/anycollseq.c"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.48.0/ext/misc/base64.c"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.48.0/ext/misc/decimal.c"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.48.0/ext/misc/ieee754.c"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.48.0/ext/misc/regexp.c"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.48.0/ext/misc/series.c"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.48.0/ext/misc/spellfix.c"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.48.0/ext/misc/uint.c"
cd ~-

cd ../vfs/tests/mptest/testdata/
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.47.2/mptest/config01.test"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.47.2/mptest/config02.test"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.47.2/mptest/crash01.test"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.47.2/mptest/crash02.subtest"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.47.2/mptest/multiwrite01.test"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.48.0/mptest/config01.test"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.48.0/mptest/config02.test"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.48.0/mptest/crash01.test"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.48.0/mptest/crash02.subtest"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.48.0/mptest/multiwrite01.test"
cd ~-

cd ../vfs/tests/mptest/wasm/
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.47.2/mptest/mptest.c"
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.48.0/mptest/mptest.c"
cd ~-

cd ../vfs/tests/speedtest1/wasm/
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.47.2/test/speedtest1.c"
cd ~-
curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.48.0/test/speedtest1.c"
cd ~-

cat *.patch | patch -p0 --no-backup-if-mismatch
4 changes: 2 additions & 2 deletions sqlite3/vfs_find.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Remove VFS registration. Go handles it.
--- sqlite3.c.orig
+++ sqlite3.c
@@ -26603,7 +26603,7 @@
@@ -26623,7 +26623,7 @@
sqlite3_free(p);
return sqlite3_os_init();
}
Expand All @@ -10,7 +10,7 @@
/*
** The list of all registered VFS implementations.
*/
@@ -26700,7 +26700,7 @@
@@ -26720,7 +26720,7 @@
sqlite3_mutex_leave(mutex);
return SQLITE_OK;
}
Expand Down
Binary file modified vfs/tests/mptest/wasm/mptest.wasm
Binary file not shown.
Binary file modified vfs/tests/speedtest1/wasm/speedtest1.wasm
Binary file not shown.

0 comments on commit d9b3730

Please sign in to comment.