打印Android SQLiteOpenHelper生成的语句
我有一个更新语句无法正常工作,并且想知道最终语句是什么样的。有没有办法打印出Android SQLiteOpenHelper生成的语句?
到目前为止,我设法通过单步执行堆栈跟踪来获取未填充的语句:
UPDATE banks SET fav=? WHERE code = ? AND name = ?
未填充的语句的语法是正确的。
I have an update statement that does not work properly and want to know how the final statement looks like. Is there a way to print out the statements generated by the Android SQLiteOpenHelper?
So far I managed to get a hold of the unpopulated statement by stepping through the stacktrace:
UPDATE banks SET fav=? WHERE code = ? AND name = ?
The syntax of the unpopulated statement is correct.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除了SQLiteOpenHelper。您可以使用返回字符串的
buildQuery()
方法来获取查询语句的输出,并使用返回游标的query()
方法来运行一个查询。You might want to try to use a SQLiteQueryBuilder in addition to the SQLiteOpenHelper. You can use the
buildQuery()
method, which returns a string, to get the output of the query statement and thequery()
method, which returns a cursor, to run a query.