Re: [sqlite] ResultSetMetaData with javasqlite

2009-04-30 Thread Christian Werner
Justin Deoliveira wrote:

Hi Justin,

> Thanks for the quick response. I am not sure if this will be of any help
> or not but I wrote this (very crude) patch to get around the problem:
> 
> http://files.opengeo.org/sqlite_jni.c.patch
>
> ...

Based on your patch there's now a improved version in
http://www.ch-werner.de/javasqlite

Best regards,
Christian
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] ResultSetMetaData with javasqlite

2009-04-21 Thread Justin Deoliveira
Hi Christian,

Thanks for the quick response. I am not sure if this will be of any help 
or not but I wrote this (very crude) patch to get around the problem:

http://files.opengeo.org/sqlite_jni.c.patch

I say "crude" because my C hacking skills leave something to be desired. 
That and it only handles the HAVE_SQLITE3 path, not the HAVE_SQLITE2 or 
HAVE_BOTH paths.

-Justin

Christian Werner wrote:
> Justin Deoliveira wrote:
> 
> Justin,
> 
>> I have ran into an issue while using the javasqlite jdbc wrapper.The
>> issue can be illustrated with the following code:
>> ...
> 
> you're right, I've verified that behaviour with SQLite 3.x databases.
> The problem cannot be observed with SQLite 2.x databases.
> 
>> 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?
> 
> Unintended consequences but present since the initial support
> for SQLite 3.x in 2004. Thus let's call it a misfeature. I'm
> working on a solution.
> 
> Best regards,
> Christian
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


-- 
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


Re: [sqlite] ResultSetMetaData with javasqlite

2009-04-21 Thread Christian Werner
Justin Deoliveira wrote:

Justin,

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

you're right, I've verified that behaviour with SQLite 3.x databases.
The problem cannot be observed with SQLite 2.x databases.

> 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?

Unintended consequences but present since the initial support
for SQLite 3.x in 2004. Thus let's call it a misfeature. I'm
working on a solution.

Best regards,
Christian
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] ResultSetMetaData with javasqlite

2009-04-20 Thread Justin Deoliveira
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