1. Taro L. Saito
  2. sqlite-jdbc
  3. Issues
Issue #65 resolved

Calling Statement.setMaxRows(N) has the effect of returning N+1 rows

Lukas Eder
created an issue

I'm running jOOQ integration tests against the Xerial driver and I've found a couple of bugs, which I'm reporting here. I have detected these bugs with the downloaded version 3.7.15-SNAPSHOT-2.

Run this Java program

Connection c = getConnection();
Statement s = c.createStatement();
ResultSet r = s.executeQuery(
    "select 1 union select 2 union select 3 order by 1");
assertEquals(1, r.getInt(1));
assertFalse(r.next()); // This fails

In fact, setting max rows to 1 (N) has the effect of returning 2 (N+1) rows, as can be shown with this alternative program:

while (r.next())