Package com.salesforce.phoenix.exception

Examples of com.salesforce.phoenix.exception.SQLExceptionCode


        // In that case, we might get an error that a curr value was done on a sequence
        // before a next val was. Not sure how to prevent that.
        if (result.raw().length == 1) {
            KeyValue errorKV = result.raw()[0];
            int errorCode = PDataType.INTEGER.getCodec().decodeInt(errorKV.getBuffer(), errorKV.getValueOffset(), null);
            SQLExceptionCode code = SQLExceptionCode.fromErrorCode(errorCode);
            // TODO: We could have the server return the timestamps of the
            // delete markers and we could insert them here, but this seems
            // like overkill.
            // if (code == SQLExceptionCode.SEQUENCE_UNDEFINED) {
            // }
View Full Code Here


                throw new EmptySequenceCacheException(key.getSchemaName(),key.getSequenceName());
            }
            value.nextValue = value.currentValue;
            return true;
        }
        SQLExceptionCode code = SQLExceptionCode.fromErrorCode(statusCode);
        // TODO: We could have the server return the timestamps of the
        // delete markers and we could insert them here, but this seems
        // like overkill.
        // if (code == SQLExceptionCode.SEQUENCE_UNDEFINED) {
        // }
View Full Code Here

        if (statusCode == 0) {  // Success - add sequence value and return timestamp
            SequenceValue value = new SequenceValue(timestamp);
            insertSequenceValue(value);
            return timestamp;
        }
        SQLExceptionCode code = SQLExceptionCode.fromErrorCode(statusCode);
        throw new SQLExceptionInfo.Builder(code)
            .setSchemaName(key.getSchemaName())
            .setTableName(key.getSequenceName())
            .build().buildException();
    }
View Full Code Here

    public long dropSequence(Result result) throws SQLException {
        KeyValue statusKV = result.raw()[0];
        long timestamp = statusKV.getTimestamp();
        int statusCode = PDataType.INTEGER.getCodec().decodeInt(statusKV.getBuffer(), statusKV.getValueOffset(), null);
        SQLExceptionCode code = statusCode == 0 ? null : SQLExceptionCode.fromErrorCode(statusCode);
        if (code == null) {
            // Insert delete marker so that point-in-time sequences work
            insertSequenceValue(new SequenceValue(timestamp, true));
            return timestamp;
        }
View Full Code Here

        } else {
            // Not a DoNotRetryIOException, IOException or SQLException. Map the exception type to a general SQLException
            // and construct the error message so it can be reconstruct on the client side.
            //
            // If no mapping exists, rethrow it as a generic exception.
            SQLExceptionCode code = errorcodeMap.get(t.getClass());
            if (code == null) {
                throw new DoNotRetryIOException(msg + ": " + t.getMessage(), t);
            } else {
                throw new DoNotRetryIOException(constructSQLErrorMessage(code, t, msg), t);
            }
View Full Code Here

public class SchemaUtilTest {

    @Test
    public void testExceptionCode() throws Exception {
        SQLExceptionCode code = SQLExceptionCode.fromErrorCode(SQLExceptionCode.AGGREGATE_IN_GROUP_BY.getErrorCode());
        assertEquals(SQLExceptionCode.AGGREGATE_IN_GROUP_BY, code);
    }
View Full Code Here

TOP

Related Classes of com.salesforce.phoenix.exception.SQLExceptionCode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.