Re: Async branch documentation and review
Jan Urbański <[email protected]> Sat, 10 Apr 2010 16:19:01 +0200
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
On 10/04/10 14:00, Karsten Hilbert wrote: > On Fri, Apr 09, 2010 at 09:16:43PM +0200, Jan Urbański wrote: > >> I don't mind having only connection.poll, although it feels a bit >> strange to me. > > What about having cursor.poll() not really do anything but > forward to self.connection.poll() ? > > That's probably the pragmatic rather than purist approach > that still internally maintains the conceptual correctness. I still like having poll() on both the connection and the cursor, because internally they are doing different things. connection.poll() is issuing PQconnectPoll (and taking care issuing some initial queries) and cursor.poll() is issuing PQconsumeInput and PQflush. The idea is that you initiate some async action (like connecting or executing) and then you poll until that action is complete (if you're connecting you poll the connection, if executing you poll the cursor). Jan _______________________________________________ Psycopg mailing list [email protected] http://lists.initd.org/mailman/listinfo/psycopg