Skip to content
Permalink
Browse files

[misc] adding coverage tests.

- statement
- ClientPrepareStatement

(cherry picked from commit e54979c)
  • Loading branch information...
rusher committed Jan 23, 2019
1 parent 7037eec commit 03046d819de0b01021a4115093f5b52021e50686
@@ -105,13 +105,11 @@ public ClientSidePreparedStatement(MariaDbConnection connection, String sql,
super(connection, resultSetScrollType, resultSetConcurrency, autoGeneratedKeys);
sqlQuery = sql;

if (prepareResult == null) {
if (options.rewriteBatchedStatements) {
prepareResult = ClientPrepareResult
.rewritableParts(sqlQuery, protocol.noBackslashEscapes());
} else {
prepareResult = ClientPrepareResult.parameterParts(sqlQuery, protocol.noBackslashEscapes());
}
if (options.rewriteBatchedStatements) {
prepareResult = ClientPrepareResult
.rewritableParts(sqlQuery, protocol.noBackslashEscapes());
} else {
prepareResult = ClientPrepareResult.parameterParts(sqlQuery, protocol.noBackslashEscapes());
}
parameters = new ParameterHolder[prepareResult.getParamCount()];
}
@@ -295,17 +293,12 @@ public void clearBatch() {

lock.lock();
try {

executeInternalBatch(size);
results.commandEnd();
return results.getCmdInformation().getUpdateCounts();

} catch (SQLException sqle) {
if (results != null) {
results.commandEnd();
throw executeBatchExceptionEpilogue(sqle, results.getCmdInformation(), size);
}
throw executeBatchExceptionEpilogue(sqle, null, size);
throw executeBatchExceptionEpilogue(sqle, size);
} finally {
executeBatchEpilogue();
lock.unlock();
@@ -342,17 +335,11 @@ public void clearBatch() {

lock.lock();
try {

executeInternalBatch(size);
results.commandEnd();
return results.getCmdInformation().getLargeUpdateCounts();

} catch (SQLException sqle) {
if (results != null) {
results.commandEnd();
throw executeBatchExceptionEpilogue(sqle, results.getCmdInformation(), size);
}
throw executeBatchExceptionEpilogue(sqle, null, size);
throw executeBatchExceptionEpilogue(sqle, size);
} finally {
executeBatchEpilogue();
lock.unlock();
@@ -366,11 +353,9 @@ public void clearBatch() {
* @throws SQLException if any error occur
*/
private void executeInternalBatch(int size) throws SQLException {

executeQueryPrologue(true);
results = new Results(this, 0, true, size, false, resultSetScrollType,
resultSetConcurrency, autoGeneratedKeys, protocol.getAutoIncrementIncrement());

resultSetConcurrency, autoGeneratedKeys, protocol.getAutoIncrementIncrement());
if (protocol
.executeBatchClient(protocol.isMasterConnection(), results, prepareResult, parameterList,
hasLongData)) {

0 comments on commit 03046d8

Please sign in to comment.
You can’t perform that action at this time.