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
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// The Android Gradle Plugin builds the native code with the Android NDK.
2+
3+
group = "com.example.uuid"
4+
version = "1.0"
5+
6+
buildscript {
7+
repositories {
8+
google()
9+
mavenCentral()
10+
}
11+
12+
dependencies {
13+
// The Android Gradle Plugin knows how to build native code with the NDK.
14+
classpath("com.android.tools.build:gradle:7.3.0")
15+
}
16+
}
17+
18+
rootProject.allprojects {
19+
repositories {
20+
google()
21+
mavenCentral()
22+
}
23+
}
24+
25+
apply plugin: "com.android.library"
26+
27+
android {
28+
if (project.android.hasProperty("namespace")) {
29+
namespace = "com.example.uuid"
30+
}
31+
32+
// Bumping the plugin compileSdk version requires all clients of this plugin
33+
// to bump the version in their app.
34+
compileSdk = 34
35+
36+
// Use the NDK version
37+
// declared in /android/app/build.gradle file of the Flutter project.
38+
// Replace it with a version number if this plugin requires a specific NDK version.
39+
// (e.g. ndkVersion "23.1.7779620")
40+
ndkVersion = android.ndkVersion
41+
42+
// Invoke the shared CMake build with the Android Gradle Plugin.
43+
externalNativeBuild {
44+
cmake {
45+
path = "../src/CMakeLists.txt"
46+
47+
// The default CMake version for the Android Gradle Plugin is 3.10.2.
48+
// https://developer.android.com/studio/projects/install-ndk#vanilla_cmake
49+
//
50+
// The Flutter tooling requires that developers have CMake 3.10 or later
51+
// installed. You should not increase this version, as doing so will cause
52+
// the plugin to fail to compile for some customers of the plugin.
53+
// version "3.10.2"
54+
}
55+
}
56+
57+
compileOptions {
58+
sourceCompatibility = JavaVersion.VERSION_1_8
59+
targetCompatibility = JavaVersion.VERSION_1_8
60+
}
61+
62+
defaultConfig {
63+
minSdk = 21
64+
}
65+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'uuid'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.example.uuid">
3+
</manifest>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
**/doc/api/
26+
**/ios/Flutter/.last_build_id
27+
.dart_tool/
28+
.flutter-plugins
29+
.flutter-plugins-dependencies
30+
.pub-cache/
31+
.pub/
32+
/build/
33+
34+
# Symbolication related
35+
app.*.symbols
36+
37+
# Obfuscation related
38+
app.*.map.json
39+
40+
# Android Studio will place build artifacts here
41+
/android/app/debug
42+
/android/app/profile
43+
/android/app/release
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# uuid_example
2+
3+
Demonstrates how to use the uuid plugin.
4+
5+
## Getting Started
6+
7+
This project is a starting point for a Flutter application.
8+
9+
A few resources to get you started if this is your first Flutter project:
10+
11+
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
12+
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
13+
14+
For help getting started with Flutter development, view the
15+
[online documentation](https://docs.flutter.dev/), which offers tutorials,
16+
samples, guidance on mobile development, and a full API reference.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This file configures the analyzer, which statically analyzes Dart code to
2+
# check for errors, warnings, and lints.
3+
#
4+
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5+
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6+
# invoked from the command line by running `flutter analyze`.
7+
8+
# The following line activates a set of recommended lints for Flutter apps,
9+
# packages, and plugins designed to encourage good coding practices.
10+
include: package:flutter_lints/flutter.yaml
11+
12+
linter:
13+
# The lint rules applied to this project can be customized in the
14+
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15+
# included above or to enable additional rules. A list of all available lints
16+
# and their documentation is published at https://dart.dev/lints.
17+
#
18+
# Instead of disabling a lint rule for the entire project in the
19+
# section below, it can also be suppressed for a single line of code
20+
# or a specific dart file by using the `// ignore: name_of_lint` and
21+
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
22+
# producing the lint.
23+
rules:
24+
# avoid_print: false # Uncomment to disable the `avoid_print` rule
25+
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
26+
27+
# Additional information about this file can be found at
28+
# https://dart.dev/guides/language/analysis-options
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
gradle-wrapper.jar
2+
/.gradle
3+
/captures/
4+
/gradlew
5+
/gradlew.bat
6+
/local.properties
7+
GeneratedPluginRegistrant.java
8+
9+
# Remember to never publicly share your keystore.
10+
# See https://flutter.dev/to/reference-keystore
11+
key.properties
12+
**/*.keystore
13+
**/*.jks

0 commit comments

Comments
 (0)