public void executeBatchMultiple(boolean mustExecuteOnMaster,ExecutionResult executionResult,final List<String> queries,int resultSetScrollType) throws QueryException {
  cmdPrologue();
  String firstSql=null;
  int currentIndex=0;
  int totalQueries=queries.size();
  QueryException exception=null;
  do {
    try {
      firstSql=queries.get(currentIndex++);
      if (totalQueries == 1) {
        writer.send(firstSql,Packet.COM_QUERY);
      }
 else {
        currentIndex=ComExecute.sendMultiple(writer,firstSql,queries,currentIndex);
      }
      getResult(executionResult,resultSetScrollType,false,true);
    }
 catch (    QueryException queryException) {
      addQueryInfo(firstSql,queryException);
      if (!getOptions().continueBatchOnError)       throw queryException;
      if (exception == null)       exception=queryException;
    }
catch (    MaxAllowedPacketException e) {
      if (e.isMustReconnect())       connect();
      throw new QueryException("Could not send query: " + e.getMessage(),-1,INTERRUPTED_EXCEPTION.getSqlState(),e);
    }
catch (    IOException e) {
      throw new QueryException("Could not send query: " + e.getMessage(),-1,CONNECTION_EXCEPTION.getSqlState(),e);
    }
 finally {
      writer.releaseBufferIfNotLogging();
    }
  }
 while (currentIndex < totalQueries);
  if (exception != null)   throw exception;
}

public void executeBatchMultiple ( boolean mustExecuteOnMaster , ExecutionResult executionResult , final List < String > queries , int resultSetScrollType ) throws QueryException { cmdPrologue ( ) ; String firstSql = null ; int currentIndex = 0 ; int totalQueries = queries . size ( ) ; QueryException exception = null ; do { try { firstSql = queries . get ( currentIndex ++ ) ; if ( totalQueries == 1 ) { writer . send ( firstSql , Packet . COM_QUERY ) ; } else { currentIndex = ComExecute . sendMultiple ( writer , firstSql , queries , currentIndex ) ; } getResult ( executionResult , resultSetScrollType , false , true ) ; } catch ( QueryException queryException ) { addQueryInfo ( firstSql , queryException ) ; if ( ! getOptions ( ) . continueBatchOnError ) throw queryException ; if ( exception == null ) exception = queryException ; } catch ( MaxAllowedPacketException e ) { if ( e . isMustReconnect ( ) ) connect ( ) ; throw new QueryException ( "Could not send query: " + e . getMessage ( ) , - 1 , INTERRUPTED_EXCEPTION . getSqlState ( ) , e ) ; } catch ( IOException e ) { throw new QueryException ( "Could not send query: " + e . getMessage ( ) , - 1 , CONNECTION_EXCEPTION . getSqlState ( ) , e ) ; } finally { writer . releaseBufferIfNotLogging ( ) ; } } while ( currentIndex < totalQueries ) ; if ( exception != null ) throw exception ; }
execute list of queries . this method is used when using text batch statement and using rewriting ( allowmultiqueries | | rewritebatchedstatements ) . queries will be send to server according to max_allowed_packet size .
