org.drizzle.jdbc.internal.common
Class RewriteParameterizedBatchHandler

java.lang.Object
  extended by org.drizzle.jdbc.internal.common.RewriteParameterizedBatchHandler
All Implemented Interfaces:
ParameterizedBatchHandler

public class RewriteParameterizedBatchHandler
extends java.lang.Object
implements ParameterizedBatchHandler

Rewrites queries on the form (INSERT INTO xyz (a,b,c) VALUES (?,?,?))* to INSERT INTO xyz (a,b,c) VALUES ((?,?,?),)*


Constructor Summary
RewriteParameterizedBatchHandler(Protocol protocol, java.lang.String baseQuery, java.lang.String queryValuePart, java.lang.String onDupKeyPart)
          Constructs a new handler
 
Method Summary
 void addToBatch(ParameterizedQuery query)
          called when a set of parameters are added to a batch.
 int[] executeBatch()
          execute the batch using protocol.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RewriteParameterizedBatchHandler

public RewriteParameterizedBatchHandler(Protocol protocol,
                                        java.lang.String baseQuery,
                                        java.lang.String queryValuePart,
                                        java.lang.String onDupKeyPart)
Constructs a new handler

Parameters:
protocol - the protocol to use to send the query.
baseQuery - the base of the query, i.e. everything including .*VALUES
queryValuePart - the value part (?,?..)
onDupKeyPart - the duplicate key part of the query
Method Detail

addToBatch

public void addToBatch(ParameterizedQuery query)
Description copied from interface: ParameterizedBatchHandler
called when a set of parameters are added to a batch.

Specified by:
addToBatch in interface ParameterizedBatchHandler
Parameters:
query - the parameterized query.

executeBatch

public int[] executeBatch()
                   throws QueryException
Description copied from interface: ParameterizedBatchHandler
execute the batch using protocol. Return an array of update counts or -2 (Statement.SUCCESS_NO_INFO) if the update count is unknown.

Specified by:
executeBatch in interface ParameterizedBatchHandler
Returns:
a list of update counts
Throws:
QueryException - if something goes wrong executing the query.


Copyright © 2012. All Rights Reserved.