在哪里安装SQLiteAndroidDatabase.java文件?
我正在尝试在我的在哪里安装SQLiteAndroidDatabase.java文件?,android,sqlite,cordova,Android,Sqlite,Cordova,我正在尝试在我的Phonegap应用程序中使用 我已经在我的应用程序页面中包含了SQLitePlugin.js,但是当我执行文档演示代码时,它会在控制台中返回此错误消息: [console.log] OPEN database: Database [console.log] new transaction is waiting for open operation [console.log] OPEN database: Database failed. aborting any pending
Phonegap
应用程序中使用
我已经在我的应用程序页面中包含了SQLitePlugin.js
,但是当我执行文档演示代码时,它会在控制台中返回此错误消息:
[console.log] OPEN database: Database
[console.log] new transaction is waiting for open operation
[console.log] OPEN database: Database failed. aborting any pending transactions
[console.log] Could not open database
这是执行的代码:
// Wait for Cordova to load
document.addEventListener("deviceready", onDeviceReady, false);
// Cordova is ready
function onDeviceReady() {
var db = window.sqlitePlugin.openDatabase("Database", "1.0", "Demo", -1);
db.transaction(function(tx) {
tx.executeSql('DROP TABLE IF EXISTS test_table');
tx.executeSql('CREATE TABLE IF NOT EXISTS test_table (id integer primary key, data text, data_num integer)');
tx.executeSql("INSERT INTO test_table (data, data_num) VALUES (?,?)", ["test", 100], function(tx, res) {
console.log("insertId: " + res.insertId + " -- probably 1");
console.log("rowsAffected: " + res.rowsAffected + " -- should be 1");
tx.executeSql("select count(id) as cnt from test_table;", [], function(tx, res) {
console.log("res.rows.length: " + res.rows.length + " -- should be 1");
console.log("res.rows.item(0).cnt: " + res.rows.item(0).cnt + " -- should be 1");
});
}, function(e) {
console.log("ERROR: " + e.message);
});
});
}
在文件中写下:
Install SQLiteAndroidDatabase.java and SQLitePlugin.java from src/android/io/liteglue into src/io/liteglue subdirectory
但我在我的项目中找不到
src
文件夹您正在尝试在浏览器中运行它吗
在设备中它会工作,但在浏览器中它不会 你找到解决方案了吗?还没有,我保存在
localStorage
,但也许这可以帮助你pookdb
是一个类似mongoDb
的数据库,我在pookdb
方面没有经验,但看起来我很实际这不是答案。这应该只是一个评论。一旦你赢得了声誉,你就可以发表评论了。当然,我只想发表评论,但我没有足够的理由这么做。这是完全可以理解的。一旦你有足够的钱,你将能够;相反