JSPM

@nativescript-community/sqlite

3.5.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 534
  • Score
    100M100P100Q102097F
  • License Apache-2.0

SQLite for Nativescript

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@nativescript-community/sqlite) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @nativescript-community/sqlite

    Downloads per month NPM Version

    SQLite for Nativescript


    Table of Contents

    Installation

    Run the following command from the root of your project:

    ns plugin add @nativescript-community/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-community/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]
            )
        );
    });

    Platforms sqlite versions