Created
February 14, 2014 18:40
-
-
Save hoelzro/9006519 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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