Re: Getting a cursor?

"Charlie Clark" <[email protected]>
Newsgroups gmane.comp.web.zope.database
Organization eGenix.com
Message-ID <op.tgkz7zwvy861uf@localhost>
Am 28.09.2006, 00:26 Uhr, schrieb Paul Winkler <[email protected]>:

> I'll be writing product code, and am currently just experimenting via
> zopectl debug, so I have full access to everything.  But I still can't
> see how to get a cursor or anything else that will let me retrieve
> multiple record sets from one STP call.
> What should I be looking for?
> ./bin/zopectl debug
> Starting debugger (the name "app" is bound to the top-level Zope object)
> (snip)
>>>> conn = app.sweetums_test()
>>>> conn
> <Products.mxODBCZopeDA.ZopeDA.DatabaseConnection "DSN=MSSQLdsn" thread
> 47227742061040/47227742061040 at 0x2aaaab0907e8>
>>>> dir(conn)

You don't need an explicit cursor as you already have one for your  
connection. Simply use callproc()

conn.callproc(procedure_name, params)
while True:
     rset = conn.fetchone()
     pprint.pprint(rset)
     print "============================="
     if conn.nextset() is None: break

Charlie
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.