An Apache Cordova adapter for PawSQLite
Go to file
2021-03-02 22:17:57 -08:00
src Corrected default export 2021-03-02 21:11:25 -08:00
www Added webpack and built 2021-03-02 21:12:39 -08:00
.gitignore Added webpack and built 2021-03-02 21:12:39 -08:00
.jshintrc Initial commit 2021-03-02 20:34:02 -08:00
package-lock.json Added webpack and built 2021-03-02 21:12:39 -08:00
package.json Add webpack dependency 2021-03-02 21:09:10 -08:00
plugin.xml Corrected js module namespace 2021-03-02 21:45:29 -08:00
README.md Added README 2021-03-02 22:17:57 -08:00
webpack.config.js Initial commit 2021-03-02 20:34:02 -08:00

PawSQLite Cordova Adapter

An Apache Cordova plugin and adapter for PawSQLite. This plugin uses its own native implemenation for acessing SQLite. Currently only Android is supported, but other platforms will be added when needed.

Installation

You must first install PawSQLite, and then install the plugin.

npm install -s git+https://git.n0m.org/n0m/PawSQLite.git
cordova plugin add git+https://git.n0m.org/n0m/PawSQLite-Cordova-Adapter.git

Usage

For more detailed usage, please see: PawSQLite

const PawSQLite = require("pawsqlite");

// PawSQLiteCordovaAdapter is automatically injected by cordova
PawSQLite.registerAdapter(PawSQLiteCordovaAdapter);

const db = await PawSQLite.open("test", {
  adapter: 'PawSQLiteCordovaAdapter'
});

await db.sql(`
  CREATE TABLE contacts (
    contact_id INTEGER PRIMARY KEY,
    first_name TEXT NOT NULL,
    last_name TEXT NOT NULL
  );
`);

const transaction = db.transaction();

console.log(await db.sql("SELECT * FROM contacts"));

await transaction.sql(
  "INSERT INTO contacts (first_name, last_name) VALUES (?, ?)",
  "John",
  "Lennon"
);

await transaction.commit();

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT