Registry / database / uk.co.workingedge.cordova.plugin.sqliteporter

uk.co.workingedge.cordova.plugin.sqliteporter

JSON →
library1.1.2jsnpmunverified

A Cordova/Phonegap plugin for importing and exporting SQLite databases to/from SQL or JSON. Supports HTML5 WebSQL on Android, iOS, Tizen, Blackberry 10 and native SQLite via cordova-sqlite-storage on Android, iOS, Fire-OS, Windows. Version 1.1.2 (latest stable) available on npm. Key differentiators: supports both SQL and JSON formats, works with WebSQL and native SQLite.

npm install uk.co.workingedge.cordova.plugin.sqliteporter
INSTALL
IMPORT
SIG · UK.CO.WORKINGEDGE.
U
uk.co.workingedge.cordova.plugin.sqliteporter
databasejavascriptv1.1.2
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.

sqlitePorter
import { sqlitePorter } from 'uk.co.workingedge.cordova.plugin.sqliteporter';
var sqlitePorter = require('uk.co.workingedge.cordova.plugin.sqliteporter');
ESM import works with bundlers. CommonJS require may not work in all environments; use ESM for consistency.
sqlitePorter.importSqlToDb
sqlitePorter.importSqlToDb(db, sql);
window.sqlitePorter.importSqlToDb(db, sql);
Access as named export, not via window object. The plugin is available after deviceready.
sqlitePorter.exportDbToSql
sqlitePorter.exportDbToSql(db);
sqlitePorter.exportDbToSql(db, {});
Second parameter is optional options object, but exporting without it is valid.

Basic usage demonstrating import/export of SQL and JSON with native SQLite database in a Cordova app.

import { sqlitePorter } from 'uk.co.workingedge.cordova.plugin.sqliteporter'; import { SQLite } from 'cordova-sqlite-storage'; // Wait for deviceready document.addEventListener('deviceready', async () => { try { const db = await SQLite.openDatabase({ name: 'test.db', location: 'default' }); // Import SQL const sql = 'CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT);\nINSERT INTO users VALUES (1, \'Alice\');'; await sqlitePorter.importSqlToDb(db, sql); // Export to SQL const exported = await sqlitePorter.exportDbToSql(db); console.log(exported); // Export to JSON const json = await sqlitePorter.exportDbToJson(db); console.log(json); // Import JSON const jsonData = { 'users': [{ 'id': 2, 'name': 'Bob' }] }; await sqlitePorter.importJsonToDb(db, jsonData); } catch (error) { console.error('SQLite Porter error:', error); } });
Debug
Known issues
gotchaPlugin requires cordova-sqlite-storage for non-WebSQL platforms; not using it may cause failures on Windows or Amazon Fire-OS.
fix
Install cordova-sqlite-storage: cordova plugin add cordova-sqlite-storage
affects: *
gotchaMust wait for 'deviceready' event before using the plugin; otherwise it may not be available.
fix
Wrap calls in document.addEventListener('deviceready', ...)
affects: *
gotchaUsing WebSQL on deprecated platforms (Cordova 4.x) may have older plugin versions. Cordova 5.0+ recommended.
fix
Upgrade Cordova CLI: npm install -g cordova@latest
affects: <5.0
gotchaJSON import with nested objects may cause unexpected behavior; the plugin expects simple key-value per column.
fix
Ensure JSON structure matches the DB schema as described in the plugin documentation.
affects: *
Errors
Common errors & fixes
sqlitePorter is not defined
Accessing sqlitePorter before 'deviceready' event or using CommonJS require in ESM environment.
fix
Use ESM import and ensure code runs after deviceready.
Cannot read property 'importSqlToDb' of undefined
Import path incorrect or plugin not installed correctly.
fix
Check installation with 'cordova plugin list' and import as 'import { sqlitePorter } from 'uk.co.workingedge.cordova.plugin.sqliteporter''
No SQLite database found
Database not opened via cordova-sqlite-storage or using HTML5 WebSQL when not available.
fix
Open a valid HTML5 WebSQL or native SQLite database first.
SyntaxError: Unexpected token IN SERT
SQL string contains typos or malformed statements.
fix
Validate SQL syntax; ensure each statement ends with semicolon and no stray newlines.
Upgrade
Version history
1.1.2latest on npm
Audit
Dependencies
cordova-sqlite-storageoptionalRequired for native SQLite support on platforms without WebSQL or for unlimited storage
Agent activity
24 hits · last 30 days
node
18
Meta
2
OpenAI (training)
2
Resources
uk.co.workingedge.cordova.plugin.sqliteporter — npm install uk.co.workingedge.cordova.plugin.sqliteporter · libregistry