Am 05.07.2017 um 23:12 schrieb Justin Pryzby:
I'm hoping for some feedback on this - if the interface seems okay and the implementation otherwise fine, I can clean up some by pulling
out the duplicated code from queryGet/Dict/Result and queryNext().
Hi Justin,

some quick feedback:

* The sourceObject is the low level object behind the DB API 2 cursor object, while the queryObject is the low level object behind the classic API query object. I would keep them separate, to avoid tight coupling between the modules. Can't we just add max_row and current_row to the queryObject instead?

* As you already suggested, this should be refactored so that queryGetResult() creates the list using the queryNext() method.

* Instead of the resetIter() method, I suggest having a more general method like move(amount=1, relative=True) to change the cursor position. Should be easy to implement, it just alters current_row. To reset the iterator, you could then just move(0, False). This would correspond to the MOVE statement for real cursors.

* We should also implement a __len__() method on the query object then.

* In analogy to dictresult() and namedresult(), we should probably also provide dictiter() and namediter() methods.

* We need tests for all of this.

Let me know what you think and whether you want to work on this on your own or need me to help.

-- Chris
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to