mirror of
https://github.com/moparisthebest/PhoneGap-SQLitePlugin-Android
synced 2024-11-25 18:12:16 -05:00
sqlitePlugin.openDatabase() instead of window.my_openDatabase() in Android (DroidGap) version, fix Droid lawnchair adapter
This commit is contained in:
parent
0aff2f23f7
commit
7402f0d3ad
@ -13,6 +13,8 @@
|
||||
*/
|
||||
|
||||
|
||||
// XXX TODO: use function() { ... } () to encapsulate these declarations (except for Java callback)
|
||||
|
||||
/**
|
||||
* SQL result set object
|
||||
* PRIVATE METHOD
|
||||
@ -331,8 +333,10 @@ var DDB_openDatabase = function(name, version, display_name, size) {
|
||||
* @constructor
|
||||
*/
|
||||
|
||||
window.my_openDatabase = function(name, version, desc, size){
|
||||
window.sqlitePlugin = {
|
||||
openDatabase: function(name, version, desc, size) {
|
||||
window.dddb = new DDB();
|
||||
return DDB_openDatabase(name, version, desc, size);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>PhoneGap</title>
|
||||
<link rel="stylesheet" href="master.css" type="text/css" media="screen" title="no title" charset="utf-8">
|
||||
<script type="text/javascript" charset="utf-8" src="phonegap-1.1.0.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="cordova-1.5.0.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="SQLitePlugin.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="main.js"></script>
|
||||
|
||||
@ -23,7 +23,7 @@ function init1test() {
|
||||
// PhoneGap is ready
|
||||
//
|
||||
function onDeviceReady() {
|
||||
var db = window.my_openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
|
||||
var db = window.sqlitePlugin.openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
|
||||
|
||||
db.transaction(function(tx) {
|
||||
|
||||
|
@ -13,6 +13,8 @@
|
||||
*/
|
||||
|
||||
|
||||
// XXX TODO: use function() { ... } () to encapsulate these declarations (except for Java callback)
|
||||
|
||||
/**
|
||||
* SQL result set object
|
||||
* PRIVATE METHOD
|
||||
@ -317,9 +319,7 @@ DatabaseShell.prototype.transaction = function(process, errorCallback, successCa
|
||||
* @return Database object
|
||||
*/
|
||||
var DDB_openDatabase = function(name, version, display_name, size) {
|
||||
console.log("open database " + name + " ... typeof " + typeof(PhoneGap.exec));
|
||||
PhoneGap.exec(null, null, "SQLitePlugin", "openDatabase", [name, version, display_name, size]);
|
||||
//cordova.exec(null, null, "SQLitePlugin", "openDatabase", [name, version, display_name, size]);
|
||||
var db = new DatabaseShell();
|
||||
return db;
|
||||
};
|
||||
@ -333,8 +333,10 @@ console.log("open database " + name + " ... typeof " + typeof(PhoneGap.exec));
|
||||
* @constructor
|
||||
*/
|
||||
|
||||
window.my_openDatabase = function(name, version, desc, size){
|
||||
window.sqlitePlugin = {
|
||||
openDatabase: function(name, version, desc, size) {
|
||||
window.dddb = new DDB();
|
||||
return DDB_openDatabase(name, version, desc, size);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -22,8 +22,8 @@ Lawnchair.adapter('webkit-sqlite', (function () {
|
||||
return {
|
||||
|
||||
//valid: function() { return !!(window.openDatabase) },
|
||||
valid: function() { return !!(window.my_openDatabase) },
|
||||
//valid: function() { return !!(sqlitePlugin.openDatabase) },
|
||||
//valid: function() { return !!(window.my_openDatabase) },
|
||||
valid: function() { return !!(sqlitePlugin.openDatabase) },
|
||||
|
||||
init: function (options, callback) {
|
||||
var that = this
|
||||
@ -33,8 +33,9 @@ Lawnchair.adapter('webkit-sqlite', (function () {
|
||||
// open a connection and create the db if it doesn't exist
|
||||
//this.db = openDatabase(this.name, '1.0.0', this.name, 65536)
|
||||
//this.db = my_openDatabase(this.name, '1.0.0', this.name, 65536)
|
||||
this.db = window.my_openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
|
||||
//this.db = window.my_openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
|
||||
//this.db = sqlitePlugin.openDatabase(this.name, '1.0.0', this.name, 65536)
|
||||
this.db = sqlitePlugin.openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
|
||||
this.db.transaction(function (t) {
|
||||
t.executeSql(create, [], win, fail)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user