android - 如何在 SQLite db 中搜索多个列?
问题描述
尝试在 SQLite 数据库的多个列中搜索时遇到问题。这是我当前的代码
String whereClause;
if (!suchwort.contains("%")){ // Abfrage mit Wildcard?
whereClause = WoerterbuchContract.WoerterbuchEintraege.COLUMN_NAME_WORT_DEUTSCH
+ " = '"+suchwort+"'" ;}
else {
whereClause = WoerterbuchContract.WoerterbuchEintraege.COLUMN_NAME_WORT_DEUTSCH
+" like '"+suchwort+"'";}
Cursor ergCursor = db.query(
WoerterbuchContract.WoerterbuchEintraege.TABLE_NAME, // The table to query
projection, // The columns to return
whereClause, // WHERE clause
null, // no values for the WHERE clause
null, // don't group the rows
null, // don't filter by row groups
sortOrder // The sort order
);
我尝试在 whereClause 中添加列,但总是出现编译器错误。
解决方案
推荐阅读
- javascript - 在 angularjs 的情况下,依赖的解析对象返回为未定义
- xcode - 如何在 Xcode 10.x/11.x 中重置自定义快捷方式?
- azure-active-directory - Office 365 用户的入职流程是什么样的?
- c# - UWP 应用 MissingMethodException 中的 Microsoft Store Services SDK
- apache - 捕获 SIGWINCH,在 apache(Redhat)中托管烧瓶应用程序时优雅地关闭
- c# - 无法访问已处置的对象。对象名称:使用后台队列时的“IServiceProvider”
- json - Postgres - json中的增量值
- video - FFmpeg 合并来自不同来源的具有不同比特率的两个文件
- magento - Magento 2 Ui 组件:如何为动态行设置可序列化字段
- google-apps-script - 基于脚本的过滤式查询基于列出的条目从另一个工作表中获取数据