Re: Re: svn: /php/php-src/ branches/PHP_5_4/ext/mysqli/tests/bug55582.phpt trunk/ext/mysqli/tests/bug55582.phpt

From: Date: Tue, 06 Sep 2011 19:54:55 +0000
Subject: Re: Re: svn: /php/php-src/ branches/PHP_5_4/ext/mysqli/tests/bug55582.phpt trunk/ext/mysqli/tests/bug55582.phpt
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On 09/06/2011 09:08 PM, Stas Malyshev wrote:
Hi! On 9/6/11 11:05 AM, Andrey Hristov wrote:
I've looked into mysqli_result_is_unbuffered_and_not_everything_is_fetched() and it looks like for libmysql it checks this: (((r)->handle&& (r)->handle->status == MYSQL_STATUS_USE_RESULT) || ((r)->data == NULL)) When I step through your code, r->data (which is result->data) is always NULL for me, which means warning is generated and 0 is returned. Is it a problem in libmysql?
r->data should be always NULL, for an unbuffered fetch, r->data holds the data for buffered result sets. It is additional protection, an
If r->data is always null, then - please look at the code above - mysqli_result_is_unbuffered_and_not_everything_is_fetched() is always true. Which I think is not what was intended, because the test implies otherwise, but maybe I am mistaken. That's what I am trying to find out - is this behavior of libmysql/mysqli implementation, that always returns 0 and produces an error for "use" results for num_rows - intentional or is it some kind of error.
assert. I don't see a problem with that. I don't see also the behavior you describe - 0 returned even after the last fetch. If all data is fetched r->handle->status will be no more MYSQL_STATUS_USE_RESULT but something else (MYSQL_STATUS_READY), this will signal, that everything has been fetched. Of course, the check could have been !res->eof, but
This is true, however if you look at the condition, it returns true always when r->data us NULL regardless of what is there in the status. What I am trying to find out is if this behavior is intended - and then the test is wrong for this situation - or is it not intended and needs to be fixed.
Good catch. I just fixed it in svn. There is one more remaining issue. mysqli_num_rows() returns different value than mysqli::num_rows due to the way properties are implemented - most properties call directly the underlying function. In this case for libmysql there is difference. mysqli@ should deliver the expected 0 when !EOF. Andrey

Thread (8 messages)

« previous php.internals (#55260) next »