I'm trying to use v048 nested, and am getting the ResultSet closed
exception when a ResultSet has no rows:

java.sql.SQLException: ResultSet closed
        at org.sqlite.RS.checkOpen(RS.java:57)
        at org.sqlite.RS.findColumn(RS.java:99)
        at org.sqlite.RS.getInt(RS.java:228)
        at Test.main(Test.java:27)

But RS.getRow() returns 1 - is this a bug? Am I doing something wrong?

Below is my test:

import java.sql.*;

public class Test {
    public static void main(String[] args) {
        Connection conn = null;
        try {
            Class.forName("org.sqlite.JDBC");
            conn = DriverManager.getConnection("jdbc:sqlite:foo.db");
            Statement stat = conn.createStatement();
            stat.executeUpdate("CREATE TABLE foo (id integer primary
key autoincrement not null, t integer, bar text)");
            stat.executeUpdate("INSERT INTO foo (t, bar) VALUES (1,
'baz')");
            stat.close();

            PreparedStatement stat = conn.prepareStatement("SELECT *
FROM foo WHERE t = 2");
            ResultSet rs = stat.executeQuery();
            System.out.println("rs.getRow(): " + rs.getRow());
            if (rs.getRow() == 0) {
                System.out.println("NO ROWS!");
            } else {
                int ret = rs.getInt("bar");
                System.out.println("got ret: " + ret);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

--~--~---------~--~----~------------~-------~--~----~
Mailing List: http://groups.google.com/group/sqlitejdbc?hl=en
To unsubscribe, send email to [EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---

Reply via email to