This repository is a fork of the [SQLite-net](https://github.com/praeclarum/sqlite-net) repository to add support for WebAssembly, using the [Uno.SQLite-wasm](https://github.com/nventive/Uno.sqlite-wasm) package.
This is a work in progress.
## Testing the library
- Open the [SQLite solution](SQLite.sln)
- Build the `SQLite.Tests.Wasm` project
- Using WSL, go the `dist` folder that was created in the `bin\Debug` folder
- Run a web server using `python3 server.py`
- Navigate to `http://localhost:8000`
- Observe the results in the browser's debugger window
## TODO
- Make all the tests pass
- Publish a proper nuget package
- Integrate the `WebAssembly` TFM when https://github.com/NuGet/NuGet.Client/pull/2159 will be available.
| [![NuGet Package](https://img.shields.io/nuget/v/sqlite-net-pcl.svg)](https://www.nuget.org/packages/sqlite-net-pcl) | [sqlite-net-pcl](https://www.nuget.org/packages/sqlite-net-pcl) | .NET Standard Library |
| [![NuGet Package with Encryption](https://img.shields.io/nuget/v/sqlite-net-sqlcipher.svg)](https://www.nuget.org/packages/sqlite-net-sqlcipher) | [sqlite-net-sqlcipher](https://www.nuget.org/packages/sqlite-net-sqlcipher) | With Encryption Support |
SQLite-net is an open source, minimal library to allow .NET, .NET Core, and Mono applications to store data in
* Very simple methods for executing CRUD operations and queries safely (using parameters) and for retrieving the results of those query in a strongly typed fashion.
**Important:** You will need to add the nuget package to **both** your *PCL project* and your *platform-dependent project*.
## Source Installation
SQLite-net is all contained in 1 file (I know, so cool right?) and is easy to add to your project. Just add [SQLite.cs](https://github.com/praeclarum/sqlite-net/blob/master/src/SQLite.cs) to your project, and you're ready to start creating tables.
This is an open source project that welcomes contributions/suggestions/bug reports from those who use it. If you have any ideas on how to improve the library, please [post an issue here on github](https://github.com/praeclarum/sqlite-net/issues). Please check out the [How to Contribute](https://github.com/praeclarum/sqlite-net/wiki/How-to-Contribute).
You can insert rows in the database using `Insert`. If the table contains an auto-incremented primary key, then the value for that key will be available to you after the insert:
The most straightforward way to query for data is using the `Table` method. This can take predicates for constraining via WHERE clauses and/or adding ORDER BY clauses:
The generic parameter to the `Query` method specifies the type of object to create for each row. It can be one of your table classes, or any other class whose public properties match the column returned by the query. For instance, we could rewrite the above query as:
You can insert rows in the database using `Insert`. If the table contains an auto-incremented primary key, then the value for that key will be available to you after the insert:
You can add support for encrypted databases using SQLCipher by including an additional package [SQLitePCLRaw.bundle_sqlcipher](https://www.nuget.org/packages/SQLitePCLRaw.bundle_sqlcipher/).
I'll let [Eric Sink explain how to use SQLCipher with SQLite-net](https://github.com/ericsink/SQLitePCL.raw/wiki/How-to-use-SQLCipher-with-SQLite-net):