1
我的iOS項目有一個SQLITE數據庫,我可以從我的本地IOS代碼訪問它。我可以訪問它並從中讀取數據。不能用phonegap打開sqlite數據庫,但它在objectiveC上工作正常
你可以看到我做它和下面的PIC我的項目結構的方式:
,我嘗試做使用PhoneGap的一樣:
var db;
var shortName = 'myTestDb.db';
var version = '1.0';
var displayName = 'myTestDb';
var maxSize = 65535;
// list the values in the database to the screen using jquery to
//update the #lbUsers element
function ListDBValues() {
if (!window.openDatabase) {
alert('Databases are not supported in this browser.');
return;
}
$('#myDbElements').html('');
db.transaction(function(transaction) {
transaction.executeSql("SELECT FIRST_NAME FROM dbo_RE_USER;", [],
function(transaction, result) {
console.log("result");
if (result != null && result.rows != null) {
console.log("result is not null");
for (var i = 0; i < result.rows.length; i++) {
var row = result.rows.item(i);
//console.log(row);
debugObject(row);
$('#myDbElements').append('<br>' + row["FIRST_NAME"]);// + " " + row.LAST_NAME);
}
}
PrecApp.I_SCROLL.refresh();
},errorHandler);
},errorHandler,nullHandler);
return;
}
function debugObject(obj) {
console.log("ROW:");
for (n in obj)
// alert(n + ":" + obj[n]);
console.log(n + ":" + obj[n]);
}
但它不能找到我的dbo_re_users表。爲什麼?