Skip to content

Instantly share code, notes, and snippets.

@lohithgn
Last active November 13, 2015 07:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lohithgn/4aa4f3b7892ebce346a9 to your computer and use it in GitHub Desktop.
Save lohithgn/4aa4f3b7892ebce346a9 to your computer and use it in GitHub Desktop.
SQLite Plugin OpenDB & CreateTable
var app = {};
app.db = null;
app.openDb = function() {
var dbName = "todo.db";
app.db = window.sqlitePlugin.openDatabase(dbName);
}
app.createTable = function() {
var db = app.db;
db.transaction(function(tx) {
tx.executeSql("CREATE TABLE IF NOT EXISTS " +
"todo(ID INTEGER PRIMARY KEY ASC, todo TEXT, added_on DATETIME)", []);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment