Offline Storage API

Index#

Classes#

Interfaces#


Classes#

SQLite#

SQLite:

name: SQLite

description: Access SQLite databases on the device.

usage: ```typescript import { SQLite, SQLiteObject } from '@ionic-enterprise/offline-storage/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));

*__classes__*: SQLiteObject
*__interfaces__*: SQLiteDatabaseConfig SQLiteTransaction
<a id="sqlite.create"></a>
### create
▸ **create**(config: *[SQLiteDatabaseConfig](#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](https://github.com/litehelpers/Cordova-sqlite-storage#opening-a-database)
**Parameters:**
| Name | Type | Description |
| ------ | ------ | ------ |
| config | [SQLiteDatabaseConfig](#sqlitedatabaseconfig) | database configuration |
**Returns:** `Promise`<`SQLiteObject`>
Promise<SQLiteObject>
___
<a id="sqlite.deletedatabase"></a>
### deleteDatabase
▸ **deleteDatabase**(config: *[SQLiteDatabaseConfig](#sqlitedatabaseconfig)*): `Promise`<`any`>
Deletes a database
**Parameters:**
| Name | Type | Description |
| ------ | ------ | ------ |
| config | [SQLiteDatabaseConfig](#sqlitedatabaseconfig) | database configuration |
**Returns:** `Promise`<`any`>
___
<a id="sqlite.echotest"></a>
### echoTest
▸ **echoTest**(): `Promise`<`any`>
Verify that both the Javascript and native part of this plugin are installed in your application
**Returns:** `Promise`<`any`>
___
<a id="sqlite.selftest"></a>
### selfTest
▸ **selfTest**(): `Promise`<`any`>
Automatically verify basic database access operations including opening a database
**Returns:** `Promise`<`any`>
___
___
## Interfaces
<a id="sqlitedatabaseconfig"></a>
### SQLiteDatabaseConfig
**SQLiteDatabaseConfig**:
<a id="sqlitedatabaseconfig.createfromlocation"></a>
### `<Optional>` createFromLocation
**● createFromLocation**: *`number`*
support opening pre-filled databases with [https://github.com/litehelpers/cordova-sqlite-ext](https://github.com/litehelpers/cordova-sqlite-ext)
___
<a id="sqlitedatabaseconfig.iosdatabaselocation"></a>
### `<Optional>` iosDatabaseLocation
**● iosDatabaseLocation**: *`string`*
iOS Database Location. Example: 'Library'
___
<a id="sqlitedatabaseconfig.key"></a>
### `<Optional>` key
**● key**: *`string`*
support encrypted databases with [https://github.com/litehelpers/Cordova-sqlcipher-adapter](https://github.com/litehelpers/Cordova-sqlcipher-adapter)
___
<a id="sqlitedatabaseconfig.location"></a>
### `<Optional>` location
**● location**: *`string`*
Location of the database. Example: 'default'
___
<a id="sqlitedatabaseconfig.name"></a>
### name
**● name**: *`string`*
Name of the database. Example: 'my.db'
___