From a0fe44019e1cfbba3a6def6f0f4e5419d07f6c75 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Tue, 6 Sep 2011 21:35:32 +0000 Subject: [PATCH] Fixed table resizing bug --- core/src/processing/core/Table.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/src/processing/core/Table.java b/core/src/processing/core/Table.java index 4abbe7ca3..24059f34b 100644 --- a/core/src/processing/core/Table.java +++ b/core/src/processing/core/Table.java @@ -180,17 +180,19 @@ public class Table implements Iterable { } } + int row = 0; while (rs.next()) { for (int col = 0; col < columnCount; col++) { switch (columnTypes[col]) { - case STRING: setString(rowCount, col, rs.getString(col+1)); break; - case INT: setInt(rowCount, col, rs.getInt(col+1)); break; - case LONG: setLong(rowCount, col, rs.getLong(col+1)); break; - case FLOAT: setFloat(rowCount, col, rs.getFloat(col+1)); break; - case DOUBLE: setDouble(rowCount, col, rs.getDouble(col+1)); break; + case STRING: setString(row, col, rs.getString(col+1)); break; + case INT: setInt(row, col, rs.getInt(col+1)); break; + case LONG: setLong(row, col, rs.getLong(col+1)); break; + case FLOAT: setFloat(row, col, rs.getFloat(col+1)); break; + case DOUBLE: setDouble(row, col, rs.getDouble(col+1)); break; default: throw new IllegalArgumentException("column type " + columnTypes[col] + " not supported."); } } + row++; // String[] row = new String[columnCount]; // for (int col = 0; col < columnCount; col++) { // row[col] = rs.getString(col + 1);