Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Bug in sqlite-jdbc-3.6.4.1: Statement.executeBatch() does not clear command batch
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
MAILER-DAEMON  
View profile  
 More options Nov 11 2008, 8:18 am
From: MAILER-DAEMON <thenl...@gmail.com>
Date: Tue, 11 Nov 2008 05:18:26 -0800 (PST)
Local: Tues, Nov 11 2008 8:18 am
Subject: Bug in sqlite-jdbc-3.6.4.1: Statement.executeBatch() does not clear command batch
Hi,

I found the following code does not work as expected:

stat.executeUpdate("drop table if exists t;");
stat.executeUpdate("create table t (c text);");
prep = conn.prepareStatement("insert into t values (?);");
prep.setString(1, "a");
prep.addBatch();
System.out.println("call 1: " + prep.executeBatch().length);
prep.setString(1, "b");
prep.addBatch();
System.out.println("call 2: " + prep.executeBatch().length);

rs = stat.executeQuery("select * from t;");

while (rs.next())
    System.out.println(rs.getString(1));

Output:
call 1: 1
call 2: 2
a
a
b

The expected result (and what I get with MySQL driver) would be:
call 1: 1
call 2: 1
a
b

That is, the call to executeBatch() should delete the commands in the
batch and not execute them again on the next call.

Regards,
  Thomas.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Taro L. Saito  
View profile  
 More options Nov 16 2008, 7:04 pm
From: "Taro L. Saito" <l...@xerial.org>
Date: Sun, 16 Nov 2008 16:04:54 -0800 (PST)
Local: Sun, Nov 16 2008 7:04 pm
Subject: Re: Bug in sqlite-jdbc-3.6.4.1: Statement.executeBatch() does not clear command batch
Hi,

I am not sure which behavior is truely expected in the JDBC
specification:
http://java.sun.com/j2se/1.3/docs/guide/jdbc/spec2/jdbc2.1.frame6.htm...

However, it seems that each call of executeBatch() method do the
updates
to the database, so the first result makes sense to me in that
it correctly returns the number of SQL queries executed.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Taro L. Saito  
View profile  
 More options Nov 16 2008, 7:43 pm
From: "Taro L. Saito" <l...@xerial.org>
Date: Sun, 16 Nov 2008 16:43:11 -0800 (PST)
Local: Sun, Nov 16 2008 7:43 pm
Subject: Re: Bug in sqlite-jdbc-3.6.4.1: Statement.executeBatch() does not clear command batch
Hi Thomas,

It seems that you are correct. I found the following part in the JDBC
document:
http://java.sun.com/j2se/1.3/docs/guide/jdbc/spec2/jdbc2.1.frame6.htm...

- The statement's internal list of batch elements is reset to empty
once executeBatch() returns.

The executeBatch() method has to clear the internal list after the
execution.

However, I cannot find any description in JDBC API about the state of
the batch after the execution.. umm
http://java.sun.com/j2se/1.3/docs/api/java/sql/Statement.html#execute...()

Anyway, I'd like to fix the bug, but I have no time to do this for a
couple of weeks..

Thanks for your report.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
julianbui  
View profile  
 More options Dec 8 2008, 2:53 pm
From: julianbui <julian...@gmail.com>
Date: Mon, 8 Dec 2008 11:53:52 -0800 (PST)
Local: Mon, Dec 8 2008 2:53 pm
Subject: Re: Bug in sqlite-jdbc-3.6.4.1: Statement.executeBatch() does not clear command batch
Also found the same thing.  I had to close the PS and create a new
one.  This is slightly different than the other jdbc usages I've seen.

On Nov 11, 5:18 am, MAILER-DAEMON <thenl...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google