Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Attachment actions
Description
Version used: 1.0.0-alpha1
Devices/Android versions reproduced on: Google Pixel
If @Quary has three or more IN query parameters then DAO code generation has an error.
For example. Below query has three in query parameters ids, price and type.
@query("select * from products where name like :query and id in (:ids) and price in (:price) and type in (:type)")
LiveData<List> searchProducts(String query,int[] ids,int[] price,int[] type);
Error
Error:(258, 31) error: ';' expected
Error:(258, 36) error: not a statement
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Code Generated
Error in _argIndex = 2 + _inputSize, + _inputSize_1;
@override
public LiveData<List> searchProducts(String query, int[] ids, int[] price,
int[] type) {
StringBuilder _stringBuilder = StringUtil.newStringBuilder();
_stringBuilder.append("select * from products where name like ");
_stringBuilder.append("?");
_stringBuilder.append(" and id in (");
final int _inputSize = ids.length;
StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
_stringBuilder.append(") and price in (");
final int _inputSize_1 = price.length;
StringUtil.appendPlaceholders(_stringBuilder, _inputSize_1);
_stringBuilder.append(") and type in (");
final int _inputSize_2 = type.length;
StringUtil.appendPlaceholders(_stringBuilder, _inputSize_2);
_stringBuilder.append(")");
final String _sql = _stringBuilder.toString();
final int _argCount = 1 + _inputSize + _inputSize_1 + _inputSize_2;
final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, _argCount);
int _argIndex = 1;
if (query == null) {
_statement.bindNull(_argIndex);
} else {
_statement.bindString(_argIndex, query);
}
_argIndex = 2;
for (int _item : ids) {
_statement.bindLong(_argIndex, _item);
_argIndex ++;
}
_argIndex = 2 + _inputSize;
for (int _item_1 : price) {
_statement.bindLong(_argIndex, _item_1);
_argIndex ++;
}