New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3 bugs in exception handling in SPs [CORE324] #659
Comments
Commented by: Alice F. Bird (firebirds) Date: 2003-08-28 16:18 1. Explained by Ivan, i.e. you should use e.g. "GDSCODE |
Commented by: Alice F. Bird (firebirds) Date: 2002-08-27 04:10 Adding a request to increase the maximum size of an exception string to something capable of realistically |
Commented by: Alice F. Bird (firebirds) Date: 2002-04-30 17:40 Ivan, you cannot imagine how I struggled with gdscode possibilities! Just a further question: is it possible to get at the following? i.e. Shouldn't it be consistent with the others? Helen |
Commented by: Alice F. Bird (firebirds) Date: 2002-04-30 15:56 > 1. According to docs, exceptions can be trapped by using This one is error in docs. GDSCODE should not be followed Another undocumented feature (?) is the fact that FB accepts > 2. According to the docs, "RDB$EXCEPTIONS ... > 3. There seems to be no way to read either SQLCODE or This would be very useful, and should be qualified as |
Modified by: @pcisarWorkflow: jira [ 10348 ] => Firebird [ 14583 ] |
Modified by: @pavel-zotovQA Status: No test |
Submitted by: @helebor
SFID: 547383#
Submitted By: helebor
1. According to docs, exceptions can be trapped by using the GDSCODE keyword with WHEN, e.g.
WHEN GDSCODE 35544778 do
begin
DO SOMETHING;
exit;
end
However, the compiler barfs on the GDSCODE keyword.
2. According to the docs, "RDB$EXCEPTIONS describes error conditions related to stored
procedures, including user-defined exceptions."
The table includes a smallint RDB$SYSTEM_FLAG for which the description is "Indicates whether the
exception is * User-defined (value of 0) *System-defined (value greater than 0)"
Taken together, this seems to indicate that system exceptions should be in RDB$EXCEPTIONS but,
in fact, this table is empty except for any user-defined exceptions. This is the case for FB and all
IB versions from 5.6 forward. I don't have a 4.x server any more but I seem to recollect that this
table was populated by CREATE DATABASE at one time and the doc seems to assert this.
3. There seems to be no way to read either SQLCODE or GDSCODE into a host variable in a SP.
For example, this can't be too much to ask:
..
declare variable _SQLCODE_ integer;
...
when ANY do
_SQLCODE = SQLCODE;
However, the compiler rejects SQLCODE as an invalid token.
All in all, it seems SPs can trap only UDE's and the generic SQLCODE exceptions, which makes
exception handling pretty ugly and makes liars out of the documenters.
The text was updated successfully, but these errors were encountered: