File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
main/java/com/clickhouse/jdbc/types
test/java/com/clickhouse/jdbc/types Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -458,7 +458,7 @@ public boolean isFirst() throws SQLException {
458458
459459 @ Override
460460 public boolean isLast () throws SQLException {
461- return pos == length - 1 ;
461+ return length > 0 && pos == length - 1 ;
462462 }
463463
464464 @ Override
Original file line number Diff line number Diff line change @@ -283,7 +283,22 @@ void testStringValues() throws SQLException {
283283 @ Test
284284 void testEmptyArray () throws SQLException {
285285 ArrayResultSet rs = new ArrayResultSet (new Object [0 ], ClickHouseColumn .parse ("v Array(Int32)" ).get (0 ));
286+
287+ Assert .assertTrue (rs .isBeforeFirst ());
288+ Assert .assertFalse (rs .isAfterLast ());
289+ Assert .assertFalse (rs .isLast ());
290+ Assert .assertFalse (rs .isFirst ());
291+
286292 assertFalse (rs .next ());
293+
294+ Assert .assertTrue (rs .isBeforeFirst ());
295+ Assert .assertFalse (rs .isAfterLast ());
296+ Assert .assertFalse (rs .isLast ());
297+ Assert .assertFalse (rs .isFirst ());
298+
299+ Assert .assertThrows (SQLException .class , () -> rs .getString ("col1" ));
300+ Assert .assertThrows (SQLException .class , () -> rs .getObject ("col1" ));
301+ Assert .assertThrows (SQLException .class , () -> rs .getInt ("col1" ));
287302 }
288303
289304 @ Test
You can’t perform that action at this time.
0 commit comments