@capacitor-community/sqlite
CAPACITOR 3
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 |
๐จ Since release 3.2.0-5 ->> ๐จ
The Web plugin is now implemented based on the stencil companion [email protected]
which is using [email protected]
for database queries and [email protected]
for database persistency.
๐จ Since release 3.2.0-3 ->> ๐จ
The Electron plugin is now based on @capacitor-community/[email protected]
thanks to the hard and heavy work from Mike Summerfeldt IT-MikeS
๐ ๐
๐จ Since release 3.2.0-2 ->> ๐จ ๐จ !!! for Electron developper, the Electron plugin is back !!! ๐จ
Based on sqlite3
, so without encryption
The two listeners sqliteImportProgressEvent
and sqliteExportProgressEvent
are not available.
๐จ Since release 3.1.2 ->> ๐จ
Thanks to Nirajhinge and Chris, an example of using the TypeORM driver in a Ionic/Vue app has been developed see https://github.com/jepiqueau/vue-typeorm-app
.
๐จ Since release 3.0.0-rc.2 ->> ๐จ
Thanks to Chris, a driver to TypeORM is now available
๐จ Since release 3.0.0-beta.13 ->> ๐จ
-
GlobalSQLite
secret
andnewsecret
are deprecated -
The user can now set its own secure secret (passphrase)
-
use
setEncryptionSecret
ONCE to migrate encrypted databases fromsecret
tosecure stored secret
-
use
changeEncryptionSecret
to change yoursecure stored secret
-
-
iOS used
KeyChain service
to store thesecret
-
Android used
Encrypted SharedPreferences
to store thesecret
, the minimun sdk should be set to 23 (limitation from Google)
๐จ Since release 3.0.0-beta.13 ->> ๐จ
๐จ Since release 3.0.0-beta.11 ->> ๐จ
-
Checking of types has been removed in all methods of the plugin both iOS & Android. This has been achieved to allow the use of others RDBMS types. The type checking is now under the responsability of the developers.
-
NULL values are now returned as null
-
values for the
query
method is now an Array of any. -
option to disable
transaction
for theexecute
,executeSet
,run
.
๐จ Since release 3.0.0-beta.11 <<- ๐จ
The test has been achieved on:
The 2.9.x
is now ๐ NOT MAINTAINED ANYMORE ๐.
The refactor offers now (since 2.9.0-beta.1
) all the features that the previous was offering. It has been a quite heavy process, hoping that the developpers will take benefit from it.
The main reasons for it:
- multiple database connections
- db connector allowing for easy commands
db.open(), db.close, ...
- improve the response time of the encrypted database by removing the internal open and close database for each sqlite query
- moving to the latest
androidx.sqlite.db.xxx
- offering encryption for Electron platform by using
@journeyapps/sqlcipher
on MacOs, !!! NOT ON WINDOWS !!! - cleaning and aligning the code between platforms
- allowing developers to develop
typeorm
orspatialite
drivers.
This was discussed lengthly in issue#1 and issue#52
Refactor available for Android
, iOS
and Electron
platforms.
The test has been achieved on:
Other frameworks will be tested later
- Stencil
The 2.4.x
is now ๐ NOT MAINTAINED ANYMORE ๐.
To install it
npm i --save @capacitor-community/sqlite@initial
The test has been achieved on:
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.
npm install @capacitor-community/sqlite
npm run build
npx cap add android
npx cap add ios
npx cap add @capacitor-community/electron
and do when you update
npx cap sync
npx cap sync @capacitor-community/electron
- copy manually the file
sql-wasm.wasm
fromnodes_modules/sql.js/dist/sql-wasm.wasm
to thesrc/assets
folder of YOUR_APP
- copy manually the file
sql-wasm.wasm
fromnodes_modules/sql.js/dist/sql-wasm.wasm
to thepublic/assets
folder of YOUR_APP
- on iOS, no further steps needed.
- On Android, no further steps needed.
- On Electron, go to the Electron folder of YOUR_APPLICATION
cd electron
npm install --save sqlite3
npm install --save-dev @types/sqlite3
npm run build
npm run build
npx cap copy
npx cap copy web
npx cap copy @capacitor-community/electron
- Angular
ionic serve
- Vue
npm run serve
- React
npm run start
npx cap open ios
npx cap open android
npx cap open @capacitor-community/electron
No configuration required for this plugin
Name | Android | iOS | Electron | Web |
---|---|---|---|---|
createConnection | โ | โ | โ | โ |
closeConnection | โ | โ | โ | โ |
isConnection | โ | โ | โ | โ |
open (non-encrypted DB) | โ | โ | โ | โ |
open (encrypted DB) | โ | โ | โ | โ |
close | โ | โ | โ | โ |
getVersion | โ | โ | โ | โ |
execute | โ | โ | โ | โ |
executeSet | โ | โ | โ | โ |
run | โ | โ | โ | โ |
query | โ | โ | โ | โ |
deleteDatabase | โ | โ | โ | โ |
importFromJson | โ | โ | โ | โ |
exportToJson | โ | โ | โ | โ |
createSyncTable | โ | โ | โ | โ |
setSyncDate | โ | โ | โ | โ |
getSyncDate | โ | โ | โ | โ |
isJsonValid | โ | โ | โ | โ |
isDBExists | โ | โ | โ | โ |
addUpgradeStatement | โ | โ | โ | โ |
copyFromAssets | โ | โ | โ | โ |
isDBOpen | โ | โ | โ | โ |
isDatabase | โ | โ | โ | โ |
isTableExists | โ | โ | โ | โ |
getDatabaseList | โ | โ | โ | โ |
addSQLiteSuffix | โ | โ | โ | โ |
deleteOldDatabases | โ | โ | โ | โ |
checkConnectionsConsistency | โ | โ | โ | โ |
isSecretStored | โ | โ | โ | โ |
setEncryptionSecret | โ | โ | โ | โ |
changeEncryptionSecret | โ | โ | โ | โ |
-Datatypes In SQLite Version 3
The IOS and Android codes are using SQLCipher
allowing for database encryption.
The Electron code is using sqlite3
.
The Web code is using the Stencil component jeep-sqlite
based on sql.js
and localforage
.
Thanks goes to these wonderful people (emoji key):
Jean Pierre Quรฉau ๐ป |
Paul Antoine ๐ป |
Karyfars ๐ป |
Chriswep ๐ |
Nirajhinge ๐ป |
Dirk Gausmann ๐ป |
Mike Summerfeldt ๐ป |
Peakcool ๐ป |
This project follows the all-contributors specification. Contributions of any kind welcome!