-
Notifications
You must be signed in to change notification settings - Fork 269
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
Error when calling GetAssoc() on an empty recordset #162
Comments
I think the problem comes from this commit : |
Just created a pull request to test if $this->fields is an array, but i don't know if there is a better way to do it ? |
Could you give your driver and adodb version please. This looks to be a regression error in the mysqli driver in ADOdb 5.19 onwards. Succeeds in oci8po, mysqli,mssqlnative in version 5.18 |
I had the problem with mysqli in 5.20 |
It looks like the problem is that the mysqli driver returns null in the 'fields' index in the recordset |
Not off the top of my head but I'll have a look tomorrow, maybe run git bisect too to identify the offending commit. |
I agree that the problem is caused by commit 32a479a , but I think a more simple way would be $cols = $this->_numOfFields;
if ($cols < 2) {
return false;
}
if (!$this->fields)
/*
* Empty recordset, convert to empty array
*/
return array();
$numIndex = blah,blah,blah |
@gavrochelegnou The issue is fixed in commit 453f080 following @mnewnham's suggested implementation which I believe is more efficient than the one you proposed. Feel free to patch your local installation, until I v5.20.1 is released officially. Note that I confirmed this behavior on mysql(i) and pgsql, did not test on other drivers but most likely the problem is the same. |
Thanks a lot for your fast fix and awesome project ! |
Hi, i'm having the following error :
When i do a query that returns no row
$co->getAssoc('SELECT a,b FROM table WHERE 0')
Thanks a lot
The text was updated successfully, but these errors were encountered: