-
Notifications
You must be signed in to change notification settings - Fork 375
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
sqlsrv_next_result() causes "The active result for the query contains no fields" error in v5.1.1 #581
Comments
I think this is releated with each other, this issue has the same problems, i am having exact the same problem as mentioned here, only difference is that i run PHP7.1.11 on Windows 10 |
Hi @theodorejb and @jansor, the behaviour in the latest release was changed because of inconsistencies in the way null result sets were reported previously - details in issue #507. Now, if you try calling sqlsrv_next_result() or nextRowset() on a null result set, the error If you are calling sqlsrv_next_result() on a result that is nonempty to begin with, the error won't be returned unless you first go past the end and then call sqlsrv_next_result (the first time you go past the end, sqlsrv_next_result() returns null rather than an error). If the result set is empty but non-null, sqlsrv_next_result would return null again. But if the result set is null to begin with, the error is returned immediately on calling sqlsrv_next_result. The do...while loop in your execute() function is fine, but you may want to change the if block that follows, as it will throw an exception whenever your statement returns a null result. |
@david-puglielli How can I check whether the result set is null so I can avoid calling |
@theodorejb @jansor After discussing with the team we have concluded this new behavior is a regression in the 5.1.1-preview release. We will have this fixed in the next preview release near the end of the month. We apologize for any inconvenience. |
Fixed and merged #595 |
I have a generic class for executing queries and returning selected results. It worked fine with v5.1.0 and previous SQLSRV driver releases, but with v5.1.1 I am getting an error saying "The active result for the query contains no fields."
Before running the test script, create a
Users
table like this:Here's the code that demonstrates the problem. In v5.1.0 and prior, the call to
sqlsrv_next_result()
for the second query returnednull
, but in v5.1.1 it returnsfalse
.In case it helps, I'm using PHP 7.2 RC5 on Windows 10.
The text was updated successfully, but these errors were encountered: