使用数据库字符串作为查询
我正在制作一个包含“成就”的列表活动。每个成就都是应用程序中 SQLite 数据库中的一条记录。在每条记录中,我有一列存储了查询字符串。对于数据库中的每条记录,我使用查询字符串针对另一个用户生成的数据库来确定已完成哪些成就...
我一直在使用的查询字符串在我的 sqlite 管理器程序中正常工作...但是在我的应用程序中,看来查询被忽略并返回整个用户生成的数据库。我确信可能存在其他一般错误(例如返回空查询字符串等),但我找不到任何错误,而且现在我没有可以在这里发布的代码。
通过从成就数据库中提取的字符串执行查询,我是否会陷入任何陷阱?这是我可以想象的最直接的方法,无需大量 if-then 子句即可实现成就。
编辑:最后我在调用中发现了一个错误,传递了错误的参数。最终的陷阱就是工作太睡眼惺忪。
I am making a list activity that will contain 'achievements'. Each achievement is a record in a sqlite db in the app. In each record, I have a column with a query string stored. For each record in the db, I am using the query string against another user generated db to determine which achievements have been accomplished...
The query strings I have been using are working correctly in my sqlite manager program... however in my app, it appears that the query is being ignored and returns the entire user generated db. I'm sure there is the potential for other general errors (like null query string returned etc) but I couldn't find any, and right now I don't have my code here to post.
Are there any pitfalls I am falling into by executing a query from a string extracted from the achievement db? This was the most straightforward way I could envision doing the achievements without a whole lot of if-then clauses.
EDIT: In the end I found an error in the call, passing the wrong argument. Pitfall in the end was working too bleary-eyed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以基本上你的数据是非规范化的。例如,如果您需要更改格式,这会使更改变得更加困难。利用数据做各种事情也会变得更加困难,例如查询具有给定成就的人数。
So basically your data is denormalised. This makes it harder to change, if you ever need to change the format for example. It will also be harder to do a variety of things with your data, e.g. query the number of people with a given achievement.