Class Sqlca
java.lang.Object
org.apache.derby.client.am.Sqlca
- Direct Known Subclasses:
NetSqlca
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Agentprivate String[]Cached error messages (to prevent multiple invocations of the stored procedure to get the same message).private ClientConnectionprivate booleanprivate static final String(package private) SqlExceptionprivate static final intprivate static final intprivate static final intprivate static final int(package private) booleanprivate booleanprivate longstatic final intprotected intprotected int[]private StringA string representation ofsqlErrmcBytes_.protected byte[]private String[]Array of errmc strings for each message in the chain.private Stringprotected byte[]protected Stringprivate String[]SQL states for all the messages in the exception chain.private Stringprotected byte[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Stringbytes2String(byte[] bytes, int offset, int length) private voidboolean(package private) StringObject[]getArgs(int messageNumber) (package private) DataTruncationGet ajava.sql.DataTruncationwarning based on the information in this SQLCA.intGet the error code based on the SQL code received from the server.(package private) StringgetJDBCMessage(int messageNumber) private StringgetMessage(int messageNumber) longlongintprivate int[](package private) StringgetSqlState(int messageNumber) Get the SQL state for a given error.private StringgetUnformattedMessage(int messageNumber) Get the unformatted message text (in case we cannot ask the server).longprivate voidInitialize and build the arrayssqlErrmcMessages_andsqlStates_.(package private) intReturns the number of messages this SQLCA contains.private voidprocessSqlErrmcTokens(byte[] tokenBytes) voidresetRowsetSqlca(ClientConnection connection, int sqlCode, String sqlState) (package private) voidreturnTokensOnlyInMessageText(boolean returnTokensOnlyInMessageText) voidsetContainsSqlcax(boolean containsSqlcax) voidsetRowsetRowCount(long rowCount)
-
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_
-
exceptionThrownOnStoredProcInvocation_
SqlException exceptionThrownOnStoredProcInvocation_ -
messageTextRetrievedContainsTokensOnly_
boolean messageTextRetrievedContainsTokensOnly_ -
sqlCode_
protected int sqlCode_ -
sqlErrmc_
A string representation ofsqlErrmcBytes_. -
sqlErrmcMessages_
Array of errmc strings for each message in the chain. -
sqlStates_
SQL states for all the messages in the exception chain. -
sqlErrp_
-
sqlErrd_
protected int[] sqlErrd_ -
sqlWarn_
-
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_
-
cachedMessages
Cached error messages (to prevent multiple invocations of the stored procedure to get the same message). -
elevenBlanks
- See Also:
-
-
Constructor Details
-
Sqlca
-
-
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
-
initSqlErrmcMessages
private void initSqlErrmcMessages()Initialize and build the arrayssqlErrmcMessages_andsqlStates_. -
getSqlErrp
-
getSqlErrd
private int[] getSqlErrd() -
formatSqlErrd
String formatSqlErrd() -
getSqlWarn
-
getSqlState
-
getSqlState
Get the SQL state for a given error.- Parameters:
messageNumber- the error to retrieve SQL state for- Returns:
- SQL state for the error
-
getArgs
-
getMessage
- Throws:
SqlException
-
getJDBCMessage
-
getUnformattedMessage
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
-
getDataTruncation
DataTruncation getDataTruncation()Get ajava.sql.DataTruncationwarning based on the information in this SQLCA.- Returns:
- a
java.sql.DataTruncationinstance
-
processSqlErrmcTokens
private void processSqlErrmcTokens(byte[] tokenBytes) -
bytes2String
-
getUpdateCount
public long getUpdateCount() -
getRowCount
- Throws:
DisconnectException
-
setContainsSqlcax
public void setContainsSqlcax(boolean containsSqlcax) -
containsSqlcax
public boolean containsSqlcax() -
resetRowsetSqlca
-
setRowsetRowCount
public void setRowsetRowCount(long rowCount) -
getRowsetRowCount
public long getRowsetRowCount()
-