Hi all,

I have ran into an issue while using the javasqlite jdbc wrapper.        The 
issue can be illustrated with the following code:

import java.sql.*;

public class Main {

   public static void main( String[] args ) throws Exception {

     Class.forName( "SQLite.JDBCDriver");
     Connection cx = DriverManager.getConnection("jdbc:sqlite:/foo.db");

     Statement st = cx.createStatement();
     st.execute( "DROP TABLE IF EXISTS t1");
     st.execute( "DROP TABLE IF EXISTS t2");
     st.execute( "CREATE TABLE t1 (a int, b varchar)");
     st.execute( "CREATE TABLE t2 (a int, b varchar)");
     st.execute( "INSERT INTO t1 VALUES (1,'one')");

     ResultSet rs = st.executeQuery("SELECT * FROM t1");
     ResultSetMetaData md = rs.getMetaData();
     System.out.println("Number of columns t1 = " + md.getColumnCount());
     rs.close();

     rs = st.executeQuery("SELECT * FROM t2");
     md = rs.getMetaData();
     System.out.println("Number of columns t2 = " + md.getColumnCount());
     rs.close();

     st.close();
   }
}

Basically it seems that the result set metdata is not properly 
initialized when a query returns no rows.

I guess my question is is this a bug or is it intended behavior?

Implementing a similar program with the C api I am able to get the 
proper count of columns back so I would assume a bug.

I should note that I am running javasqlite 20090409 with sqlite 3.6.12 
on mac os x leopard.

Thanks,

-Justin

-- 
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to