Re: fetchmany weirdness?
Federico Di Gregorio <fog-NGVKUo/i/[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Organization | initd.org |
| Message-ID | <1259744893.3577.23.camel@mila> |
Il giorno lun, 30/11/2009 alle 14.56 -0500, Brian Jones ha scritto: > So, in my db.is_good_user method, instead of using the self.curs() > created at the class level, I created a new cursor local to the > method. That solves the issue, though I'd still like to know more > about this problem if anyone has some wisdom to share. > > It is not a problem but a DBAPI design decision. Cursors are used to hold the state of the query (cached results, index into the result set and so on) and when you execute a new query on the same cursor, the old status is lost. So, if you want to operate with two result sets (i.e., two SELECTs) at the same time you'll need at least 2 cursors. IMHO the DBAPI should have mandated "use once" semantics for cursors (raising an exception if a cursor is used more than once). They are so light weight that doesn't even make sense to reuse them. federico -- Federico Di Gregorio http://people.initd.org/fog DISCLAIMER. If I receive a message from you, you are agreeing that: 1. I am by definition, "the intended recipient". 2. All information in the email is mine to do with as I see fit and make such financial profit, political mileage, or good joke as it lends itself to. In particular, I may quote it on USENET or the WWW. 3. I may take the contents as representing the views of your company. 4. This overrides any disclaimer or statement of confidentiality that may be included on your message. _______________________________________________ Psycopg mailing list Psycopg-IAPFreCvJWPBWskQ1e/[email protected] http://lists.initd.org/mailman/listinfo/psycopg
signature.asc
(application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEABECAAYFAksWLn0ACgkQvcCgrgZGjesQzgCgm3kSAd07M8EruH0xgjpzHj52 b10An2qAgG7D8nJH/klLXIjuSlJinJsl =Xex2 -----END PGP SIGNATURE-----