SQLite问题(不更新)
我制作了一个 SQLite 数据库文件,其中包含一些测试数据。当我在我的应用程序中使用它时,一切进展顺利。
接下来,我使用 SQLite 管理器将包含数据的新行插入到我的表中。问题就在这里。当我现在运行我的应用程序时,新数据不会出现。仍然是所有旧数据(没有新插入的数据)。
有谁知道为什么 SQLite 文件没有更新(或者可能已更新但不显示数据)?
更新:
我在 FireFox 中使用 SQLite 管理器。 我已使用该管理器插入它,当我查询 select * from 表时,它会显示新数据。 我使用以下命令打开我的数据库
var db = Titanium.Database.install('../test2.sqlite', 'test');
I have made an SQLite database file with some testdata in it. When I use it in my application it goes well.
Next I have inserted a new row with data into my table with an SQLite manager. Here's where the problem is. When i run my application now, the new data doesn't appear. It's still all the old data (without the newly inserted one).
Does anyone know why the SQLite file isn't updated (Or maybe it's updated but doesn't show the data)?
Update:
I use the SQLite manager in FireFox.
I've inserted it with that manager, and when i query the select * from table it shows the new data.
I use the following command to open my database
var db = Titanium.Database.install('../test2.sqlite', 'test');
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
打开数据库时当前路径是什么?
../
指的是父文件夹;您绝对确定这是您使用 SQLite Manager 创建数据库的同一文件夹吗?如果您打开不存在的数据库,SQLite 不会出错;它只会创建一个新的、空的。使用完整的绝对路径,然后重试。
What is the current path when you open the database?
../
refers to the parent folder; are you absolutely certain that is the same folder where you’ve been creating a database using SQLite Manager? SQLite doesn’t error out if you open a non-existing database; it’ll just create a new, empty, one.Use a full, absolute path, and try again.
我通常是这样认为的。您的数据库似乎已被缓存。您应该更改名称
或删除缓存的数据库。
this is typically i think. your database seems to be cached. you should change the name
or delete the cached database.
您不需要重命名数据库。
您可以尝试在模拟器或仿真器中删除该应用,然后重新安装该应用。这对我有用。由于该应用程序仍然具有旧数据库。使用新数据(即列、行)重新安装应用程序。我也在 Firefox 中使用 SQLite Manager 插件。
You don't need to rename your database.
You can try to delete the app in your simulator or emulator and install the app again. It worked for me. Since the app still has the old database. Re-installing the app with the new data (i.e. columns, rows). I use SQLite Manager plugin in Firefox as well.