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 method does not contain return statement in SQLSrvStatement #3213

Closed
ekarajbic-mydays opened this issue Jul 11, 2018 · 8 comments
Closed

Comments

@ekarajbic-mydays
Copy link

Shouldn't there be a return statement in execute method, since documentation states that method returns boolen?

@Ocramius
Copy link
Member

Could you link the specific bit of code please?

@ekarajbic-mydays
Copy link
Author

ekarajbic-mydays commented Jul 11, 2018

@Ocramius
Copy link
Member

Ref:

public function execute($params = null)

@morozov
Copy link
Member

morozov commented Jul 11, 2018

As part of #3154, I'm trying to change the return type of Statement::execute() from bool to void. You cannot reliably use the return value because the implementations may throw all sorts of exceptions. Besides the documentation mismatch, is there a practical reason for changing the code?

@ekarajbic-mydays
Copy link
Author

Nobody is relying only on return, of course try-catch blocks must be there.

But, it was nice to know if it was executed or not with true/false as return.

All other Statements still have it except SQLSrvStatement, so in these terms it should be taken as a BUG.

In #3154 , is it guaranteed then when void was returned, the statement was executed successfully if no exception has been thrown ?

If that is the case, then no other reason beside mismatch in documentation is problem.

@morozov
Copy link
Member

morozov commented Jul 13, 2018

But, it was nice to know if it was executed or not with true/false as return.

Currently, the fact that the method doesn't throw an exception is the indicator of success:

if (!sqlsrv_execute($this->stmt)) {
throw SQLSrvException::fromSqlSrvErrors();
}

In #3154, is it guaranteed then when void was returned, the statement was executed successfully if no exception has been thrown?

Yes, this is the goal.

@morozov
Copy link
Member

morozov commented Nov 2, 2021

I believe this is irrelevant as of #4045.

@morozov morozov closed this as completed Nov 2, 2021
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants