* @see org.apache.log4j.jdbc.JDBCAppender#getLogStatement(org.apache.log4j.spi.LoggingEvent)
*/
@Override
public String getLogStatement(LoggingEvent event) {
LogMessage message = (LogMessage) event.getMessage();
if (!wroteRunInformation) {
writeRunInformation(getRunID(descriptor, getConnection()), getConnection());
}
PreparedStatement prepStat = getPreparedStatement();
int index = 0;
try {
if (descriptor.isAddRunID()) {
prepStat.setInt(++index, getRunID(descriptor, getConnection()));
}
Iterator<String> columns = descriptor.getColumns().iterator();
while (columns.hasNext()) {
String column = columns.next();
addToPrepStatet(prepStat, ++index, message.get(column));
}
prepStat.addBatch();
if (descriptor.getWriteCacheInterval() == cached) {
// the number of records to cache is reached -> execute statement