@capacitor-community/sqlite
CAPACITOR 4
Capacitor community plugin for Native and Electron SQLite Databases. In Native databases could be encrypted with SQLCipher
| Maintainer | GitHub | Social | 
|---|---|---|
| Quéau Jean Pierre | jepiqueau | 
To install:
npm install @capacitor-community/sqlite
npx cap sync
The plugin follows the guidelines from the Capacitor Team,
Meaning that it will not work in IE11 without additional JavaScript transformations, e.g. with Babel. You'll need the usual capacitor/android/react npm script to build and copy the assets folder.
- Copy manually the file sql-wasm.wasmfromnode_modules/sql.js/dist/sql-wasm.wasmto thesrc/assetsfolder of YOUR_APP
- Copy manually the file sql-wasm.wasmfromnode_modules/sql.js/dist/sql-wasm.wasmto thepublic/assetsfolder of YOUR_APP
In case you get the following error when building your app in Android Studio:
x files found with path 'build-data.properties'.
You can you add the following code to app/build.gradle:
    packagingOptions {
        exclude 'build-data.properties'
    }
See #301 and SO question for more information.
- On Electron, go to the Electron folder of YOUR_APPLICATION
cd electron
npm install --save sqlite3
npm install --save jszip
npm install --save-dev @types/sqlite3- on iOS, no further steps needed.
| Name | Android | iOS | Electron | Web | 
|---|---|---|---|---|
| createConnection | ✅ | ✅ | ✅ | ✅ | 
| closeConnection | ✅ | ✅ | ✅ | ✅ | 
| isConnection | ✅ | ✅ | ✅ | ✅ | 
| open (non-encrypted DB) | ✅ | ✅ | ✅ | ✅ | 
| open (encrypted DB) | ✅ | ✅ | ❌ | ❌ | 
| close | ✅ | ✅ | ✅ | ✅ | 
| getUrl | ✅ | ✅ | ❌ | ❌ | 
| getVersion | ✅ | ✅ | ✅ | ✅ | 
| execute | ✅ | ✅ | ✅ | ✅ | 
| executeSet | ✅ | ✅ | ✅ | ✅ | 
| run | ✅ | ✅ | ✅ | ✅ | 
| query | ✅ | ✅ | ✅ | ✅ | 
| deleteDatabase | ✅ | ✅ | ✅ | ✅ | 
| importFromJson | ✅ | ✅ | ✅ | ✅ | 
| exportToJson | ✅ | ✅ | ✅ | ✅ | 
| deleteExportedRows | ✅ | ✅ | ✅ | ✅ | 
| createSyncTable | ✅ | ✅ | ✅ | ✅ | 
| setSyncDate | ✅ | ✅ | ✅ | ✅ | 
| getSyncDate | ✅ | ✅ | ✅ | ✅ | 
| isJsonValid | ✅ | ✅ | ✅ | ✅ | 
| isDBExists | ✅ | ✅ | ✅ | ✅ | 
| addUpgradeStatement | ✅ | ✅ | ✅ | ✅ | 
| copyFromAssets | ✅ | ✅ | ✅ | ✅ | 
| isDBOpen | ✅ | ✅ | ✅ | ✅ | 
| isDatabase | ✅ | ✅ | ✅ | ✅ | 
| isTableExists | ✅ | ✅ | ✅ | ✅ | 
| getTableList | ✅ | ✅ | ✅ | ✅ | 
| getDatabaseList | ✅ | ✅ | ✅ | ✅ | 
| getMigratableDbList | ✅ | ✅ | ❌ | ❌ | 
| addSQLiteSuffix | ✅ | ✅ | ❌ | ❌ | 
| deleteOldDatabases | ✅ | ✅ | ❌ | ❌ | 
| moveDatabasesAndAddSuffix | ✅ | ✅ | ❌ | ❌ | 
| checkConnectionsConsistency | ✅ | ✅ | ✅ | ✅ | 
| isSecretStored | ✅ | ✅ | ❌ | ❌ | 
| setEncryptionSecret | ✅ | ✅ | ❌ | ❌ | 
| changeEncryptionSecret | ✅ | ✅ | ❌ | ❌ | 
| clearEncryptionSecret | ✅ | ✅ | ❌ | ❌ | 
| initWebStore | ❌ | ❌ | ❌ | ✅ | 
| saveToStore | ❌ | ❌ | ❌ | ✅ | 
| getNCDatabasePath | ✅ | ✅ | ❌ | ❌ | 
| createNCConnection | ✅ | ✅ | ❌ | ❌ | 
| closeNCConnection | ✅ | ✅ | ❌ | ❌ | 
| isNCDatabase | ✅ | ✅ | ❌ | ❌ | 
| transaction | ✅ | ✅ | ✅ | ✅ | 
The iOS and Android codes are using SQLCipher allowing for database encryption.
The iOS codes is using ZIPFoundation for unzipping assets files
The Electron code is using sqlite3.
The Web code is using the Stencil component jeep-sqlite based on sql.js, localforage. and jszip
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!





















