use of org.firebirdsql.jca.FBXAException in project jaybird by FirebirdSQL.
the class FBSQLException method getSqlErrorCode.
/**
* Helper method to get the SQL vendor code (or in the case of Firebird: the
* isc errorcode).
*
* @param ex
* ResourceException
* @return isc errorcode, or 0
*/
private static int getSqlErrorCode(ResourceException ex) {
Throwable cause = resolveCause(ex);
if (cause instanceof GDSException) {
return ((GDSException) cause).getIntParam();
}
if (cause instanceof SQLException) {
return ((SQLException) cause).getErrorCode();
}
if (cause instanceof FBXAException) {
FBXAException fbXaException = (FBXAException) cause;
Throwable cause2 = fbXaException.getCause();
if (cause2 instanceof SQLException) {
return ((SQLException) cause2).getErrorCode();
}
}
return 0;
}
Aggregations