Android 数据库 (SQLite) 从空表返回非空游标 [英] Android database (SQLite) returns a non-empty cursor from an empty table

查看:25
本文介绍了Android 数据库 (SQLite) 从空表返回非空游标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 SQLite 数据库浏览器验证该表不包含任何行.我逐步完成查询构建器代码以获取生成的查询并在 SQLite Database Broswer 中运行查询.查询返回零行.但是,Android 的 SQLiteQueryBuilder.query 方法返回的游标在 cursor.moveToFirst() 调用时返回 true 并返回空值.

I verified using SQLite Database Browser that the table contains no rows. I stepped through the query builder code to get the generated query and ran the query in SQLite Database Broswer. The query returned zero rows. But still, the cursor returned by Android's SQLiteQueryBuilder.query method returns true on cursor.moveToFirst() call and returns null values.

有人见过这样的东西吗?

Anyone seen something like this before?

推荐答案

OK:我认为这是因为我在查询中使用了 MAX 聚合函数.这可能是一个错误,可能是?我现在使用带有限制子句的排序而不是 MAX 并解决了问题.

OK: I figured this is because I'm using a MAX aggregation function in the query. This could be a bug, may be? I now use a sort with a limit clause instead of MAX and worked around.

这篇关于Android 数据库 (SQLite) 从空表返回非空游标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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