Java Code Examples for com.mysql.cj.jdbc.exceptions.SQLError#createBatchUpdateException()

The following examples show how to use com.mysql.cj.jdbc.exceptions.SQLError#createBatchUpdateException() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StatementImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
protected SQLException handleExceptionForBatch(int endOfBatchIndex, int numValuesPerBatch, long[] updateCounts, SQLException ex)
        throws BatchUpdateException, SQLException {
    for (int j = endOfBatchIndex; j > endOfBatchIndex - numValuesPerBatch; j--) {
        updateCounts[j] = EXECUTE_FAILED;
    }

    if (this.continueBatchOnError && !(ex instanceof MySQLTimeoutException) && !(ex instanceof MySQLStatementCancelledException)
            && !hasDeadlockOrTimeoutRolledBackTx(ex)) {
        return ex;
    } // else: throw the exception immediately

    long[] newUpdateCounts = new long[endOfBatchIndex];
    System.arraycopy(updateCounts, 0, newUpdateCounts, 0, endOfBatchIndex);

    throw SQLError.createBatchUpdateException(ex, newUpdateCounts, getExceptionInterceptor());
}
 
Example 2
Source File: StatementImpl.java    From FoxTelem with GNU General Public License v3.0 6 votes vote down vote up
protected SQLException handleExceptionForBatch(int endOfBatchIndex, int numValuesPerBatch, long[] updateCounts, SQLException ex)
        throws BatchUpdateException, SQLException {
    for (int j = endOfBatchIndex; j > endOfBatchIndex - numValuesPerBatch; j--) {
        updateCounts[j] = EXECUTE_FAILED;
    }

    if (this.continueBatchOnError && !(ex instanceof MySQLTimeoutException) && !(ex instanceof MySQLStatementCancelledException)
            && !hasDeadlockOrTimeoutRolledBackTx(ex)) {
        return ex;
    } // else: throw the exception immediately

    long[] newUpdateCounts = new long[endOfBatchIndex];
    System.arraycopy(updateCounts, 0, newUpdateCounts, 0, endOfBatchIndex);

    throw SQLError.createBatchUpdateException(ex, newUpdateCounts, getExceptionInterceptor());
}