@Test public void testCreateMutiGetSql() { String sql = "select a,b from table where a in "; int paramsSize = 10; String result = DaoUtil.createMutiGetSql(sql, paramsSize); ApiLogger.debug("testCreateMutiGetSql result:" + result); int count = 0; char[] chs = result.toCharArray(); for (char ch : chs) { if (ch == '?') { count++; } } if (paramsSize <= 0) { Assert.assertEquals(1, count); } else { Assert.assertEquals(paramsSize, count); } }
public static String createMutiGetSql(String sql, int paramsSize){ StringBuilder sqlBuf = new StringBuilder().append(sql).append("( ?"); for(int i = 1; i < paramsSize; i++){ sqlBuf.append(", ?"); } return sqlBuf.append(")").toString(); }
DaoUtil { public static String createMutiGetSql(String sql, int paramsSize){ StringBuilder sqlBuf = new StringBuilder().append(sql).append("( ?"); for(int i = 1; i < paramsSize; i++){ sqlBuf.append(", ?"); } return sqlBuf.append(")").toString(); } }
DaoUtil { public static String createMutiGetSql(String sql, int paramsSize){ StringBuilder sqlBuf = new StringBuilder().append(sql).append("( ?"); for(int i = 1; i < paramsSize; i++){ sqlBuf.append(", ?"); } return sqlBuf.append(")").toString(); }  }
DaoUtil { public static String createMutiGetSql(String sql, int paramsSize){ StringBuilder sqlBuf = new StringBuilder().append(sql).append("( ?"); for(int i = 1; i < paramsSize; i++){ sqlBuf.append(", ?"); } return sqlBuf.append(")").toString(); }  static String createMutiGetEncodedSql(String sql, int paramsSize); static String createMutiGetSql(String sql, int paramsSize); static String expendMultiGetSql(String sql, Object[] params); static Object[] expendMultiGetParams(Object[] params); static String createMultiInsertSql(String sqlPrefix, String sqlSuffix, int valuesSize); static String buildSql(String rawSql, String db, String table); }
DaoUtil { public static String createMutiGetSql(String sql, int paramsSize){ StringBuilder sqlBuf = new StringBuilder().append(sql).append("( ?"); for(int i = 1; i < paramsSize; i++){ sqlBuf.append(", ?"); } return sqlBuf.append(")").toString(); }  static String createMutiGetEncodedSql(String sql, int paramsSize); static String createMutiGetSql(String sql, int paramsSize); static String expendMultiGetSql(String sql, Object[] params); static Object[] expendMultiGetParams(Object[] params); static String createMultiInsertSql(String sqlPrefix, String sqlSuffix, int valuesSize); static String buildSql(String rawSql, String db, String table);  }