OP SQLite

Installation

Configuration

Gotchas

Debugging

API


osp_circle.png

By Oscar Franco

Freelancer, RN/Rust magic

Twitter YouTube • [Email](mailto:[email protected]?subject=I%20need%20a%20Freelancer)

OP SQLite embeds the latest version of SQLite and provides a low-level API (WebSQL) to execute SQL queries on React Native.

It’s fast

It binds directly to JSI C++ functions and uses HostObjects to lazily instanciate the query result. This means running large queries will be as close to the metal as possible.

benchmark 1.png

Tests run with the performance flag and release scheme. You can run this yourself by compiling the example project.

Configurable

It compiles the latest version of SQLite from sources, this gives you access to the latest features and security fixes. It also prevents incompatibilities between OS-embedded versions. It will add 1.8mbs to your final app bundle.

Encryption

If you need to encrypt your database you can compile against SQLCipher, a fork of SQLite that encrypts your database with somewhat minimal overhead. Check out the encryption docs:

Why use a low-level driver

OP SQLite is rather a driver to execute queries directly. This in contrast with a full-blown ORM does not give you some of the niceties such as class abstractions. There are however advantages to this approach:

As your application grows the benefits of interacting directly with the database will outweigh abstractions.

3.45.1

Current SQLite Version

> 0.73 RN required

The app is compatible with bridgeless, however this requires a newer version of RN.

<aside> 💘 SPONSOR Keep the package alive and updated with the latest changes and security fixes

</aside>