While inquire for sql, how to solve this problem I have found this. And it works.
StringBuilder sb = new StringBuilder(); sb.append("select * from t_calllog where sds_uid=? and globalid in( "); for (int i = 0; i < limit; i++) { if (i != 0) { sb.append(","); } sb.append("?"); } sb.append(" )"); statement = session.prepare(sb.toString()); //Then bound BoundStatement bs = new BoundStatement(statement); bs.setString(0, callLog.getSds_uid()); Row row = null; for (int i = 1; i <= limit; i++) { bs.setString(i, "value"); } Are there any better solution? If have please let me know, thanks! ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2014-09-10 08:11:42,"wateray" <wate...@163.com> : Hi all. I have a select like this: PrepareStatemet ps = session.prepare("SELECT * FROM my_table where id in (?)"); Then how to bound this parameter? I try to the following 2 method. But it didn't work. 1. when do this, it doesn't work, nothing was selected. String ids = " 'id1', 'id2', 'id3' "; ps.bind(ids); 2. Set<String> ids = new HashSet<String>(); ids.add("id1"); ids.add("id2"); ids.add("id3"); ps.bind(ids); // error,it say the id is not HashSet type inconsistent. Then how can I do? Thanks!