use of org.apache.ignite.internal.processors.odbc.jdbc.JdbcBatchExecuteResult in project ignite by apache.
the class JdbcThinConnection method executeBatch.
/**
* @param lastBatch Whether open data streamers must be flushed and closed after this batch.
* @throws SQLException if failed.
*/
private void executeBatch(boolean lastBatch) throws SQLException {
JdbcBatchExecuteResult res = sendRequest(new JdbcBatchExecuteRequest(schema, streamBatch, lastBatch));
streamBatch = null;
lastStreamQry = null;
if (res.errorCode() != ClientListenerResponse.STATUS_SUCCESS) {
throw new BatchUpdateException(res.errorMessage(), IgniteQueryErrorCode.codeToSqlState(res.errorCode()), res.errorCode(), res.updateCounts());
}
}
use of org.apache.ignite.internal.processors.odbc.jdbc.JdbcBatchExecuteResult in project ignite by apache.
the class JdbcThinStatement method executeBatch.
/**
* {@inheritDoc}
*/
@Override
public int[] executeBatch() throws SQLException {
ensureNotClosed();
closeResults();
checkStatementBatchEmpty();
if (conn.isStream()) {
int[] res = new int[batchSize];
batchSize = 0;
return res;
}
if (F.isEmpty(batch))
return new int[0];
JdbcBatchExecuteRequest req = new JdbcBatchExecuteRequest(conn.getSchema(), batch, conn.getAutoCommit(), false);
try {
JdbcBatchExecuteResult res = conn.sendRequest(req, this, null).response();
if (res.errorCode() != ClientListenerResponse.STATUS_SUCCESS) {
throw new BatchUpdateException(res.errorMessage(), IgniteQueryErrorCode.codeToSqlState(res.errorCode()), res.errorCode(), res.updateCounts());
}
return res.updateCounts();
} finally {
batchSize = 0;
batch = null;
}
}
Aggregations