Class Sqlca

java.lang.Object
org.apache.derby.client.am.Sqlca
Direct Known Subclasses:
NetSqlca

public abstract class Sqlca extends Object
  • Field Details

    • HIGH_ORDER_ROW_COUNT

      private static final int HIGH_ORDER_ROW_COUNT
      See Also:
    • LOW_ORDER_ROW_COUNT

      private static final int LOW_ORDER_ROW_COUNT
      See Also:
    • LOW_ORDER_UPDATE_COUNT

      private static final int LOW_ORDER_UPDATE_COUNT
      See Also:
    • HIGH_ORDER_UPDATE_COUNT

      private static final int HIGH_ORDER_UPDATE_COUNT
      See Also:
    • SQL_ERR_LENGTH

      public static final int SQL_ERR_LENGTH
      See Also:
    • connection_

      private transient ClientConnection connection_
    • exceptionThrownOnStoredProcInvocation_

      SqlException exceptionThrownOnStoredProcInvocation_
    • messageTextRetrievedContainsTokensOnly_

      boolean messageTextRetrievedContainsTokensOnly_
    • sqlCode_

      protected int sqlCode_
    • sqlErrmc_

      private String sqlErrmc_
      A string representation of sqlErrmcBytes_.
    • sqlErrmcMessages_

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

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

      private String sqlErrp_
    • sqlErrd_

      protected int[] sqlErrd_
    • sqlWarn_

      private String sqlWarn_
    • sqlState_

      protected 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 String[] cachedMessages
      Cached error messages (to prevent multiple invocations of the stored procedure to get the same message).
    • elevenBlanks

      private static final String elevenBlanks
      See Also:
  • Constructor Details

  • Method Details

    • 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:
    • getSqlErrmc

      public String getSqlErrmc()
    • initSqlErrmcMessages

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

      public String getSqlErrp()
    • getSqlErrd

      private int[] getSqlErrd()
    • formatSqlErrd

      String formatSqlErrd()
    • getSqlWarn

      public String getSqlWarn()
    • getSqlState

      public String getSqlState()
    • getSqlState

      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 Object[] getArgs(int messageNumber)
    • getMessage

      private String getMessage(int messageNumber) throws SqlException
      Throws:
      SqlException
    • getJDBCMessage

      String getJDBCMessage(int messageNumber)
    • getUnformattedMessage

      private 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

      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 String bytes2String(byte[] bytes, int offset, int length)
    • getUpdateCount

      public long getUpdateCount()
    • getRowCount

      public long getRowCount() throws DisconnectException
      Throws:
      DisconnectException
    • setContainsSqlcax

      public void setContainsSqlcax(boolean containsSqlcax)
    • containsSqlcax

      public boolean containsSqlcax()
    • resetRowsetSqlca

      public void resetRowsetSqlca(ClientConnection connection, int sqlCode, String sqlState)
    • setRowsetRowCount

      public void setRowsetRowCount(long rowCount)
    • getRowsetRowCount

      public long getRowsetRowCount()