Skip to content
SQLite for Nativescript
TypeScript Shell Objective-C JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Initial Commit Dec 5, 2018
.vscode config Jan 8, 2019
demo fixed tests resolves #5 May 7, 2019
publish Added npm i to test scripts Dec 7, 2018
src Bump version May 8, 2019
.gitignore Update .gitignore Jan 9, 2019
.travis.yml FIX: travis May 7, 2019
LICENSE Initial Commit Dec 5, 2018
README.md Bump version + Updated readme Jan 11, 2019
tslint.json Initial Commit Dec 5, 2018

README.md

Nativescript: MtMobile Sqlite

Build Status npm version

Installation

tns plugin add nativescript-mtmobile-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 "nativescript-mtmobile-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]
        )
    );
});
You can’t perform that action at this time.