Carsten Haese wrote: > On Thu, 2006-09-21 at 01:12, Dennis Lee Bieber wrote: > >>On Wed, 20 Sep 2006 13:21:54 -0400, Steve Holden <[EMAIL PROTECTED]> >>declaimed the following in comp.lang.python: >> >> >>>.execute() is a cursor method, not a connection method. Some DB API >>>modules do implement it as a connection method, but that makes it >>>impossible for several cursors to share the same connection (which is >>>allowed by some modules). >>> >> >> It struck me that the original wasn't using a cursor just after the >>messages posted. > > > It doesn't look like the OP is using anything even remotely DB-API > compliant: > > """ > import cmi > <snip> > import hermes > conn = hermes.db() > <snip> > > pubID=cgiForm.getvalue('pubID') > pubName=cgiForm.getvalue('pubName','Unknown Publication') > > sqlcheck1 = "SELECT pub_type FROM medusa.cmi_publication WHERE pub_id = > '"+pubID+"'" > overseas1 = conn.query(sqlcheck1) > pubType = cmi.fetch_rows(overseas1) > """ > > hermes is apparently some wrapper that magically can connect to a > well-known database (via the argumentless db()) call. Who knows what > kind of animal the 'conn' object is that comes out of that db() call. > Apparently it's an object with a query() method that returns something > like a cursor that can be passed into cmi.fetch_rows(). At this point I > wonder why the responsibility of fetching rows is in a module separate > from the responsibility of establishing a database connection. > > Legacy code, indeed. > Dog's breakfast, more like. I'm not surprised the OP is having trouble refactoring the database govne the code that accesses it at the moment.
regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list