Registry / database / anysql-cordova-sqlite

anysql-cordova-sqlite

JSON →
library0.5.1jsnpmunverified

AnysQL-Cordova-SQLite (v0.5.1) provides a Cordova SQLite implementation of the AnySQL API, enabling SQLite database access in Cordova/PhoneGap applications. It follows the AnySQL specification for portable SQL database operations. The package is mature but appears infrequently updated; it relies on the core anysql package and cordova-sqlite-storage. Key differentiator: allows using SQLite within Cordova via the AnySQL abstraction layer.

npm install anysql-cordova-sqlite
INSTALL
IMPORT
SIG · ANYSQL-CORDOVA-SQL
A
anysql-cordova-sqlite
databasejavascriptv0.5.1
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.

default
import AnySQL from 'anysql-cordova-sqlite'
const AnySQL = require('anysql-cordova-sqlite')
This package is primarily used via the AnySQL API; you may also import from 'anysql' and use with provider.
SQLiteProvider
import { SQLiteProvider } from 'anysql-cordova-sqlite'
Named export for the SQLite provider class.
AnySQL
import { AnySQL } from 'anysql'
import { AnySQL } from 'anysql-cordova-sqlite'
Main AnySQL class comes from the 'anysql' package, not this one.

Shows how to create an AnySQL instance with SQLite provider and perform CRUD operations.

import AnySQL from 'anysql'; import { SQLiteProvider } from 'anysql-cordova-sqlite'; const db = new AnySQL(new SQLiteProvider(), { name: 'myapp.db', location: 'default' }); db.execute("CREATE TABLE IF NOT EXISTS test (id INTEGER PRIMARY KEY, value TEXT)") .then(() => db.insert("INSERT INTO test (value) VALUES (?)", ['hello'])) .then(() => db.query("SELECT * FROM test")) .then(rows => console.log(rows)) .catch(err => console.error(err));
Debug
Known issues
breakingThis package requires the cordova-sqlite-storage plugin to be installed in your Cordova project.
fix
Run 'cordova plugin add cordova-sqlite-storage' before using this package.
affects: >=0.1.0
deprecatedThe package uses the legacy Cordova plugin interface and may not work with newer Cordova versions.
fix
Consider using '@awesome-cordova-plugins/sqlite' or 'cordova-sqlite-storage' directly.
affects: >=0.5.0
gotchaThe provider must be instantiated after the Cordova 'deviceready' event.
fix
Wrap your code in document.addEventListener('deviceready', ...).
affects: >=0.1.0
Errors
Common errors & fixes
Error: Failed to open database: unknown error
Missing cordova-sqlite-storage plugin or incorrect database location.
fix
Ensure the plugin is installed and check the 'location' option (e.g., 'default' or 'documents').
Cannot read property 'execute' of undefined
AnySQL instance created before provider is ready or provider is undefined.
fix
Wait for 'deviceready' event before creating AnySQL instance.
Upgrade
Version history
0.5.1latest on npm
Audit
Dependencies
anysqlrequiredCore AnySQL API implementation that this package implements
cordova-sqlite-storagerequiredCordova plugin for SQLite that this package wraps
Agent activity
22 hits · last 30 days
node
20
OpenAI (training)
1
Resources
anysql-cordova-sqlite — npm install anysql-cordova-sqlite · libregistry