java - Execute Batch with only one query? -


my general question is: inefficient/bad practice call preparedstatement.executebatch() if there's 1 query in batch?

i'm writing generic method java helper library execute query. there's javabean called helperquery holds list of arrays javabean called queryparameter holds type (like string, blob, int, etc.) , value. queryparameter used fill helperquery's preparedstatement. in many cases, there 1 array of queryparameters.

my specific question is: should handle things differently if there's 1 array of queryparameters or ok handle things same regardless of how many queryparameters there are?

executebatch "super" method preparedstatement's parent statement returns int[] indicates success/failure of executed queries , executequery returns resultset. therefore, idea have 2 totally different method calls developer can handle them differently. recommend:

  1. an executequery(helperquery helperquery) method return associated resultset , first queryparameters helperquery (for convenience) , method developer can specify queryparameter set use (either have them specify number of queryparameter list or pass in queryparameters explicitly (i recommend second of two)).
  2. an executebatch(helperquery helperquery method return int[] , developer can handle wish.

it's give user (developer in case) power want (but provide simple solution them perform common tasks).


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -