Skip to content

Latest commit

 

History

History
778 lines (475 loc) · 20.1 KB

APIConnection.md

File metadata and controls

778 lines (475 loc) · 20.1 KB


API CONNECTION DOCUMENTATION

@capacitor-community/sqlite

SQLite Connection Wrapper

Methods Index

API Connection Wrapper

SQLiteConnection Interface

initWebStore()

initWebStore() => Promise<void>

Init the web store

Since: 3.2.3-1


saveToStore(...)

saveToStore(database: string) => Promise<void>

Save the datbase to the web store

Param Type
database string

Since: 3.2.3-1


getFromLocalDiskToStore(...)

getFromLocalDiskToStore(overwrite: boolean) => Promise<void>

Get database from local disk and save it to store

Param Type Description
overwrite boolean : boolean

Since: 4.6.3


saveToLocalDisk(...)

saveToLocalDisk(database: string) => Promise<void>

Save database to local disk

Param Type Description
database string : string

Since: 4.6.3


echo(...)

echo(value: string) => Promise<capEchoResult>

Echo a value

Param Type
value string

Returns: Promise<capEchoResult>

Since: 2.9.0 refactor


isSecretStored()

isSecretStored() => Promise<capSQLiteResult>

Check if a secret is stored

Returns: Promise<capSQLiteResult>

Since: 3.0.0-beta.13


setEncryptionSecret(...)

setEncryptionSecret(passphrase: string) => Promise<void>

Set a passphrase in a secure store

Param Type
passphrase string

Since: 3.0.0-beta.13


changeEncryptionSecret(...)

changeEncryptionSecret(passphrase: string, oldpassphrase: string) => Promise<void>

Change the passphrase in a secure store

Param Type
passphrase string
oldpassphrase string

Since: 3.0.0-beta.13


clearEncryptionSecret()

clearEncryptionSecret() => Promise<void>

Clear the passphrase in a secure store

Since: 3.5.1


checkEncryptionSecret(...)

checkEncryptionSecret(passphrase: string) => Promise<capSQLiteResult>

Check the passphrase stored in a secure store

Param Type
passphrase string

Returns: Promise<capSQLiteResult>

Since: 4.6.1


addUpgradeStatement(...)

addUpgradeStatement(database: string, upgrade: capSQLiteVersionUpgrade[]) => Promise<void>

Add the upgrade Statement for database version upgrading

Param Type
database string
upgrade capSQLiteVersionUpgrade[]

Since: 5.6.4


createConnection(...)

createConnection(database: string, encrypted: boolean, mode: string, version: number, readonly: boolean) => Promise<SQLiteDBConnection>

Create a connection to a database

Param Type
database string
encrypted boolean
mode string
version number
readonly boolean

Returns: Promise<SQLiteDBConnection>

Since: 2.9.0 refactor


isConnection(...)

isConnection(database: string, readonly: boolean) => Promise<capSQLiteResult>

Check if a connection exists

Param Type
database string
readonly boolean

Returns: Promise<capSQLiteResult>

Since: 3.0.0-beta.5


retrieveConnection(...)

retrieveConnection(database: string, readonly: boolean) => Promise<SQLiteDBConnection>

Retrieve an existing database connection

Param Type
database string
readonly boolean

Returns: Promise<SQLiteDBConnection>

Since: 2.9.0 refactor


retrieveAllConnections()

retrieveAllConnections() => Promise<Map<string, SQLiteDBConnection>>

Retrieve all database connections

Returns: Promise<Map<string, SQLiteDBConnection>>

Since: 2.9.0 refactor


closeConnection(...)

closeConnection(database: string, readonly: boolean) => Promise<void>

Close a database connection

Param Type
database string
readonly boolean

Since: 2.9.0 refactor


closeAllConnections()

closeAllConnections() => Promise<void>

Close all database connections

Since: 2.9.0 refactor


checkConnectionsConsistency()

checkConnectionsConsistency() => Promise<capSQLiteResult>

Check the consistency between Js Connections and Native Connections if inconsistency all connections are removed

Returns: Promise<capSQLiteResult>

Since: 3.0.0-beta.10


getNCDatabasePath(...)

getNCDatabasePath(path: string, database: string) => Promise<capNCDatabasePathResult>

get a non-conformed database path

Param Type
path string
database string

Returns: Promise<capNCDatabasePathResult>

Since: 3.3.3-1


createNCConnection(...)

createNCConnection(databasePath: string, version: number) => Promise<SQLiteDBConnection>

Create a non-conformed database connection

Param Type
databasePath string
version number

Returns: Promise<SQLiteDBConnection>

Since: 3.3.3-1


closeNCConnection(...)

closeNCConnection(databasePath: string) => Promise<void>

Close a non-conformed database connection

Param Type
databasePath string

Since: 3.3.3-1


isNCConnection(...)

isNCConnection(databasePath: string) => Promise<capSQLiteResult>

Check if a non-conformed databaseconnection exists

Param Type
databasePath string

Returns: Promise<capSQLiteResult>

Since: 3.3.3-1


retrieveNCConnection(...)

retrieveNCConnection(databasePath: string) => Promise<SQLiteDBConnection>

Retrieve an existing non-conformed database connection

Param Type
databasePath string

Returns: Promise<SQLiteDBConnection>

Since: 3.3.3-1


importFromJson(...)

importFromJson(jsonstring: string) => Promise<capSQLiteChanges>

Import a database From a JSON

Param Type Description
jsonstring string string

Returns: Promise<capSQLiteChanges>

Since: 2.9.0 refactor


isJsonValid(...)

isJsonValid(jsonstring: string) => Promise<capSQLiteResult>

Check the validity of a JSON Object

Param Type Description
jsonstring string string

Returns: Promise<capSQLiteResult>

Since: 2.9.0 refactor


copyFromAssets(...)

copyFromAssets(overwrite?: boolean | undefined) => Promise<void>

Copy databases from public/assets/databases folder to application databases folder

Param Type Description
overwrite boolean since 3.2.5-2

Since: 2.9.0 refactor


getFromHTTPRequest(...)

getFromHTTPRequest(url?: string | undefined, overwrite?: boolean | undefined) => Promise<void>
Param Type
url string
overwrite boolean

Since: 4.1.1


isDatabaseEncrypted(...)

isDatabaseEncrypted(database: string) => Promise<capSQLiteResult>

Check if a SQLite database is encrypted

Param Type
database string

Returns: Promise<capSQLiteResult>

Since: 4.6.2-2


isInConfigEncryption()

isInConfigEncryption() => Promise<capSQLiteResult>

Check encryption value in capacitor.config

Returns: Promise<capSQLiteResult>

Since: 4.6.2-2


isInConfigBiometricAuth()

isInConfigBiometricAuth() => Promise<capSQLiteResult>

Check encryption value in capacitor.config

Returns: Promise<capSQLiteResult>

Since: 4.6.2-2


isDatabase(...)

isDatabase(database: string) => Promise<capSQLiteResult>

Check if a database exists

Param Type
database string

Returns: Promise<capSQLiteResult>

Since: 3.0.0-beta.5


isNCDatabase(...)

isNCDatabase(databasePath: string) => Promise<capSQLiteResult>

Check if a non conformed database exists

Param Type
databasePath string

Returns: Promise<capSQLiteResult>

Since: 3.3.3-1


getDatabaseList()

getDatabaseList() => Promise<capSQLiteValues>

Get the database list

Returns: Promise<capSQLiteValues>

Since: 3.0.0-beta.5


getMigratableDbList(...)

getMigratableDbList(folderPath?: string | undefined) => Promise<capSQLiteValues>

Get the Migratable database list

Param Type Description
folderPath string : string // only iOS & Android since 3.2.4-2

Returns: Promise<capSQLiteValues>

Since: 3.0.0-beta.5


addSQLiteSuffix(...)

addSQLiteSuffix(folderPath?: string | undefined, dbNameList?: string[] | undefined) => Promise<void>

Add SQLIte Suffix to existing databases

Param Type Description
folderPath string
dbNameList string[] since 3.2.4-1

Since: 3.0.0-beta.5


deleteOldDatabases(...)

deleteOldDatabases(folderPath?: string | undefined, dbNameList?: string[] | undefined) => Promise<void>

Delete Old Cordova databases

Param Type Description
folderPath string
dbNameList string[] since 3.2.4-1

Since: 3.0.0-beta.5


moveDatabasesAndAddSuffix(...)

moveDatabasesAndAddSuffix(folderPath?: string | undefined, dbNameList?: string[] | undefined) => Promise<void>

Moves databases to the location the plugin can read them, and adds sqlite suffix This resembles calling addSQLiteSuffix and deleteOldDatabases, but it is more performant as it doesn't copy but moves the files

Param Type Description
folderPath string the origin from where to move the databases
dbNameList string[] the names of the databases to move, check out the getMigratableDbList to get a list, an empty list will result in copying all the databases with '.db' extension.

Interfaces

capEchoResult

Prop Type Description
value string String returned

capSQLiteResult

Prop Type Description
result boolean result set to true when successful else false

capSQLiteVersionUpgrade

Prop Type
toVersion number
statements string[]

Map

Prop Type
size number
Method Signature
clear () => void
delete (key: K) => boolean
forEach (callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any) => void
get (key: K) => V | undefined
has (key: K) => boolean
set (key: K, value: V) => this

capNCDatabasePathResult

Prop Type Description
path string String returned

capSQLiteChanges

Prop Type Description
changes Changes a returned Changes

Changes

Prop Type Description
changes number the number of changes from an execute or run command
lastId number the lastId created from a run command
values any[] values when RETURNING

capSQLiteValues

Prop Type Description
values any[] the data values list as an Array iOS the first row is the returned ios_columns name list