You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which calls seek defined in SilverStripe\ORM\Connect\MySQLQuery:
publicfunctionseek($row)
{
if (is_object($this->handle)) {
$this->handle->data_seek($row);
return$this->nextRecord();
}
returnnull;
}
Seek calls data_seek which adjusts the result pointer to an arbitrary row in the result, in this case zero (the first record). We then return the next record, this changes the pointer to now be pointing to 1 (the second record).
This means that each time we call rewind we are effectively rewinding to the second record and not the first.
Underlying issue here is that PDO pre-fetches the entire query result in to an array (which I think caused memory issues on big projects) and MySQL iterates the query as you go, and its rewind() behaviour seems to be broekn.
@sminnee there are some merge conflicts with these changes when merging 4 -> master. Would you mind taking a look at them when you have a minute? I'm not clear on the context enough to merge them since master has been updated to use generators
Affected Version
4.4.1
Description
Rewind is defined in
SilverStripe\ORM\Connect\Query
as the following:Which calls seek defined in
SilverStripe\ORM\Connect\MySQLQuery
:Seek calls
data_seek
which adjusts the result pointer to an arbitrary row in the result, in this case zero (the first record). We then return the next record, this changes the pointer to now be pointing to 1 (the second record).This means that each time we call rewind we are effectively rewinding to the second record and not the first.
Steps to Reproduce
Create your example object:
Run some code:
Output:
The text was updated successfully, but these errors were encountered: