Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery(sql.toString());
//rs.beforeFirst();
while (rs.next()) {
LoggingEvent event = new LoggingEvent();
event.setSequenceNumber(rs.getLong(1));
event.setTimeStamp(rs.getLong(2));
event.setRenderedMessage(rs.getString(3));
event.setLoggerName(rs.getString(4));
String levelStr = rs.getString(5);
// TODO CG The conversion of levelStr should be more general
Level level = Level.toLevel(levelStr);
event.setLevel(level);
event.setNDC(rs.getString(6));
event.setThreadName(rs.getString(7));
short mask = rs.getShort(8);
String fileName = rs.getString(9);
String className = rs.getString(10);
String methodName = rs.getString(11);
String lineNumber = rs.getString(12).trim();
if (fileName.equals(LocationInfo.NA)) {
event.setLocationInformation(LocationInfo.NA_LOCATION_INFO);
} else {
event.setLocationInformation(new LocationInfo(fileName, className,
methodName, lineNumber));
}
long id = rs.getLong(13);
//LogLog.info("Received event with id=" + id);
lastId = id;
// Scott asked for this info to be
event.setProperty(Constants.LOG4J_ID_KEY, Long.toString(id));
if ((mask & DBHelper.PROPERTIES_EXIST) != 0) {
getProperties(connection, id, event);
}