Registry / database / cordova-plugin-sqlite

cordova-plugin-sqlite

JSON →
library1.0.3jsnpmunverified

This package (v1.0.3) is a deprecated Cordova plugin that provides a native interface to SQLite for Android, iOS, Windows Universal (8.1), Amazon Fire-OS, and WP7/8. It offers an API similar to the HTML5 Web SQL API, with features like failure-safe nested transactions and batch processing. The plugin is no longer maintained: the README explicitly advises to use the litehelpers/Cordova-sqlite-storage plugin instead. Key differentiators at the time were drop-in replacement for HTML5 SQL API and cross-platform support. However, due to deprecation, it should not be used in new projects.

npm install cordova-plugin-sqlite
INSTALL
IMPORT
SIG · CORDOVA-PLUGIN-SQL
C
cordova-plugin-sqlite
databasejavascriptv1.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.

sqlitePlugin
window.sqlitePlugin; // available after plugin installation
import sqlitePlugin from 'cordova-plugin-sqlite';
This is a Cordova plugin, not a JS module. Access via global window.sqlitePlugin after device ready.
openDatabase
var db = sqlitePlugin.openDatabase({name: 'mydb.db', location: 'default'});
var db = openDatabase('mydb.db', '1.0', 'desc', 5*1024*1024); // Web SQL API syntax
Replaces window.openDatabase from Web SQL API. Must use sqlitePlugin.openDatabase.
SQLResultSet
// Not directly imported; accessed via callback: tx.executeSql('SELECT ?', [val], function(tx, results) { results.rows.length; });
import { SQLResultSet } from 'cordova-plugin-sqlite'; // No such export
Results are plain JavaScript objects, not typed imports.

Shows how to open a database, create a table, insert and select data using the deprecated plugin.

// Ensure Cordova deviceready event has fired document.addEventListener('deviceready', function() { var db = sqlitePlugin.openDatabase({name: 'my.db', location: 'default'}); db.transaction(function(tx) { tx.executeSql('CREATE TABLE IF NOT EXISTS test (id integer primary key, value text)'); tx.executeSql('INSERT INTO test VALUES (?, ?)', [1, 'test']); tx.executeSql('SELECT * FROM test', [], function(tx, results) { for (var i = 0; i < results.rows.length; i++) { console.log(results.rows.item(i)); } }); }, function(err) { console.error('Transaction error: ' + err.message); }); });
Debug
Known issues
deprecatedThis package is deprecated. The README explicitly advises to use litehelpers/Cordova-sqlite-storage instead.
fix
Migrate to 'cordova-sqlite-storage' or 'cordova-plugin-sqlite-2' or 'cordova-sqlite-evcore-extbuild-free'.
affects: >=0.0.1
breakingWindows Universal (8.1) version is in pre/alpha state with no background processing, database close/delete operations not implemented, and not all CPU targets supported.
fix
Consider using a more stable plugin for Windows platforms, such as 'cordova-plugin-sqlite-2'.
affects: 1.0.3
breakingWP8 version has performance/stability issues with the CSharp-SQLite library.
fix
Use Windows Universal platform instead or switch to a different plugin.
affects: 1.0.3
gotchaAPI to open the database may be changed somewhat to be more streamlined. Transaction and single-statement query API will NOT be changed.
fix
Stick to transaction and single-statement APIs for future compatibility if staying on this version.
affects: 1.0.3
Errors
Common errors & fixes
ReferenceError: sqlitePlugin is not defined
Accessing sqlitePlugin before the deviceready event fires or plugin not installed correctly.
fix
Ensure plugin is added: cordova plugin add cordova-plugin-sqlite and wait for deviceready.
Error: Invalid database name or location
Missing or invalid 'name' or 'location' option in openDatabase call.
fix
Provide an object with 'name' (string) and optionally 'location' (default, 'default', 'Library', 'Documents', etc. for iOS).
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
cordovaoptionalRequires Cordova framework to function as a plugin
Agent activity
16 hits · last 30 days
node
12
OpenAI (training)
2
Amazon
1
Resources
cordova-plugin-sqlite — npm install cordova-plugin-sqlite · libregistry