如何阅读和放大使用PhoneGap在内部数据库中写? [英] How to Read & Write in Internal DataBase with PhoneGap?
本文介绍了如何阅读和放大使用PhoneGap在内部数据库中写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在资产下有一个内部SQLite DB 文件夹,其中我已存储了100个用户名&相应的密码,如何通过phoneGap访问它。
我已阅读
I have an internal SQLite DB under "Assets" Folder in which i have stored 100 usernames & corresponding Passwords, How do i access it via phoneGap.?
I have read
http://wiki.phonegap.com/w/page/16494756/Adding-SQL-Database-support- to-your-iPhone-App
仍然无法找出如何连接到已创建的内部数据库,
dbname = userauth
Tablename = reg
parameters = usrnm,psw
任何回答被高度鼓励
我在这里使用。
Am still not able to figure out How to connect to my internal DB which is already Created,
dbname = userauth
Tablename = reg
parameters = usrnm , psw
Any Answer is Highly Encouraged
Am using this here.
推荐答案
/**
* Creates / Opens a connection to DB
*/
DB.openDB = function() {
try {
if (!window.openDatabase) {
//alert('Cannot open database!');
} else {
var shortName = 'db_name';
var version = '1.0';
var displayName = 'DBNAME';
var maxSize = (DEVICE_TYPE == DEVICE_ANDROID || DEVICE_TYPE == DEVICE_ANDROID_TAB) ? 5242880 : 1000000; ////819200; //65536; // in bytes // increased to support Android//163840; //
this.vocabDB = window.openDatabase(shortName, version, displayName, maxSize, this.DBCreated);
this.DBSupported = true;
}
} catch(e) {
//console.log("DB Error handling code goes here.");
//console.log(e);
return;
}
}
这篇关于如何阅读和放大使用PhoneGap在内部数据库中写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文