首页 文章

Sqlite从内容提供商处选择电子邮件列

提问于
浏览
1

我正在尝试从sqlite中选择一些数据,其中列代表一个电子邮件地址 .

我的查询是这样的:

Cursor countCursor = mContentResolver.query(
            SubscribeContract.SubscribeEntry.CONTENT_URI,
            new String[]{"count(*) AS count"},
            "user = ? ",
            new String[]{ userChatID },
            null);

但它什么也没有回归 .

sqlite3终端上的查询返回正常 .

sqlite> select count(*) as count from subscribe where user = 'brunox17_7a84e0c5e635fb571b32f5be9d55dd0b734c2f57@boo-app.com';

计数

21

我认为问题是因为列类型是文本,我不能在选择参数周围加上引号 .

1 回答

  • 0

    你在测试什么API版本? API11支持参数化查询 .

    您可以在 Cursor 对象上尝试 getCount() 方法,而无需指定任何where子句 .

相关问题