Commit d46ad112 authored by Matija Obreza's avatar Matija Obreza

Fixed row-skipping bug in JdbcRowReader

parent 8bb81c27
......@@ -26,8 +26,11 @@ import java.util.List;
import org.genesys2.anno.model.DatabaseSettings;
import org.genesys2.anno.util.ConnectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class JdbcRowReader implements RowReader {
private static final Logger _log = LoggerFactory.getLogger(JdbcRowReader.class);
private Connection conn = null;
private String query;
......@@ -62,7 +65,7 @@ public class JdbcRowReader implements RowReader {
List<Object[]> rows = new ArrayList<Object[]>(rowsToRead);
int rowCount = 0;
while (res.next() && rowCount < rowsToRead) {
while ((rowCount < rowsToRead) && res.next()) {
List<Object> row = new ArrayList<Object>();
for (int i = 1; i <= columnCount; i++) {
Object val = res.getObject(i);
......@@ -72,6 +75,7 @@ public class JdbcRowReader implements RowReader {
rowCount++;
this.rowCount++;
}
_log.debug("Read {} rows from JDBC source.", this.rowCount);
return rows;
} catch (Throwable e) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment