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

Incorrect processing of DSQL_drop? [CORE4699] #5007

Open
firebird-automations opened this issue Feb 25, 2015 · 1 comment
Open

Incorrect processing of DSQL_drop? [CORE4699] #5007

firebird-automations opened this issue Feb 25, 2015 · 1 comment

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @ibprovider

As I understand, DSQL_drop constant presents the FLAG of operation, not ID of operation.

However, in some cases, instead of checking the flag DSQL_drop, used a direct comparison with DSQL_drop

[GDS_DSQL_FREE] [why.cpp]

	if \(option & DSQL\_drop\) // <\-\-\-\-\- OK
	\{
		destroy\(statement\);
		\*stmt\_handle = 0;
	\}

[GDS_DSQL_FREE] [interface.cpp]

		if \(option == DSQL\_drop\) // <\-\-\-\-\- ???
		\{
			release\_sql\_request\(statement\);
			\*stmt\_handle = NULL;
		\}

		if \(option == DSQL\_drop\) // <\-\-\-\-\- ???
			\*stmt\_handle = NULL;

[Stack]
fbclient_d.dll!REM_free_statement(int * user_status=0x0249e470, Rsr * * stmt_handle=0x00612e2c, unsigned short option=2) Line 1960 C++
> fbclient_d.dll!isc_dsql_free_statement(int * user_status=0x0249e470, void * * stmt_handle=0x042db448, unsigned short option=2) Line 3348 C++
_IBProvider_v3_vs2013_d.dll!IBP_ISC_API__dsql_free_statement(isc_base::t_isc_provider * isc_provider=0x040ceed8, isc_base::t_isc_connection * isc_connection=0x040cf3c0, isc_base::t_isc_status_vector & arg1__status_vector={...}, void * * arg2__stmt_handle_ptr=0x042db448, unsigned short arg3__op_id=2) Line 209 C++

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

I see no bug there. While DSQL_drop\DSQL_close *looks* like bit flags, they can not be combined in any way.

More, IB6 ApiGuide says:
---------------------------------------------------------------------------------
isc_dsql_free_statement()
Frees a statement handle and all resources allocated for it, or closes a cursor associated
with the statement referenced by a statement handle.

...

Description
isc_dsql_free_statement() either frees a statement handle and all resources allocated for it (option = DSQL_drop),
or closes a cursor associated with the statement
(option = DSQL_close).

Note
isc_dsql_free_statement() does nothing if it is called with an option value other than DSQL_drop or DSQL_close.
---------------------------------------------------------------------------------

You see - user can use one opton *or* another and nothing else.

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