@geomatico/capacitor-community-sqlite
v4.2.2-fix-ncconnection
Published
Community plugin for native & electron SQLite databases
Downloads
7
Readme
Maintainers
| Maintainer | GitHub | Social | | ----------------- | ----------------------------------------- | ------ | | Quéau Jean Pierre | jepiqueau | |
To install:
npm install --save @capacitor-community/sqlite
npx cap sync
yarn install --save @capacitor-community/sqlite
npx cap sync
pnpm install --save @capacitor-community/sqlite
pnpm install --save @jeep-sqlite
pnpm install --save sql.js
npx cap sync
More Reading:
- Releases
- Changelog
- Issues
- Capacitor documentation
- Datatypes In SQLite Version 3
- IncrementalUpgradeDatabaseVersion
Web Quirks
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.
For Angular framework
- Copy manually the file
sql-wasm.wasm
fromnode_modules/sql.js/dist/sql-wasm.wasm
to thesrc/assets
folder of YOUR_APP
For Vue & React frameworks
- Copy manually the file
sql-wasm.wasm
fromnode_modules/sql.js/dist/sql-wasm.wasm
to thepublic/assets
folder of YOUR_APP
Android Quirks
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.
Electron Quirks
- On Electron, go to the Electron folder of YOUR_APPLICATION
cd electron
npm install --save sqlite3
npm install --save jszip
npm install --save node-fetch
npm install --save-dev @types/sqlite3
- Important:
node-fetch
version must be<=2.6.7
; otherwise you'll get an error running the app.
IOS Quirks
- on iOS, no further steps needed.
Supported Methods by Platform
| Name | Android | iOS | Electron | Web | | :-------------------------- | :------ | :-- | :------- | :-- | | createConnection (ReadWrite)| ✅ | ✅ | ✅ | ✅ | | createConnection (ReadOnly) | ✅ | ✅ | ✅ | ❌ | since 4.1.0-7 | closeConnection (ReadWrite) | ✅ | ✅ | ✅ | ✅ | | closeConnection (ReadOnly) | ✅ | ✅ | ✅ | ❌ | since 4.1.0-7 | isConnection (ReadWrite) | ✅ | ✅ | ✅ | ✅ | | isConnection (ReadOnly) | ✅ | ✅ | ✅ | ❌ | since 4.1.0-7 | open (non-encrypted DB) | ✅ | ✅ | ✅ | ✅ | | open (encrypted DB) | ✅ | ✅ | ❌ | ❌ | | close | ✅ | ✅ | ✅ | ✅ | | getUrl | ✅ | ✅ | ❌ | ❌ | | getVersion | ✅ | ✅ | ✅ | ✅ | | execute | ✅ | ✅ | ✅ | ✅ | | executeSet | ✅ | ✅ | ✅ | ✅ | | run | ✅ | ✅ | ✅ | ✅ | | query | ✅ | ✅ | ✅ | ✅ | | deleteDatabase | ✅ | ✅ | ✅ | ✅ | | importFromJson | ✅ | ✅ | ✅ | ✅ | | exportToJson | ✅ | ✅ | ✅ | ✅ | | deleteExportedRows | ✅ | ✅ | ✅ | ✅ | | createSyncTable | ✅ | ✅ | ✅ | ✅ | | setSyncDate | ✅ | ✅ | ✅ | ✅ | | getSyncDate | ✅ | ✅ | ✅ | ✅ | | isJsonValid | ✅ | ✅ | ✅ | ✅ | | isDBExists | ✅ | ✅ | ✅ | ✅ | | addUpgradeStatement | ✅ | ✅ | ✅ | ✅ | Modified 4.1.0-6 | copyFromAssets | ✅ | ✅ | ✅ | ✅ | | isDBOpen | ✅ | ✅ | ✅ | ✅ | | isDatabase | ✅ | ✅ | ✅ | ✅ | | isTableExists | ✅ | ✅ | ✅ | ✅ | | getTableList | ✅ | ✅ | ✅ | ✅ | | getDatabaseList | ✅ | ✅ | ✅ | ✅ | | getMigratableDbList | ✅ | ✅ | ❌ | ❌ | | addSQLiteSuffix | ✅ | ✅ | ❌ | ❌ | | deleteOldDatabases | ✅ | ✅ | ❌ | ❌ | | moveDatabasesAndAddSuffix | ✅ | ✅ | ❌ | ❌ | | checkConnectionsConsistency | ✅ | ✅ | ✅ | ✅ | | isSecretStored | ✅ | ✅ | ❌ | ❌ | | setEncryptionSecret | ✅ | ✅ | ❌ | ❌ | | changeEncryptionSecret | ✅ | ✅ | ❌ | ❌ | | clearEncryptionSecret | ✅ | ✅ | ❌ | ❌ | | initWebStore | ❌ | ❌ | ❌ | ✅ | | saveToStore | ❌ | ❌ | ❌ | ✅ | | getNCDatabasePath | ✅ | ✅ | ❌ | ❌ | | createNCConnection | ✅ | ✅ | ❌ | ❌ | | closeNCConnection | ✅ | ✅ | ❌ | ❌ | | isNCDatabase | ✅ | ✅ | ❌ | ❌ | | transaction | ✅ | ✅ | ✅ | ✅ | | getFromHTTPRequest | ✅ | ✅ | ✅ | ✅ | since 4.2.0
Documentation & APIs
Applications demonstrating the use of the plugin and related documentation
Ionic/Angular
Ionic/React
React+Vite
Ionic/Vue
Vue
Vue+Vite
SolidJS+Vite
Vue TypeORM app
Dependencies
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
and node-fetch
from 4.2.0.
The Web code is using the Stencil component jeep-sqlite
based on sql.js
, localforage
. and jszip
Contributors ✨
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!