npm i --save @herefishyfish/requery-sqlite
- Version: 3.4.2
- GitHub: https://github.com/herefishyfish/rxdb-nativescript
- NPM: https://www.npmjs.com/package/%40herefishyfish%2Frequery-sqlite
- Downloads:
- Last Day: 0
- Last Week: 0
- Last Month: 2
Nativescript: Requery Sqlite
Fork of the @nativescript-community/sqlite package to use the requery SQLite implementation which supports modern android SQLite features.
Installation
npm i @herefishyfish/requery-sqlite
Usage
You should take care of wrapping sqlite calls to your preferred async option (promises, observables, async/await). And catch any exceptions thrown.
import { openOrCreate, deleteDatabase } from "@herefishyfish/requery-sqlite";
const sqlite = openOrCreate("path/to/db");
sqlite.execute("CREATE TABLE names (id INT, name TEXT)");
sqlite.transaction(cancelTransaction => {
// Calling cancelTransaction will rollback all changes made to db
names.forEach((name, id) =>
sqlite.execute(
"INSERT INTO names (id, name) VALUES (?, ?)",
[id, name]
)
);
});