npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@capacitor-community/sqlite

v6.0.2

Published

Community plugin for native & electron SQLite databases

Downloads

57,484

Readme

Maintainers

| Maintainer | GitHub | Social | | ---------- | ----------------------------------------- | --------------------------------------------- | | Robin Genz | robingenz | @robin_genz |

To install:

npm install --save @capacitor-community/sqlite
npx cap sync
yarn add @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

then add plugin to main capacitor.config.ts file:

import { CapacitorConfig } from '@capacitor/cli';

const config: CapacitorConfig = {
  appId: 'com.jeep.app.ionic7.angular.sqlite',
  appName: 'ionic7-angular-sqlite-starter',
  webDir: 'www',
  server: {
    androidScheme: 'https'
  },
  plugins: {
    CapacitorSQLite: {
      iosDatabaseLocation: 'Library/CapacitorDatabase',
      iosIsEncryption: true,
      iosKeychainPrefix: 'angular-sqlite-app-starter',
      iosBiometric: {
        biometricAuth: false,
        biometricTitle : "Biometric login for capacitor sqlite"
      },
      androidIsEncryption: true,
      androidBiometric: {
        biometricAuth : false,
        biometricTitle : "Biometric login for capacitor sqlite",
        biometricSubTitle : "Log in using your biometric"
      },
      electronIsEncryption: true,
      electronWindowsLocation: "C:\\ProgramData\\CapacitorDatabases",
      electronMacLocation: "/Volumes/Development_Lacie/Development/Databases",
      electronLinuxLocation: "Databases"
    }
  }
};
export default config;

More Reading:

Tutorials Blog

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 from node_modules/sql.js/dist/sql-wasm.wasm to the src/assets folder of YOUR_APP

For Vue & React frameworks

  • Copy manually the file sql-wasm.wasm from node_modules/sql.js/dist/sql-wasm.wasm to the public/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.

  • Check/Add the following: Gradle JDK version 17 Android Gradle Plugin Version 8.0.0 In variables.gradle

    minSdkVersion = 22
    compileSdkVersion = 33
    targetSdkVersion = 33

    In AndroidManifest.xml

        <application
          android:allowBackup="false"
          android:fullBackupContent="false"
          android:dataExtractionRules="@xml/data_extraction_rules"

    In res/xml create a file data_extraction_rules.xml containing:

    <?xml version="1.0" encoding="utf-8"?>
    <data-extraction-rules>
        <cloud-backup>
          <exclude domain="root" />
          <exclude domain="database" />
          <exclude domain="sharedpref" />
          <exclude domain="external" />
        </cloud-backup>
        <device-transfer>
          <exclude domain="root" />
          <exclude domain="database" />
          <exclude domain="sharedpref" />
          <exclude domain="external" />
        </device-transfer>
    </data-extraction-rules>

Electron Quirks

  • On Electron, go to the Electron folder of YOUR_APPLICATION
cd electron
npm install --save better-sqlite3-multiple-ciphers
npm install --save electron-json-storage
npm install --save jszip
npm install --save [email protected]
npm install --save crypto
npm install --save crypto-js
npm install --save-dev @types/better-sqlite3
npm install --save-dev @types/electron-json-storage
npm install --save-dev @types/crypto-js
  • Important: node-fetch version must be <=2.6.7; otherwise you'll get an error running the app.

  • Important: if you are using @capacitor-community/electron v5

npm install --save-dev [email protected]
npm uninstall --save-dev electron-rebuild
npm install --save-dev @electron/rebuild
npm install --save-dev [email protected]
  • in electron folder open the tsconfig.json file and add "skipLibCheck": true,

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 | ✅ | ✅ | ✅ | ❌ | | checkEncryptionSecret | ✅ | ✅ | ✅ | ❌ | | initWebStore | ❌ | ❌ | ❌ | ✅ | | saveToStore | ❌ | ❌ | ❌ | ✅ | | getNCDatabasePath | ✅ | ✅ | ❌ | ❌ | | createNCConnection | ✅ | ✅ | ❌ | ❌ | | closeNCConnection | ✅ | ✅ | ❌ | ❌ | | isNCDatabase | ✅ | ✅ | ❌ | ❌ | | transaction | ✅ | ✅ | ✅ | ✅ | | getFromHTTPRequest | ✅ | ✅ | ✅ | ✅ | since 4.2.0 | | isDatabaseEncrypted | ✅ | ✅ | ✅ | ❌ | since 4.6.2-2 | | isInConfigEncryption | ✅ | ✅ | ✅ | ❌ | since 4.6.2-2 | | isInConfigBiometricAuth | ✅ | ✅ | ❌ | ❌ | since 4.6.2-2 | | getFromLocalDiskToStore | ❌ | ❌ | ❌ | ✅ | since 4.6.3 | | saveToLocalDisk | ❌ | ❌ | ❌ | ✅ | since 4.6.3 | | beginTransaction | ✅ | ✅ | ✅ | ✅ | since 5.0.7 | | commitTransaction | ✅ | ✅ | ✅ | ✅ | since 5.0.7 | | rollbackTransaction | ✅ | ✅ | ✅ | ✅ | since 5.0.7 | | isTransactionActive | ✅ | ✅ | ✅ | ✅ | since 5.0.7 |

Documentation & APIs

Applications demonstrating the use of the plugin and related documentation

Ionic/Angular

Ionic/Angular TypeORM app (Not Updated)

Ionic/React

Ionic/React Capacitor SQLite + TypeORM Example App

Ionic/Vue

Vue (Not Updated)

Vue TypeORM app (Not Updated)

SolidJS+Vite (Not Updated)

Nuxt3 + Kysely

Quasar

SvelteKit

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 better-sqlite3-multiple-ciphers , electron-json-storage and node-fetch from 5.0.4. 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!

Credits

A big thank you to Jean Pierre Quéau, who maintained this plugin until version 6.0.0.