int[] counts = new int[batchParameterValues.size()];
Arrays.fill(counts, SUCCESS_NO_INFO);
List<Object[]> generatedKeys = new ArrayList<>();
BindExecCommand command = connection.getProtocol().createBindExec(null, null, parameterTypes, Collections.emptyList(), resultFields, Object[].class);
List<Type> lastParameterTypes = null;
List<ResultField> lastResultFields = null;
for (int c = 0, sz = batchParameterValues.size(); c < sz; ++c) {
List<Type> parameterTypes = mergeTypes(batchParameterTypes.get(c), lastParameterTypes);
if (lastParameterTypes == null || !lastParameterTypes.equals(parameterTypes)) {
PrepareCommand prep = connection.getProtocol().createPrepare(null, sqlText, parameterTypes);
connection.execute(prep, true);
parameterTypes = prep.getDescribedParameterTypes();
lastParameterTypes = parameterTypes;
lastResultFields = prep.getDescribedResultFields();
}
List<Object> parameterValues = batchParameterValues.get(c);
command.setParameterTypes(parameterTypes);
command.setParameterValues(parameterValues);
SQLWarning warnings = connection.execute(command, true);
warningChain = chainWarnings(warningChain, warnings);
List<QueryCommand.ResultBatch> resultBatches = command.getResultBatches();
if (resultBatches.size() != 1) {
throw new BatchUpdateException(counts);
}
QueryCommand.ResultBatch resultBatch = resultBatches.get(0);