This week's book giveaway is in the Android forum.
We're giving away four copies of Android Programming: The Big Nerd Ranch Guide and have Bill Phillips & Chris Stewart on-line!
See this thread for details.
Win a copy of Android Programming: The Big Nerd Ranch Guide this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Number of commands in a batch  RSS feed

 
Tom Field
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All,

I use a PreparedStatemen as such: I compile a sql in the PreparedStatement. I set the parameters, Add them to the batch using addBatch() method, set the parameters, addBatch, ....
After a while I would like to see how many of these commands(the set of parameters) are currently in the batch. I mean before I execute the executeBatch method.
I would think this would be a method on PreparedStatement (or Statement), but I can't find any solution except keeping a counter for each PreparedStatement.
I don't like this very much so I was wondering if there isn't another method to achieve this.

Thanks in advance!

Greetz,
Tom
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 36875
481
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tom Field wrote:but I can't find any solution except keeping a counter for each PreparedStatement.

That's what I would do too.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doesn't the collection from which you get the parameters for setting in the preparedstatement have a method which returns the size?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!