Top Fields Constructors Methods
org.apache.derby.client.am

public abstract Class Sqlca

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.derby.client.net.NetSqlca
Imports
java.sql.DataTruncation, .Types, java.util.Locale, org.apache.derby.client.net.Typdef, org.apache.derby.shared.common.error.ExceptionSeverity, .MessageUtils, org.apache.derby.shared.common.reference.SQLState

Field Summary

Modifier and TypeField and Description
private final transient Agent
private String[]
cachedMessages

Cached error messages (to prevent multiple invocations of the stored procedure to get the same message).

private transient ClientConnection
private boolean
private static final String
pack-priv SqlException
private static final int
private static final int
private static final int
private static final int
pack-priv boolean
private boolean
private long
public static final int
protected int
protected int[]
private String
sqlErrmc_

A string representation of sqlErrmcBytes_.

protected byte[]
private String[]
sqlErrmcMessages_

Array of errmc strings for each message in the chain.

private String
protected byte[]
protected String
private String[]
sqlStates_

SQL states for all the messages in the exception chain.

private String
protected byte[]

Constructor Summary

AccessConstructor and Description
protected
Sqlca(ClientConnection connection)

Method Summary

Modifier and TypeMethod and Description
protected String
bytes2String(byte[] bytes, int offset, int length)

private void
public boolean
pack-priv String
public Object[]
getArgs(int messageNumber)

pack-priv DataTruncation

Returns:

a java.sql.DataTruncation instance
getDataTruncation
()

Get a java.sql.DataTruncation warning based on the information in this SQLCA.

public synchronized int

Returns:

the error code
getErrorCode
()

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

pack-priv synchronized String
getJDBCMessage(int messageNumber)

private String
getMessage(int messageNumber)

public long
public long
public synchronized int
private int[]
public synchronized String
public synchronized String
public synchronized String
pack-priv synchronized String

Returns:

SQL state for the error
getSqlState
(int
the error to retrieve SQL state for
messageNumber
)

Get the SQL state for a given error.

public synchronized String
private String

Returns:

string with details about the error
getUnformattedMessage
(int
which message number to get the text for
messageNumber
)

Get the unformatted message text (in case we cannot ask the server).

public long
private void
initSqlErrmcMessages()

Initialize and build the arrays sqlErrmcMessages_ and sqlStates_.

pack-priv synchronized int

Returns:

number of messages
numberOfMessages
()

Returns the number of messages this SQLCA contains.

private void
processSqlErrmcTokens(byte[] tokenBytes)

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

pack-priv void
returnTokensOnlyInMessageText(boolean returnTokensOnlyInMessageText)

public void
setContainsSqlcax(boolean containsSqlcax)

public void
setRowsetRowCount(long rowCount)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

agent_back to summary
private final transient Agent agent_
cachedMessagesback to summary
private String[] cachedMessages

Cached error messages (to prevent multiple invocations of the stored procedure to get the same message).

connection_back to summary
private transient ClientConnection connection_
containsSqlcax_back to summary
private boolean containsSqlcax_
elevenBlanksback to summary
private static final String elevenBlanks
exceptionThrownOnStoredProcInvocation_back to summary
pack-priv SqlException exceptionThrownOnStoredProcInvocation_
HIGH_ORDER_ROW_COUNTback to summary
private static final int HIGH_ORDER_ROW_COUNT
HIGH_ORDER_UPDATE_COUNTback to summary
private static final int HIGH_ORDER_UPDATE_COUNT
LOW_ORDER_ROW_COUNTback to summary
private static final int LOW_ORDER_ROW_COUNT
LOW_ORDER_UPDATE_COUNTback to summary
private static final int LOW_ORDER_UPDATE_COUNT
messageTextRetrievedContainsTokensOnly_back to summary
pack-priv boolean messageTextRetrievedContainsTokensOnly_
returnTokensOnlyInMessageText_back to summary
private boolean returnTokensOnlyInMessageText_
rowsetRowCount_back to summary
private long rowsetRowCount_
SQL_ERR_LENGTHback to summary
public static final int SQL_ERR_LENGTH
sqlCode_back to summary
protected int sqlCode_
sqlErrd_back to summary
protected int[] sqlErrd_
sqlErrmc_back to summary
private String sqlErrmc_

A string representation of sqlErrmcBytes_.

sqlErrmcBytes_back to summary
protected byte[] sqlErrmcBytes_
sqlErrmcMessages_back to summary
private String[] sqlErrmcMessages_

Array of errmc strings for each message in the chain.

sqlErrp_back to summary
private String sqlErrp_
sqlErrpBytes_back to summary
protected byte[] sqlErrpBytes_
sqlState_back to summary
protected String sqlState_
sqlStates_back to summary
private String[] sqlStates_

SQL states for all the messages in the exception chain.

sqlWarn_back to summary
private String sqlWarn_
sqlWarnBytes_back to summary
protected byte[] sqlWarnBytes_

Constructor Detail

Sqlcaback to summary
protected Sqlca(ClientConnection connection)

Method Detail

bytes2Stringback to summary
protected String bytes2String(byte[] bytes, int offset, int length)
chainDeferredExceptionsToAgentOrAsConnectionWarningsback to summary
private void chainDeferredExceptionsToAgentOrAsConnectionWarnings(SqlException e)
containsSqlcaxback to summary
public boolean containsSqlcax()
formatSqlErrdback to summary
pack-priv String formatSqlErrd()
getArgsback to summary
public Object[] getArgs(int messageNumber)
getDataTruncationback to summary
pack-priv DataTruncation getDataTruncation()

Get a java.sql.DataTruncation warning based on the information in this SQLCA.

Returns:DataTruncation

a java.sql.DataTruncation instance

getErrorCodeback to summary
public synchronized 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 org.apache.derby.impl.drda.DRDAConnThread#getSqlCode(java.sql.SQLException)
Returns:int

the error code

getJDBCMessageback to summary
pack-priv synchronized String getJDBCMessage(int messageNumber)
getMessageback to summary
private String getMessage(int messageNumber) throws SqlException
getRowCountback to summary
public long getRowCount() throws DisconnectException
getRowsetRowCountback to summary
public long getRowsetRowCount()
getSqlCodeback to summary
public synchronized int getSqlCode()
getSqlErrdback to summary
private int[] getSqlErrd()
getSqlErrmcback to summary
public synchronized String getSqlErrmc()
getSqlErrpback to summary
public synchronized String getSqlErrp()
getSqlStateback to summary
public synchronized String getSqlState()
getSqlStateback to summary
pack-priv synchronized String getSqlState(int messageNumber)

Get the SQL state for a given error.

Parameters
messageNumber:int

the error to retrieve SQL state for

Returns:String

SQL state for the error

getSqlWarnback to summary
public synchronized String getSqlWarn()
getUnformattedMessageback to summary
private String getUnformattedMessage(int messageNumber)

Get the unformatted message text (in case we cannot ask the server).

Parameters
messageNumber:int

which message number to get the text for

Returns:String

string with details about the error

getUpdateCountback to summary
public long getUpdateCount()
initSqlErrmcMessagesback to summary
private void initSqlErrmcMessages()

Initialize and build the arrays sqlErrmcMessages_ and sqlStates_.

numberOfMessagesback to summary
pack-priv synchronized int numberOfMessages()

Returns the number of messages this SQLCA contains.

Returns:int

number of messages

processSqlErrmcTokensback to summary
private void processSqlErrmcTokens(byte[] tokenBytes)
resetRowsetSqlcaback to summary
public void resetRowsetSqlca(ClientConnection connection, int sqlCode, String sqlState)
returnTokensOnlyInMessageTextback to summary
pack-priv void returnTokensOnlyInMessageText(boolean returnTokensOnlyInMessageText)
setContainsSqlcaxback to summary
public void setContainsSqlcax(boolean containsSqlcax)
setRowsetRowCountback to summary
public void setRowsetRowCount(long rowCount)