与处理凡(?)中的Android SQLite的原始查询 [英] Dealing with WHERE IN(?) in Android SQLite raw query
问题描述
如何处理与Android的DB原材料查询,包含了大量的争论?例如 SELECT * FROM表WHERE TABLE.COLUMN(15,14,17,19)
。我可以用precompiled SQL与?
选择,或者有没有其他的选择,而不是与串联单独格式化每个查询?
How to deal with raw queries in Android DB that contain a lot of arguments? For example SELECT * FROM table WHERE table.column IN (15, 14, 17, 19)
. Can I use precompiled SQL with ?
selections, or is there no other choice than to format each query individually with concatenation?
我在做
SQLiteDatabase.rawQuery("... WHERE table.column IN (?)", selectionArgs);
其中, selectionArgs两个
是字符串
加盟ID的,但查询将不会执行。
where selectionArgs
is String
of joined IDs, but the query won't execute.
推荐答案
没有,你不能这样做。你必须使用 ... WHERE TABLE.COLUMN IN(?,?,?,?)
并分别添加参数。
No, you can't do that. You have to use ... WHERE table.column IN (?, ?, ?, ?)
and add the parameters separately.
这篇关于与处理凡(?)中的Android SQLite的原始查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!