The package provide a complete implementation of database_sql package. It's using WebAssembly api compiled from sqlite3 source code by emscripten when running on web browser. All latest of the major browser such as Chrome, FireFox, Safari is supported.
What's next ?
- Explore possibility to implement VFS with or without 15041
- Explore possibility to implement module or virtual table to redirect data to IndexedDB. The downside is that not all sqlite feature is supported when running with virtual table.
- Move sqlite functionality into web worker or service worker instead of main thread.
dependencies: database_sql: 0.0.1 dsqlite: 0.0.1
Compile WebAssembly from sqlite3 source code using emscripten. Before you can compile a webassembly, you must have emscripten install and available in your PATH environment variable visit Getting Started for instruction how to install emscripten.
After you have emscripten installed, run below command to generate WebAssembly file.
By default, it's using pre-define build configuration within package this package. The default setting
generate multiple output with format ASM and WASM in
dart run dsqlite -b -d --release 2021:3.36.00 -o /* directory to store the generate file */
To disable multiple build or include your own desire optimization then you can provide custom build
configuration. Create configuration file name
sqlite_webassembly_build.yaml in your root repository.
Before running test, it required to download sqlite source code and build locally therefore you must has emscripten installed and necessary tools to build sqlite from source code.
The test code expect a dynamic library location at:
# Window platform sqlite/latest/sqlite3.dll # linux, this library is auto generate by sqlite3 source code make file. sqlite/latest/.libs/libsqlite3.so # macos, this library is auto generate by sqlite3 source code make file. sqlite/latest/.libs/libsqlite3.dylib
For Windows user, it's required to build sqlite3 library
sqlite3.dll manually follow the documentation
description here at sqlite website.
For user running platform otherwise Windows, use make to build and run the test. Windows user may use
powershell or other other command line application to run makefile.
make requisition # test both browser (debug webassembly only) and vm make dsqlite_test_local # full test for both browser (debug and release) and vm make dsqlite_test