Re: Getting a cursor?
Paul Winkler <[email protected]>
| Newsgroups | gmane.comp.web.zope.database |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Sep 28, 2006 at 06:11:01PM +0200, Charlie Clark wrote: > Am 28.09.2006, 17:30 Uhr, schrieb Paul Winkler <[email protected]>: > > >>conn.callproc(procedure_name, params) > >>while True: > >> rset = conn.fetchone() > >No dice, it barfs on that line: > >Traceback (most recent call last): > > File "<stdin>", line 2, in ? > >AttributeError: DatabaseConnection instance has no attribute 'fetchone' > >And, as I pointed out in my original post, DatabaseConnection.callproc() > >has a different API from cursor.callproc(). Per my experimentation, > >cursor.callproc() gets (but does not return) all result sets, which can > >then be accessed via cursor.fetchone(), cursor.nextset() etc. > >But DatabaseConnection.callproc() simply returns either the first or > >last result set, depending on your configuration. All other result sets > >are discarded. > >Thanks for the help though. Any other suggestions? > > Ah, okay. > > You can get a cursor on the connection of the connection object: > c = conn.connection.cursor() > c.execute("whatever") > c.fetchone() > > Does that work for you? Yes! Thank you very much. Somehow I failed to notice that the connection had a connection attribute. -- Paul Winkler http://www.slinkp.com