Skip to content
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

EXECUTE STATEMENT returnig values INTO input PROCEDURE parameters [CORE1967] #2405

Closed
firebird-automations opened this issue Jun 27, 2008 · 3 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Attila Molnár (e_pluribus_unum)

/*
1. EXECUTE STATEMENT bug :
when the EXEC STAT retuns value(s)
and the INTO variable(s) is/are input parameter(s) of the STORED PROC
then the variable(s) do not get the expecterd value(s), but NULL
if the initial value(s) (value(s) before EXEC STAT) of the INTO variable(s) is/are NULL

tested on FB 1\.5\.4\., 1\.5\.5 : both version got the bug
tested on FB 2\.0\.3 : works fine, no bug

*/

CREATE OR ALTER PROCEDURE EXEC_STAT_TEST(
IN_TABLE_NAME CHAR(31),
IN_FIELD_NAME CHAR(31))
RETURNS (
OUT_TABLE_NAME CHAR(31),
OUT_FIELD_NAME CHAR(31))
AS
DECLARE VARIABLE tmp_table_name CHAR(31);
DECLARE VARIABLE tmp_field_name CHAR(31);
DECLARE VARIABLE sql VARCHAR(1000);
BEGIN
sql=
'SELECT FIRST 3 f.rdb$relation_name, f.rdb$field_name '||
'FROM rdb$relation_fields f '||
'WHERE UPPER(f.rdb$relation_name) STARTING WITH ''RDB$'' '||
'ORDER BY 1, 2';
FOR EXECUTE STATEMENT sql
INTO :in_table_name, :in_field_name
DO BEGIN
out_table_name=in_table_name;
out_field_name=in_field_name;
SUSPEND;
END
FOR EXECUTE STATEMENT sql
INTO :tmp_table_name, :tmp_field_name
DO BEGIN
out_table_name=tmp_table_name;
out_field_name=tmp_field_name;
SUSPEND;
END
FOR EXECUTE STATEMENT sql
INTO :out_table_name, :out_field_name
DO BEGIN
SUSPEND;
END
END

SELECT * FROM exec_stat_test(NULL,NULL);--1. EXEC STAT bug
SELECT * FROM exec_stat_test(NULL,'aaa');--1. EXEC STAT bug
SELECT * FROM exec_stat_test('aaa',NULL);--1. EXEC STAT bug
SELECT * FROM exec_stat_test('aaa','aaa');--only this time get the expected result

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

In 1.5 only critical security issues are fixed.
Please upgrade.

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant