@ionic-native/sqlite

  • Version 5.33.1
  • Published
  • 39.1 kB
  • 1 dependency
  • MIT license

Install

npm i @ionic-native/sqlite
yarn add @ionic-native/sqlite
pnpm add @ionic-native/sqlite

Overview

Ionic Native - Native plugins for ionic apps

Index

Variables

variable SQLite

const SQLite: SQLiteOriginal;

    Classes

    class SQLiteObject

    class SQLiteObject {}

    constructor

    constructor(_objectInstance: any);

      property databaseFeatures

      databaseFeatures: { isSQLitePluginDatabase: boolean };

        property openDBs

        openDBs: any;

          method abortallPendingTransactions

          abortallPendingTransactions: () => void;

            method addTransaction

            addTransaction: (transaction: (tx: SQLiteTransaction) => void) => void;

              method close

              close: () => Promise<any>;
              • Returns

                {Promise}

              method executeSql

              executeSql: (statement: string, params?: any[]) => Promise<any>;
              • Execute SQL on the opened database. Note, you must call create first, and ensure it resolved and successfully opened the database.

              method open

              open: () => Promise<any>;
              • Returns

                {Promise}

              method readTransaction

              readTransaction: (fn: (tx: SQLiteTransaction) => void) => Promise<any>;
              • Parameter fn

                Returns

                {Promise}

              method sqlBatch

              sqlBatch: (sqlStatements: (string | string[] | any)[]) => Promise<any>;
              • Parameter sqlStatements

                Returns

                {Promise}

              method startNextTransaction

              startNextTransaction: () => void;

                method transaction

                transaction: (fn: (tx: DbTransaction) => void) => Promise<any>;
                • Parameter fn

                  Returns

                  {Promise}

                class SQLiteOriginal

                class SQLiteOriginal extends IonicNativePlugin {}
                • SQLite

                  Access SQLite databases on the device.

                  import { SQLite, SQLiteObject } from '@ionic-native/sqlite/ngx';
                  constructor(private sqlite: SQLite) { }
                  ...
                  this.sqlite.create({
                  name: 'data.db',
                  location: 'default'
                  })
                  .then((db: SQLiteObject) => {
                  db.executeSql('create table danceMoves(name VARCHAR(32))', [])
                  .then(() => console.log('Executed SQL'))
                  .catch(e => console.log(e));
                  })
                  .catch(e => console.log(e));

                  SQLiteObject SQLiteDatabaseConfig SQLiteTransaction

                method create

                create: (config: SQLiteDatabaseConfig) => Promise<SQLiteObject>;
                • Open or create a SQLite database file.

                  See the plugin docs for an explanation of all options: https://github.com/litehelpers/Cordova-sqlite-storage#opening-a-database

                  Parameter config

                  database configuration Promise

                method deleteDatabase

                deleteDatabase: (config: SQLiteDatabaseConfig) => Promise<any>;
                • Deletes a database

                  Parameter config

                  database configuration

                  Returns

                  {Promise}

                method echoTest

                echoTest: () => Promise<any>;
                • Verify that both the Javascript and native part of this plugin are installed in your application

                  Returns

                  {Promise}

                method selfTest

                selfTest: () => Promise<any>;
                • Automatically verify basic database access operations including opening a database

                  Returns

                  {Promise}

                Interfaces

                interface DbTransaction

                interface DbTransaction {}

                property executeSql

                executeSql: (
                sql: any,
                values?: any[],
                success?: Function,
                error?: Function
                ) => void;

                  interface SQLiteDatabaseConfig

                  interface SQLiteDatabaseConfig {}

                    property androidDatabaseLocation

                    androidDatabaseLocation?: string;
                    • support arbitrary database location on android with https://github.com/litehelpers/cordova-sqlite-evcore-extbuild-free

                    property createFromLocation

                    createFromLocation?: number;
                    • support opening pre-filled databases with https://github.com/litehelpers/cordova-sqlite-ext

                    property iosDatabaseLocation

                    iosDatabaseLocation?: string;
                    • iOS Database Location. Example: 'Library'

                    property key

                    key?: string;
                    • support encrypted databases with https://github.com/litehelpers/Cordova-sqlcipher-adapter

                    property location

                    location?: string;
                    • Location of the database. Example: 'default'

                    property name

                    name: string;
                    • Name of the database. Example: 'my.db'

                    interface SQLiteTransaction

                    interface SQLiteTransaction extends DbTransaction {}

                    property abort

                    abort: (txFailure: any) => void;

                      property abortFromQ

                      abortFromQ: (sqlerror: any) => void;

                        property addStatement

                        addStatement: DbTransaction['executeSql'];

                          property finish

                          finish: () => void;

                            property handleStatementFailure

                            handleStatementFailure: (handler: Function, response: any) => void;

                              property handleStatementSuccess

                              handleStatementSuccess: (handler: Function, response: any) => void;

                                property run

                                run: () => void;

                                  property start

                                  start: () => void;

                                    Package Files (1)

                                    Dependencies (1)

                                    Dev Dependencies (0)

                                    No dev dependencies.

                                    Peer Dependencies (2)

                                    Badge

                                    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@ionic-native/sqlite.

                                    • Markdown
                                      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@ionic-native/sqlite)
                                    • HTML
                                      <a href="https://www.jsdocs.io/package/@ionic-native/sqlite"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>