Socket
Socket
Sign inDemoInstall

@capacitor-community/sqlite

Package Overview
Dependencies
Maintainers
21
Versions
241
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capacitor-community/sqlite

Capacitor SQLite Plugin


Version published
Weekly downloads
12K
decreased by-2.97%
Maintainers
21
Weekly downloads
Β 
Created
Source


SQLITE DATABASE

@capacitor-community/sqlite


REFACTOR πŸš€


Capacitor community plugin for Native and Electron SQLite Databases. In Native databases could be encrypted with SQLCipher



Maintainers

MaintainerGitHubSocial
QuΓ©au Jean Pierrejepiqueau

REFACTOR πŸš€

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
  • cleaning and aligning the code between platforms
  • allowing developers to develop typeorm or spatialite 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

Browser Support

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.

Installation

npm install @capacitor-community/sqlite@refactor
npm run build
npx cap sync
npx cap add android
npx cap add ios
npx cap add @capacitor-community/electron

IOS

  • on iOS no further steps needed.

Android

  • 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);
          }
        }
      );
  }
}

Electron

  • On Electron, go to the Electron folder of YOUR_APPLICATION
npm install --save @journeyapps/sqlcipher

Build & Run

npm run build
npx cap copy
npx cap copy @capacitor-community/electron

IOS

npx cap open ios

Android

npx cap open android

Electron

npx cap open @capacitor-community/electron

Configuration

No configuration required for this plugin

Supported methods

NameAndroidiOSElectronWeb
createConnectionβœ…βœ…βœ…βŒ
closeConnectionβœ…βœ…βœ…βŒ
open (non-encrypted DB)βœ…βœ…βœ…βŒ
open (encrypted DB)βœ…βœ…βœ…βŒ
closeβœ…βœ…βœ…βŒ
executeβœ…βœ…βœ…βŒ
executeSetβœ…βœ…βœ…βŒ
runβœ…βœ…βœ…βŒ
queryβœ…βœ…βœ…βŒ
deleteDatabaseβœ…βœ…βœ…βŒ
importFromJsonβœ…βœ…βœ…βŒ
exportToJsonβœ…βœ…βœ…βŒ
createSyncTableβœ…βœ…βœ…βŒ
setSyncDateβœ…βœ…βœ…βŒ
getSyncDateβœ…βœ…βœ…βŒ
isJsonValidβœ…βœ…βœ…βŒ
isDBExistsβœ…βœ…βœ…βŒ
addUpgradeStatementβœ…βœ…βœ…βŒ
copyFromAssetsβœ…βœ…βœ…βŒ

Documentation

API_Documentation

API_Connection_Wrapper_Documentation

API_DB_Connection_Wrapper_Documentation

ImportExportJson_Documentation

UpgradeDatabaseVersion_Documentation

Ionic/Angular_Usage_Documentation

Ionic/React_Usage_Documentation

Ionic/Vue_Usage_Documentation

Applications demonstrating the use of the plugin

Ionic/Angular

Ionic/React

Ionic/Vue

Vue (to come later)

Usage

Dependencies

The IOS and Android codes are using SQLCipher allowing for database encryption The Electron code use @journeyapps/sqlcipher allowing for database encryption

Contributors ✨

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!

Keywords

FAQs

Package last updated on 14 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc