Different problem. I've added a test case and a fix will be in the v049. d.
2008/6/11 MAILER-DAEMON <[EMAIL PROTECTED]>: > > I think I found a bug which might be related to > http://groups.google.com/group/sqlitejdbc/browse_thread/thread/6bf9a7d5bcdd3d4e > > Starting from the example on http://www.zentus.com/sqlitejdbc/: > > Class.forName("org.sqlite.JDBC"); > Connection conn = > DriverManager.getConnection("jdbc:sqlite:test.db"); > Statement stat = conn.createStatement(); > stat.executeUpdate("drop table if exists people;"); > stat.executeUpdate("create table people (name, occupation);"); > PreparedStatement prep = conn.prepareStatement( > "insert into people values (?, ?);"); > > prep.setString(1, "Gandhi"); > prep.setString(2, "politics"); > prep.addBatch(); > prep.setString(1, "Turing"); > prep.setString(2, "computers"); > prep.addBatch(); > prep.setString(1, "Wittgenstein"); > prep.setString(2, "smartypants"); > prep.addBatch(); > > conn.setAutoCommit(false); > prep.executeBatch(); > conn.setAutoCommit(true); > > ResultSet rs = stat.executeQuery("select * from people;"); > while (rs.next()) { > System.out.println("name = " + rs.getString("name")); > System.out.println("job = " + rs.getString("occupation")); > } > > which outputs: > > name = Gandhi > job = politics > name = Turing > job = computers > name = Wittgenstein > job = smartypants > > If I comment out prep.setString(1, "Wittgenstein"); > > Class.forName("org.sqlite.JDBC"); > Connection conn = > DriverManager.getConnection("jdbc:sqlite:test.db"); > Statement stat = conn.createStatement(); > stat.executeUpdate("drop table if exists people;"); > stat.executeUpdate("create table people (name, occupation);"); > PreparedStatement prep = conn.prepareStatement( > "insert into people values (?, ?);"); > > prep.setString(1, "Gandhi"); > prep.setString(2, "politics"); > prep.addBatch(); > prep.setString(1, "Turing"); > prep.setString(2, "computers"); > prep.addBatch(); > // prep.setString(1, "Wittgenstein"); > prep.setString(2, "smartypants"); > prep.addBatch(); > > conn.setAutoCommit(false); > prep.executeBatch(); > conn.setAutoCommit(true); > > ResultSet rs = stat.executeQuery("select * from people;"); > while (rs.next()) { > System.out.println("name = " + rs.getString("name")); > System.out.println("job = " + rs.getString("occupation")); > } > > The output is: > > name = Gandhi > job = politics > name = Turing > job = computers > name = null > job = smartypants > > so it seems the string is reset after prep.addBatch() > > which is unexpected behaviour (In comparison: this behaviour is not > present in MySQL driver). > > > > --~--~---------~--~----~------------~-------~--~----~ Mailing List: http://groups.google.com/group/sqlitejdbc?hl=en To unsubscribe, send email to [EMAIL PROTECTED] -~----------~----~----~----~------~----~------~--~---
