黑莓 - 附加预填充的sqlite数据库 [英] Blackberry - Attach pre-populated sqlite database

查看:172
本文介绍了黑莓 - 附加预填充的sqlite数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个预先填充的sqlite数据库,我需要在我的黑莓应用程序中附加这个。我使用phonegap,因此使用以下javascript代码打开我的数据库,然后运行一个select语句:

I have a pre-populated sqlite database and I need to attach this within my Blackberry app. I am using phonegap and therefore using the following javascript code to open my database and then run a select statement:

db = window.openDatabase("TaxCalculatorDB","1.0","Tax Calculator DB",1000000);
db.transaction(Manufacturer, errorCB, successCB);



<用户)。

However, when trying to run my select statement I get an error (ERROR: 1 no such table:user).

我已经将我的数据库文件(我在iOS版本中成功使用)直接添加到assets文件夹中,与我之前的操作完全相同。我需要将此数据库文件夹移到其他位置吗?

I have added my database files (which I have succesfully used in a iOS build) directly into the assets folder, exactly the same way I had done before. Do i need to move this database folder elsewhere?

请咨询,谢谢。

推荐答案

您必须在使用webworks时使用Javascript创建数据库。目前没有办法将现有的sqlite数据库导入到webworks应用程序中。 (您将此标记为phonegap,但我认为phonegap使用webworks创建应用程序)

You have to have Javascript create the database when using webworks. There is currently no way to import an existing sqlite db into a webworks app. (You tagged this as phonegap, but I think phonegap uses webworks to create the app)

这是常见的解决方法是包括一个JSON或XML文件与所有要加载的数据。创建数据库时,请读取包含的文件并将该数据添加到其中。

The common workaround to this is to include a JSON or XML file with all the data to be loaded. When you create the database, read the included file and add that data to it.

这篇关于黑莓 - 附加预填充的sqlite数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆