Re: Async branch documentation and review

Federico Di Gregorio <fog-NGVKUo/i/[email protected]> Sat, 10 Apr 2010 12:46:40 +0200
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On 09/04/2010 21:16, Jan UrbaƄski wrote:
[snip]
>> Do we really need cursor.poll()? There can only be a single async
>> cursor in execution per connection. On the other side we can't do
>> without connection.poll() because is using during connection, when
>> there is no cursor. What about dropping cursor.poll() and only leave
>> connection.poll()? If an app only had a reference to the cursor it
>> would always be possible to call curs.connection.poll().
> 
> I don't mind having only connection.poll, although it feels a bit
> strange to me. If we go that way it's one step short of having (in async
> mode) only connection.execute() and getting rid of the cursors
> whatsoever (which is not necessarily bad).
> Another thing is that if/when we start supporting async named cursors,
> we might need to still call something on the cursor (haven't thought
> about the interface yet).

This is plain wrong. You still need cursors to keep multiple result sets
around, so .execute() on the cursor should not go away.

>> I just discovered another quirk in having a cursor.poll() while the
>> responsibility of the communication state really belongs to the
>> connection: cursors can steal results each other:
> 
> :( Yeah, that kind of sucks. Could this fall in the category of "so
> don't do it"? Or should we add an exception when you try to poll() a
> cursor that's not the one currently executing?

There should be an exception.

federico

-- 
Federico Di Gregorio                                       fog-NGVKUo/i/[email protected]
  There are 10 types of people in this world, those that understand
   binary, and those that don't.                   -- Michael Gittelsohn

_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/psycopg
signature.asc (application/pgp-signature, 262 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkvAVxAACgkQvcCgrgZGjevWLQCePDZHVgxzZdAs2AAfyPz0ymFi
428AoM2PnJ3qLgNjgYA8fyf/L1Ybvfin
=2kT9
-----END PGP SIGNATURE-----