Package org.apache.derby.client.am
Class Sqlca
java.lang.Object
org.apache.derby.client.am.Sqlca
- Direct Known Subclasses:
NetSqlca
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Agent
private String[]
Cached error messages (to prevent multiple invocations of the stored procedure to get the same message).private ClientConnection
private boolean
private static final String
(package private) SqlException
private static final int
private static final int
private static final int
private static final int
(package private) boolean
private boolean
private long
static final int
protected int
protected int[]
private String
A string representation ofsqlErrmcBytes_
.protected byte[]
private String[]
Array of errmc strings for each message in the chain.private String
protected byte[]
protected String
private String[]
SQL states for all the messages in the exception chain.private String
protected byte[]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
bytes2String
(byte[] bytes, int offset, int length) private void
boolean
(package private) String
Object[]
getArgs
(int messageNumber) (package private) DataTruncation
Get ajava.sql.DataTruncation
warning based on the information in this SQLCA.int
Get the error code based on the SQL code received from the server.(package private) String
getJDBCMessage
(int messageNumber) private String
getMessage
(int messageNumber) long
long
int
private int[]
(package private) String
getSqlState
(int messageNumber) Get the SQL state for a given error.private String
getUnformattedMessage
(int messageNumber) Get the unformatted message text (in case we cannot ask the server).long
private void
Initialize and build the arrayssqlErrmcMessages_
andsqlStates_
.(package private) int
Returns the number of messages this SQLCA contains.private void
processSqlErrmcTokens
(byte[] tokenBytes) void
resetRowsetSqlca
(ClientConnection connection, int sqlCode, String sqlState) (package private) void
returnTokensOnlyInMessageText
(boolean returnTokensOnlyInMessageText) void
setContainsSqlcax
(boolean containsSqlcax) void
setRowsetRowCount
(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.DataTruncation
warning based on the information in this SQLCA.- Returns:
- a
java.sql.DataTruncation
instance
-
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()
-