com.mysql.cj.exceptions.StreamingNotifiable Java Examples

The following examples show how to use com.mysql.cj.exceptions.StreamingNotifiable. 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: MySQLJDBCReflections.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep
void registerExceptionsForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, CJCommunicationsException.class.getName()));
    reflectiveClass
            .produce(new ReflectiveClassBuildItem(false, false, CJConnectionFeatureNotAvailableException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, CJOperationNotSupportedException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, CJTimeoutException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, CJPacketTooBigException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, CJException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, AssertionFailedException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, CJOperationNotSupportedException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, ClosedOnExpiredPasswordException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, ConnectionIsClosedException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, DataConversionException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, DataReadException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, DataTruncationException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, DeadlockTimeoutRollbackMarker.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, FeatureNotAvailableException.class.getName()));
    reflectiveClass
            .produce(new ReflectiveClassBuildItem(false, false, InvalidConnectionAttributeException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, NumberOutOfRange.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, OperationCancelledException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, PasswordExpiredException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, PropertyNotModifiableException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, RSAException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, SSLParamsException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, StatementIsClosedException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, StreamingNotifiable.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, UnableToConnectException.class.getName()));
    reflectiveClass
            .produce(new ReflectiveClassBuildItem(false, false, UnsupportedConnectionStringException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, WrongArgumentException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, "com.mysql.cj.jdbc.MysqlXAException"));
    reflectiveClass
            .produce(new ReflectiveClassBuildItem(false, false, StandardLoadBalanceExceptionChecker.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, NdbLoadBalanceExceptionChecker.class.getName()));
}
 
Example #2
Source File: ResultsetRowsStreaming.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public Row next() {
    try {
        if (!this.noMoreRows) {
            this.nextRow = this.protocol.read(ResultsetRow.class, this.rowFactory);

            if (this.nextRow == null) {
                this.noMoreRows = true;
                this.isAfterEnd = true;

                if (this.currentPositionInFetchedRows == -1) {
                    this.wasEmpty = true;
                }
            }
        } else {
            this.nextRow = null;
            this.isAfterEnd = true;
        }

        if (this.nextRow == null && !this.streamerClosed) {
            if (this.protocol.getServerSession().hasMoreResults()) {
                this.protocol.readNextResultset((T) this.owner, this.owner.getOwningStatementMaxRows(), true, this.isBinaryEncoded, this.resultSetFactory);

            } else {
                this.protocol.closeStreamer(this);
                this.streamerClosed = true;
            }
        }

        if (this.nextRow != null) {
            if (this.currentPositionInFetchedRows != Integer.MAX_VALUE) {
                this.currentPositionInFetchedRows++;
            }
        }

        return this.nextRow;

    } catch (CJException sqlEx) {

        if (sqlEx instanceof StreamingNotifiable) {
            ((StreamingNotifiable) sqlEx).setWasStreamingResults();
        }

        // There won't be any more rows
        this.noMoreRows = true;

        // don't wrap SQLExceptions
        throw sqlEx;
    } catch (Exception ex) {
        String exceptionType = ex.getClass().getName();
        String exceptionMessage = ex.getMessage();

        exceptionMessage += Messages.getString("RowDataDynamic.7");
        exceptionMessage += Util.stackTraceToString(ex);

        CJException cjEx = ExceptionFactory.createException(
                Messages.getString("RowDataDynamic.8") + exceptionType + Messages.getString("RowDataDynamic.9") + exceptionMessage, ex,
                this.exceptionInterceptor);

        throw cjEx;
    }
}
 
Example #3
Source File: ResultsetRowsStreaming.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public Row next() {
    try {
        if (!this.noMoreRows) {
            this.nextRow = this.protocol.read(ResultsetRow.class, this.rowFactory);

            if (this.nextRow == null) {
                this.noMoreRows = true;
                this.isAfterEnd = true;

                if (this.currentPositionInFetchedRows == -1) {
                    this.wasEmpty = true;
                }
            }
        } else {
            this.nextRow = null;
            this.isAfterEnd = true;
        }

        if (this.nextRow == null && !this.streamerClosed) {
            if (this.protocol.getServerSession().hasMoreResults()) {
                this.protocol.readNextResultset((T) this.owner, this.owner.getOwningStatementMaxRows(), true, this.isBinaryEncoded, this.resultSetFactory);

            } else {
                this.protocol.closeStreamer(this);
                this.streamerClosed = true;
            }
        }

        if (this.nextRow != null) {
            if (this.currentPositionInFetchedRows != Integer.MAX_VALUE) {
                this.currentPositionInFetchedRows++;
            }
        }

        return this.nextRow;

    } catch (CJException sqlEx) {

        if (sqlEx instanceof StreamingNotifiable) {
            ((StreamingNotifiable) sqlEx).setWasStreamingResults();
        }

        // There won't be any more rows
        this.noMoreRows = true;

        // don't wrap SQLExceptions
        throw sqlEx;
    } catch (Exception ex) {
        String exceptionType = ex.getClass().getName();
        String exceptionMessage = ex.getMessage();

        exceptionMessage += Messages.getString("RowDataDynamic.7");
        exceptionMessage += Util.stackTraceToString(ex);

        CJException cjEx = ExceptionFactory.createException(
                Messages.getString("RowDataDynamic.8") + exceptionType + Messages.getString("RowDataDynamic.9") + exceptionMessage, ex,
                this.exceptionInterceptor);

        throw cjEx;
    }
}