Class Sqlca

  • Direct Known Subclasses:
    NetSqlca

    public abstract class Sqlca
    extends java.lang.Object
    • Field Detail

      • LOW_ORDER_UPDATE_COUNT

        private static final int LOW_ORDER_UPDATE_COUNT
        See Also:
        Constant Field Values
      • HIGH_ORDER_UPDATE_COUNT

        private static final int HIGH_ORDER_UPDATE_COUNT
        See Also:
        Constant Field Values
      • exceptionThrownOnStoredProcInvocation_

        SqlException exceptionThrownOnStoredProcInvocation_
      • messageTextRetrievedContainsTokensOnly_

        boolean messageTextRetrievedContainsTokensOnly_
      • sqlCode_

        protected int sqlCode_
      • sqlErrmc_

        private java.lang.String sqlErrmc_
        A string representation of sqlErrmcBytes_.
      • sqlErrmcMessages_

        private java.lang.String[] sqlErrmcMessages_
        Array of errmc strings for each message in the chain.
      • sqlStates_

        private java.lang.String[] sqlStates_
        SQL states for all the messages in the exception chain.
      • sqlErrp_

        private java.lang.String sqlErrp_
      • sqlErrd_

        protected int[] sqlErrd_
      • sqlWarn_

        private java.lang.String sqlWarn_
      • sqlState_

        protected java.lang.String sqlState_
      • sqlErrmcBytes_

        protected byte[] sqlErrmcBytes_
      • sqlErrpBytes_

        protected byte[] sqlErrpBytes_
      • sqlWarnBytes_

        protected byte[] sqlWarnBytes_
      • containsSqlcax_

        private boolean containsSqlcax_
      • rowsetRowCount_

        private long rowsetRowCount_
      • returnTokensOnlyInMessageText_

        private boolean returnTokensOnlyInMessageText_
      • agent_

        private final transient Agent agent_
      • cachedMessages

        private java.lang.String[] cachedMessages
        Cached error messages (to prevent multiple invocations of the stored procedure to get the same message).
    • Method Detail

      • returnTokensOnlyInMessageText

        void returnTokensOnlyInMessageText​(boolean returnTokensOnlyInMessageText)
      • numberOfMessages

        int numberOfMessages()
        Returns the number of messages this SQLCA contains.
        Returns:
        number of messages
      • getSqlCode

        public int getSqlCode()
      • getErrorCode

        public int getErrorCode()

        Get the error code based on the SQL code received from the server.

        The conversion from SQL code to error code happens like this:

        • If the SQL code is 0, there is no error code because the Sqlca doesn't represent an error. Return 0.
        • If the SQL code is positive, the Sqlca represents a warning, and the SQL code represents the actual error code. Return the SQL code.
        • If the SQL code is negative, the Sqlca represents an error, and the error code is -(sqlCode+1).
        See Also:
        DRDAConnThread.getSqlCode(java.sql.SQLException)
      • getSqlErrmc

        public java.lang.String getSqlErrmc()
      • initSqlErrmcMessages

        private void initSqlErrmcMessages()
        Initialize and build the arrays sqlErrmcMessages_ and sqlStates_.
      • getSqlErrp

        public java.lang.String getSqlErrp()
      • getSqlErrd

        private int[] getSqlErrd()
      • formatSqlErrd

        java.lang.String formatSqlErrd()
      • getSqlWarn

        public java.lang.String getSqlWarn()
      • getSqlState

        public java.lang.String getSqlState()
      • getSqlState

        java.lang.String getSqlState​(int messageNumber)
        Get the SQL state for a given error.
        Parameters:
        messageNumber - the error to retrieve SQL state for
        Returns:
        SQL state for the error
      • getArgs

        public java.lang.Object[] getArgs​(int messageNumber)
      • getJDBCMessage

        java.lang.String getJDBCMessage​(int messageNumber)
      • getUnformattedMessage

        private java.lang.String getUnformattedMessage​(int messageNumber)
        Get the unformatted message text (in case we cannot ask the server).
        Parameters:
        messageNumber - which message number to get the text for
        Returns:
        string with details about the error
      • chainDeferredExceptionsToAgentOrAsConnectionWarnings

        private void chainDeferredExceptionsToAgentOrAsConnectionWarnings​(SqlException e)
      • getDataTruncation

        java.sql.DataTruncation getDataTruncation()
        Get a java.sql.DataTruncation warning based on the information in this SQLCA.
        Returns:
        a java.sql.DataTruncation instance
      • processSqlErrmcTokens

        private void processSqlErrmcTokens​(byte[] tokenBytes)
      • bytes2String

        protected java.lang.String bytes2String​(byte[] bytes,
                                                int offset,
                                                int length)
      • getUpdateCount

        public long getUpdateCount()
      • setContainsSqlcax

        public void setContainsSqlcax​(boolean containsSqlcax)
      • containsSqlcax

        public boolean containsSqlcax()
      • resetRowsetSqlca

        public void resetRowsetSqlca​(ClientConnection connection,
                                     int sqlCode,
                                     java.lang.String sqlState)
      • setRowsetRowCount

        public void setRowsetRowCount​(long rowCount)
      • getRowsetRowCount

        public long getRowsetRowCount()