public final DbIterator getManyBy String columnName Object value retur

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
public final DbIterator<T> getManyBy(String columnName, Object value) {
return getManyBy(columnName, value, 0, -1);
}
public final DbIterator<T> getManyBy(String columnName, Object value, int from, int to) {
Connection con = null;
try {
con = Db.getConnection();
PreparedStatement pstmt = con.prepareStatement("SELECT * FROM " + table()
+ " WHERE " + columnName + " = ?" + (multiversion ? " AND latest = TRUE " : " ") + defaultSort()
+ DbUtils.limitsClause(from, to));
if(value instanceof Long){
pstmt.setLong(1, (Long)value);
}else if(value instanceof Boolean){
pstmt.setBoolean(1, (Boolean)value);
}else if(value instanceof String){
pstmt.setString(1, (String)value);
}
DbUtils.setLimits(2, pstmt, from, to);
return getManyBy(con, pstmt, true);
} catch (SQLException e) {
DbUtils.close(con);
throw new RuntimeException(e.toString(), e);
}
}