Registry / database / capacitor-sqlite-storage

capacitor-sqlite-storage

JSON →
library0.0.3jsnpmunverified

A SQLite plugin for Capacitor apps, built on cordova-sqlite-storage. Stable version 0.0.3, intended for Capacitor >=7.0.0. Provides native SQLite database functionality with a simple API for mobile and desktop apps. Key differentiator: leverages the well-tested cordova-sqlite-storage backend for reliability. Supports batch operations and prepared statements. Includes TypeScript definitions. Note: version 0.0.3 is very early and API changes may occur.

npm install capacitor-sqlite-storage
INSTALL
IMPORT
SIG · CAPACITOR-SQLITE-S
C
capacitor-sqlite-storage
databasejavascriptv0.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SQLiteDB
import { SQLiteDB } from 'capacitor-sqlite-storage';
Main class for database operations.
SQLiteConnection
import { SQLiteConnection } from 'capacitor-sqlite-storage';
Manages connections and database initialization.
capacitor-sqlite-storage
import * as SQLitePlugin from 'capacitor-sqlite-storage';
const SQLitePlugin = require('capacitor-sqlite-storage');
Recommended ESM import. CJS require may not work with all bundlers.

Initialize a SQLite database, create table, insert data, and query.

import { CapacitorSQLite, SQLiteConnection, SQLiteDBConnection } from 'capacitor-sqlite-storage'; async function initDatabase() { const sqlite = new SQLiteConnection(CapacitorSQLite); // Create or open database const db: SQLiteDBConnection = await sqlite.createConnection('mydb', false, 'no-encryption', 1, false); await db.open(); // Execute SQL await db.execute(`CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT)`); await db.execute(`INSERT INTO users (name) VALUES ('Alice')`); // Query const result = await db.query('SELECT * FROM users'); console.log(result.values); // Close connection await sqlite.closeConnection('mydb', false); } initDatabase();
Debug
Known issues
breakingIncompatible with Capacitor versions < 7.0.0 due to peer dependency on @capacitor/core >=7.0.0.
fix
Upgrade Capacitor to >=7.0.0
affects: 0.0.3
deprecatedThis plugin is based on cordova-sqlite-storage, which is in maintenance mode.
fix
Consider using @capacitor-community/sqlite for ongoing support
affects: all
gotchaUsing `no-encryption` as encryption mode is required; encrypted mode is not yet supported.
fix
Pass 'no-encryption' as encryption mode parameter
affects: all
gotchaDatabase file name must be a valid file name; avoid special characters not allowed on some platforms.
fix
Use alphanumeric characters and underscores only
affects: all
Errors
Common errors & fixes
CapacitorNativePlugin is not defined
Plugin not properly registered in Capacitor configuration.
fix
Ensure capacitor.config.ts includes the plugin or run npx cap sync
Cannot find module 'capacitor-sqlite-storage'
Package not installed or incorrect import path.
fix
Run npm install capacitor-sqlite-storage
TypeError: db.execute is not a function
Database connection not opened before executing SQL.
fix
Call db.open() before executing queries
Upgrade
Version history
0.0.3latest on npm
Audit
Dependencies
@capacitor/corerequiredPeer dependency required for Capacitor integration
Agent activity
15 hits · last 30 days
node
12
OpenAI (training)
1
Resources
capacitor-sqlite-storage — npm install capacitor-sqlite-storage · libregistry