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

select from external procedure validates output parameters even when fetch method returns false #7696

Closed
asfernandes opened this issue Aug 4, 2023 · 0 comments

Comments

@asfernandes
Copy link
Member

/***
create procedure test_proc (
    start_n integer not null,
    end_n integer not null
) returns (
    n integer not null
)
    external name 'udrcpp_example!test_proc'
    engine udr;
***/
FB_UDR_BEGIN_PROCEDURE(test_proc)
	FB_UDR_MESSAGE(InMessage,
		(FB_INTEGER, start)
		(FB_INTEGER, end)
	);

	FB_UDR_MESSAGE(OutMessage,
		(FB_INTEGER, result)
	);

	FB_UDR_EXECUTE_PROCEDURE
	{
		out->resultNull = FB_FALSE;
		out->result = in->start - 1;
	}

	FB_UDR_FETCH_PROCEDURE
	{
		++out->result;
		out->resultNull = out->result == 10 ? FB_TRUE : FB_FALSE;
		return out->result < in->end;
	}
FB_UDR_END_PROCEDURE
-- ok
SQL> select * from test_proc(2, 4);

           N 
============ 
           2 
           3 
-- should not throw error
SQL> select * from test_proc(7, 10);

           N 
============ 
           7 
           8 
           9 
Statement failed, SQLSTATE = 42000
validation error for variable N, value "*** null ***"
-At procedure 'TEST_PROC'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment