Skip to content

Commit 3ded039

Browse files
mugikhanrodydavissimolus3rkistner
authored
Update sqlite3 to v2.4.7 (#14)
* Adding uuid.c example * Expand readme * Link custom extension example * Fix extension tests in CI * Add a DynamicBuffer for faster VFS implementations. * Switch to Uint8Buffer. * Support 16KiB page sizes on Android * Avoid copying for writes to memory * Changelog entry * Re-compile sqlite3 for CI --------- Co-authored-by: Rody Davis <[email protected]> Co-authored-by: Simon Binder <[email protected]> Co-authored-by: Ralf Kistner <[email protected]>
1 parent 4b7244f commit 3ded039

File tree

151 files changed

+5263
-33
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+5263
-33
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
id: cache_sqlite_build
2424
with:
2525
path: sqlite/out
26-
key: sqlite-${{ runner.os }}-${{ env.SQLITE_VERSION }}
26+
key: sqlite-v3-${{ runner.os }}-${{ env.SQLITE_VERSION }}
2727
- name: Compile sqlite3 on Linux
2828
if: steps.cache_sqlite_build.outputs.cache-hit != 'true' && runner.os == 'Linux'
2929
run: |
@@ -37,6 +37,7 @@ jobs:
3737
mkdir ../out
3838
cp sqlite3 ../out
3939
cp .libs/libsqlite3.so ../out
40+
cp *.h ../out
4041
- name: Compile sqlite3 on macOS
4142
if: steps.cache_sqlite_build.outputs.cache-hit != 'true' && runner.os == 'macOS'
4243
run: |
@@ -50,6 +51,7 @@ jobs:
5051
mkdir ../out
5152
cp sqlite3 ../out
5253
cp .libs/libsqlite3.dylib ../out
54+
cp *.h ../out
5355
- uses: ilammy/msvc-dev-cmd@v1
5456
if: steps.cache_sqlite_build.outputs.cache-hit != 'true' && runner.os == 'Windows'
5557
- name: Compile sqlite3 on Windows
@@ -69,6 +71,7 @@ jobs:
6971
cp sqlite3.dll ../out
7072
cp sqlite3.h ../out
7173
cp sqlite3ext.h ../out
74+
cp *.h ../out
7275
- name: Upload built sqlite3 binaries
7376
uses: actions/upload-artifact@v4
7477
with:
@@ -145,12 +148,14 @@ jobs:
145148
chmod a+x sqlite/out/sqlite3
146149
realpath sqlite/out >> $GITHUB_PATH
147150
echo "LD_LIBRARY_PATH=$(realpath sqlite/out)" >> $GITHUB_ENV
151+
echo "C_INCLUDE_PATH=$(realpath sqlite/out)" >> $GITHUB_ENV
148152
- name: Install compiled sqlite3 (macOS)
149153
if: runner.os == 'macOS'
150154
run: |
151155
chmod a+x sqlite/out/sqlite3
152156
echo "$(pwd)/sqlite/out" >> $GITHUB_PATH
153157
echo "DYLD_LIBRARY_PATH=$(pwd)/sqlite/out" >> $GITHUB_ENV
158+
echo "CPATH=$(pwd)/sqlite/out" >> $GITHUB_ENV
154159
- uses: ilammy/msvc-dev-cmd@v1
155160
if: runner.os == 'Windows'
156161
- name: Install compiled sqlite3 (Windows)

sqlite3/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.4.7
2+
3+
- Web: Improve performance of in-memory and IndexedDB file system implementations.
4+
15
## 2.4.6
26

37
- WebAssembly: Call `_initialize` function of sqlite3 module if one is present.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
migrate_working_dir/
12+
13+
# IntelliJ related
14+
*.iml
15+
*.ipr
16+
*.iws
17+
.idea/
18+
19+
# The .vscode folder contains launch configuration and tasks you configure in
20+
# VS Code which you may wish to be included in version control, so this line
21+
# is commented out by default.
22+
#.vscode/
23+
24+
# Flutter/Dart/Pub related
25+
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
26+
/pubspec.lock
27+
**/doc/api/
28+
.dart_tool/
29+
build/
30+
31+
src/sqlite3.h
32+
src/sqlite3ext.h
33+
vendor/
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled and should not be manually edited.
5+
6+
version:
7+
revision: "80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819"
8+
channel: "stable"
9+
10+
project_type: plugin_ffi
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
17+
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
18+
- platform: android
19+
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
20+
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
21+
- platform: ios
22+
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
23+
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
24+
- platform: linux
25+
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
26+
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
27+
- platform: macos
28+
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
29+
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
30+
- platform: windows
31+
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
32+
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
33+
34+
# User provided section
35+
36+
# List of Local paths (relative to this file) that should be
37+
# ignored by the migrate tool.
38+
#
39+
# Files that are not part of the templates will be ignored by default.
40+
unmanaged_files:
41+
- 'lib/main.dart'
42+
- 'ios/Runner.xcodeproj/project.pbxproj'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.0.1
2+
3+
* TODO: Describe initial release.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TODO: Add your license here.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
vendor:
2+
mkdir -p vendor
3+
curl -o sqlite-amalgamation.zip https://www.sqlite.org/2024/sqlite-amalgamation-3450300.zip
4+
unzip sqlite-amalgamation.zip
5+
mv sqlite-amalgamation-3450300/* vendor/
6+
rmdir sqlite-amalgamation-3450300
7+
rm sqlite-amalgamation.zip
8+
9+
deps: sqlite3ext.h sqlite3.h
10+
11+
init: vendor deps
12+
13+
sqlite3ext.h: ./vendor/sqlite3ext.h
14+
cp $< $@
15+
mv sqlite3ext.h src/
16+
17+
sqlite3.h: ./vendor/sqlite3.h
18+
cp $< $@
19+
mv sqlite3.h src/
20+
21+
.PHONY: deps
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# uuid.c example
2+
3+
This example shows how to load SQLite extensions into Flutter apps using `sqlite3_flutter_libs`.
4+
As an example, it uses the [uuid.c](https://github.com/sqlite/sqlite/blob/master/ext/misc/uuid.c)
5+
extension, but other extensions can be adapted similarly.
6+
7+
To build the extension:
8+
9+
1. A `CMakeLists.txt` (in `src/`) is written for Android, Linux and Windows.
10+
2. On Android, the NDK is set up to point at the CMake builds in `android/build.gradle`.
11+
3. For macOS and iOS (which don't use CMake as a build tool), the `uuid.c` file is added
12+
to `macos|ios/Classes` instead.
13+
4. Note that this example does not currently support WebAssembly. Loadable extensions don't
14+
work on the web, but you can compile a custom `sqlite3.wasm` bundle with the desired extensions
15+
included. The `../custom_wasm_build` example has an example for that setup.
16+
17+
This build setup includes a shared library with the extension in your app. To use it, load the
18+
`DynamicLibrary` and then load it into sqlite3 like this:
19+
20+
```dart
21+
sqlite3.ensureExtensionLoaded(
22+
SqliteExtension.inLibrary(uuid.lib, 'sqlite3_uuid_init'),
23+
);
24+
```
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include: package:flutter_lints/flutter.yaml
2+
3+
# Additional information about this file can be found at
4+
# https://dart.dev/guides/language/analysis-options
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/workspace.xml
5+
/.idea/libraries
6+
.DS_Store
7+
/build
8+
/captures
9+
.cxx

0 commit comments

Comments
 (0)