danielmewes / php-rql

A PHP client driver for the RethinkDB query language (ReQL).
http://php-rql.dnsalias.net/
339 stars 60 forks source link

Cursor Improvement #128

Closed etienneroudeix closed 8 years ago

etienneroudeix commented 8 years ago
etienneroudeix commented 8 years ago

I did not get why the Cursor::key method returns null but maybe it should replace the Cursor:: getCurrentIndex I created

danielmewes commented 8 years ago

Thanks for the pull request @etienneroudeix .

The fix to bufferedCount looks correct, but I think getCurrentIndex() doesn't work. It will return the index within the current batch, but not the overall index of the cursor. For getting the overall index we would need to add an additional variable that keeps track of it across multiple calls to setBatch(). If that functionality is important for you we can add it, but in general I think it's something that can easily be implemented outside the cursor and isn't strictly necessary.

etienneroudeix commented 8 years ago

Hello @danielmewes , Indeed I forgot the getBatch() thing. I updated my PR, could you have a look ?

FYI : I need actual current cursor position to be able to restart a failed cycling process over millions of raws to the last raw it processed with success.

etienneroudeix commented 8 years ago

Here you are @danielmewes

danielmewes commented 8 years ago

Looks good to me. Thanks for updating the PR @etienneroudeix .

This just missed the 2.3.0 release. Is this important for you? I could release a 2.3.1 patch soon.

etienneroudeix commented 8 years ago

Thank you @danielmewes It's kinda important but I have a (dirty) workaround for the moment. So I can wait 2.3.1 :-)