[Zope-DB] Getting a cursor?

Paul Winkler pw_lists at slinkp.com
Wed Sep 27 18:26:03 EDT 2006

On Wed, Sep 27, 2006 at 11:51:40PM +0200, Charlie Clark wrote:
> Am 27.09.2006, 23:44 Uhr, schrieb Paul Winkler <pw_lists at slinkp.com>:
> >Any suggestions?
> >p.s. I'll be asking egenix too, we'll see if they reply to help requests
> >without a purchased license... but then, if I can't get this to work
> >there's no point in purchasing one :-]
> Why shouldn't we answer support requests? 

Heh :) I was afraid you guys might say something along the lines of "Pay
up first, you cheapskate". Nice to see otherwise.

> You can access most of the  
> mxODBC API on a ZopeDA object through an ExternalMethod. This is indeed  
> above and beyond the ZopeDA API which predates the Python one as far as I  
> know.
> Call an mxODBC Zope DA object and pass it to your ExternalMethod which can  
> then call it as you would in Python.

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)
>>> conn = app.sweetums_test()
>>> conn
<Products.mxODBCZopeDA.ZopeDA.DatabaseConnection "DSN=MSSQLdsn" thread
47227742061040/47227742061040 at 0x2aaaab0907e8>
>>> dir(conn)
['DatabasePackage', 'MAX_SCHEMA_CACHE_SIZE', 'SQL', '__doc__',
'__init__', '__module__', '__repr__', '__setstate__', '_abort',
'_begin', '_finish', '_init_typecodes', '_lock', '_register',
'_registered', '_shortint_converter', '_unlock', '_v_thread_lock',
'abort', 'alive', 'build_query_result', 'callproc', 'close',
'columninfos', 'columnprivileges', 'columns', 'commit', 'connect',
'connected', 'connection', 'connection_string', 'connection_timezone',
'datetime_as_mxdatetime', 'dont_fix_floats', 'errorhandler', 'execute',
'executemany', 'fetch_last_result_set', 'foreignkeys',
'get_connection_info', 'gettypeinfo', 'ignore_max_rows',
'ignore_warnings', 'messages', 'null_as_empty_string', 'options',
'primarykeys', 'procedurecolumns', 'procedures', 'query',
'record_messages_only', 'run_cursor_callback', 'schema_cache',
'set_errorhandler', 'shortint_as_int', 'shortints', 'sortKey',
'specialcolumns', 'statistics', 'tableprivileges', 'tables',
'thread_id', 'time_as_string', 'tpc_abort', 'tpc_begin', 'tpc_finish',
'tpc_vote', 'transactional', 'use_auto_commit', 'use_lazy_connect',
'used', 'zopetype']

I guess I could just use mx.ODBC instead of mxODBCZopeDA, but then I'd
lose the nice Zope DA features like transaction integration and DTML
support ...


Paul Winkler

More information about the Zope-DB mailing list