使用房间时更新项目列表时出现语法错误((1)靠近“?”:语法错误)
I have a syntax error when updating list of items when using room ( (1) near "?": syntax error )
我的错误:
databaseE/SQLiteLog: (1) near "?": syntax error in "update posts_table
set list = ?,? where id= ?"
我的代码:
@Query("update posts_table set list = :list where id= :id")
Completable updatePost(int id, ArrayList<Integer> list);
这样写
@Query("update posts_table set list = :list where id= :id")
void updatePost(ArrayList list,int id);
我建议你把arraylist转成string然后在db中添加数据
不要将数组列表直接添加到其中
我的错误:
databaseE/SQLiteLog: (1) near "?": syntax error in "update posts_table set list = ?,? where id= ?"
我的代码:
@Query("update posts_table set list = :list where id= :id")
Completable updatePost(int id, ArrayList<Integer> list);
这样写
@Query("update posts_table set list = :list where id= :id")
void updatePost(ArrayList list,int id);
我建议你把arraylist转成string然后在db中添加数据 不要将数组列表直接添加到其中