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
Exception handling with EXECUTE STATEMENT [CORE2907] #3291
Comments
Modified by: @hvladassignee: Vlad Khorsun [ hvlad ] |
Commented by: @hvlad New implementation of EXECUTE STATEMENT works with exceptions in following way - when any operation (connect, start transaction, prepare, execute, fetch, etc) raised exception this exception is converted into text form and primary error code of final exception is one of the new isc_eds_XXX constants. Text with details about original exception (error codes and associated messages) also present in the status-vector as one of arguments of primary isc_eds_XXX error. This is necessary as client applicatin can't interpret error codes supplied by (unknown for app) external data source. I see possibility to pass original error to the application without interception if dynamic statement was executed in current execution context. |
Commented by: Van den Wouwer Danny (dannyvdw) So, You will change this behaviour before final 2.5? Otherwise we can't accuratly check which exception was thrown inside a stored procedure. |
Commented by: @hvlad Yes, i going change it before RC3 |
Commented by: @hvlad More exact ticket description |
Modified by: @hvladsummary: Exception handling => Exception handling with EXECUTE STATEMENT |
Commented by: @hvlad Changes documented at doc/sql.extensions/README.execute_statement2 |
Modified by: @hvladstatus: Open [ 1 ] => Resolved [ 5 ] resolution: Fixed [ 1 ] Fix Version: 2.5 RC3 [ 10381 ] Fix Version: 3.0 Alpha 1 [ 10331 ] |
Commented by: Van den Wouwer Danny (dannyvdw) Tested it with snapshot build 25980, it works. thx |
Modified by: @pmakowskistatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: Van den Wouwer Danny (dannyvdw)
Is related to QA432
Unable to catch exceptions that are thrown inside a dynamic builded execute block.
Example:
SET NAMES WIN1252;
SET CLIENTLIB 'fbclient.dll';
CREATE DATABASE 'LOCALHOST/3050:C:\TESTDB.FDB'
USER 'SYSDBA'
PASSWORD 'masterkey'
PAGE_SIZE 16384
DEFAULT CHARACTER SET WIN1252;
CREATE OR ALTER EXCEPTION EX_TEST 'test';
SET TERM ^ ;
CREATE OR ALTER procedure sp_1
as
declare variable v_stmt varchar(256);
begin
v_stmt = 'execute block as '||
'begin '||
' exception ex_test; '||
'end';
execute statement v_stmt;
end
^
SET TERM ; ^
SET TERM ^ ;
CREATE OR ALTER procedure sp_2
as
begin
begin
execute procedure sp_1;
end
end
^
SET TERM ; ^
SET TERM ^ ;
CREATE OR ALTER procedure sp_3
as
begin
begin
execute procedure sp_1;
when any do
begin
exit;
end
end
end
^
SET TERM ; ^
EXECUTE PROCEDURE SP_2;
EXECUTE PROCEDURE SP_3;
COMMIT WORK;
When executing sp_2 we never reach the exception handling block, if we use the "any" keyword like in sp_3 then we can catch the exception.
We tested this on Classic Windows 32-bit version and it works like it should on v2.1.3.
Danny
Commits: fcbd948 2d74ff8
The text was updated successfully, but these errors were encountered: