@capacitor-community/sqlite
REFACTOR π
Capacitor community plugin for Native and Electron SQLite Databases. In Native databases could be encrypted with SQLCipher
The refactor release has been upgraded to @capacitor/core@3.0.0-beta.1.
!!! ONLY iOS and Android plugins have been upgraded !!!
To install it
npm i --save @capacitor-community/sqlite@nextThis release provide a better Error handling through try...catch.
The test has been achieved on:
A refactoring has been started more than a month ago to reach the following objectives:
- 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 MacOs platform by using
@journeyapps/sqlcipher. !!! NOT WORKING for Electron Windows platform !!! - cleaning and aligning the code between platforms
- allowing developers to develop easily
typeormorspatialitedrivers.
This was discussed lengthly in issue#1 and issue#52
It is now available in a stable release 2.9.x for all platforms (Android, iOS & Electron).
Developers are encouraged to start converting their applications. The interface to the plugin is now achieved through the use of connection wrappers
As you will see it is a Majorchange and the release is now the basis of 3.0.0-beta based on capacitor@3.0.0.
The test has been achieved on:
Other frameworks will be tested later
- Stencil
When you will find issues, please report them with the REFACTOR word at the start of the issue title.
To install it
npm i --save @capacitor-community/sqlite@latestHope you will enjoy it.
The 2.4.x is now NOT MAINTAINED ANYMORE.
To install it
npm i --save @capacitor-community/sqlite@initial| Maintainer | GitHub | Social |
|---|---|---|
| QuΓ©au Jean Pierre | jepiqueau |
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@latest
npm run build
npx cap add android
npx cap add ios
npx cap add @capacitor-community/electron- on iOS no further steps needed.
- On Android, register the plugin in your main activity:
import com.getcapacitor.community.database.sqlite.CapacitorSQLite;
public class MainActivity extends BridgeActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Initializes the Bridge
this.init(
savedInstanceState,
new ArrayList<Class<? extends Plugin>>() {
{
// Additional plugins you've installed go here
// Ex: add(TotallyAwesomePlugin.class);
add(CapacitorSQLite.class);
}
}
);
}
}- On Electron, go to the Electron folder of YOUR_APPLICATION
npm install --save @journeyapps/sqlcipher
npm run build
npx cap copy
npx cap copy @capacitor-community/electron
npx cap open ios
npx cap open android
npx cap open @capacitor-community/electron
When you will find issues, please report them with the REFACTOR word at the start of the issue title.
No configuration required for this plugin
| Name | Android | iOS | Electron Mac | Electron Windows | Web |
|---|---|---|---|---|---|
| createConnection | β | β | β | β | β |
| closeConnection | β | β | β | β | β |
| open (non-encrypted DB) | β | β | β | β | β |
| open (encrypted DB) | β | β | β | β | β |
| close | β | β | β | β | β |
| execute | β | β | β | β | β |
| executeSet | β | β | β | β | β |
| run | β | β | β | β | β |
| query | β | β | β | β | β |
| deleteDatabase | β | β | β | β | β |
| importFromJson | β | β | β | β | β |
| exportToJson | β | β | β | β | β |
| createSyncTable | β | β | β | β | β |
| setSyncDate | β | β | β | β | β |
| getSyncDate | β | β | β | β | β |
| isJsonValid | β | β | β | β | β |
| isDBExists | β | β | β | β | β |
| addUpgradeStatement | β | β | β | β | β |
| copyFromAssets | β | β | β | β | β |
| isDBOpen | β | β | β | β | β |
| isDatabase | β | β | β | β | β |
| isTableExists | β | β | β | β | β |
| getDatabaseList | β | β | β | β | β |
| addSQLiteSuffix | β | β | β | β | β |
| deleteOldDatabases | β | β | β | β | β |
API_Connection_Wrapper_Documentation
API_DB_Connection_Wrapper_Documentation
ImportExportJson_Documentation
UpgradeDatabaseVersion_Documentation
MigratingCordovaDatabases_Documentation
Ionic/Angular_Usage_Documentation
Ionic/React_Usage_Documentation
The IOS and Android codes are using SQLCipher allowing for database encryption
The Electron code use @journeyapps/sqlcipher allowing for database encryption for MacOS !!! NOT for Windows !!!
Thanks goes to these wonderful people (emoji key):
Jean Pierre QuΓ©au π» |
Paul Antoine π» |
Karyfars π» |
Chriswep π |
This project follows the all-contributors specification. Contributions of any kind welcome!
