Skip to content

Instantly share code, notes, and snippets.

@hoelzro
Created February 14, 2014 18:40
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 hoelzro/9006519 to your computer and use it in GitHub Desktop.
Save hoelzro/9006519 to your computer and use it in GitHub Desktop.
function openConnection() {
try {
var db = LocalStorage.openDatabaseSync('harbour-sudoku', '2.0', 'Saved Game Data for Sudoku', 2000);
} catch(e) {
var code = e.code;
if(code !== SQLException.VERSION_ERR) {
throw e;
}
// XXX we'll need something better for moving between different versions...
db = LocalStorage.openDatabaseSync('harbour-sudoku', '1.0', 'Saved Game Data for Sudoku', 2000);
db.readTransaction(function(txn) {
var result = txn.executeSql('SELECT * FROM sqlite_master');
console.log(result.rows.length);
});
db.changeVersion('1.0', '2.0', function(txn) {
txn.executeSql('ALTER TABLE board ADD COLUMN is_initial INTEGER NOT NULL DEFAULT 0');
});
}
return db;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment