ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> zope-List
zope-List
Re: [Zope] Getting a Mysqldb.Connection objetct form ZMySAQLDA
by Gilles Lenfant other posts by this author
Dec 16 2002 5:50PM messages near this date
Re: [Zope] Getting a Mysqldb.Connection objetct form ZMySAQLDA | Re: [Zope] Getting a Mysqldb.Connection objetct form ZMySAQLDA
Martin,

Yes, it would be very useful to get a DB API compliant Connection object
from a Zope DA. There are so many "goodies" for Python I can get from a
MySQLdb.Connection object that are not available from a ZMySQLDA.
The SQL query is built dynamically in a method of a Python product. I really
need this to get from the cursor object some data I *cannot* get from ZSQL
method (like the last autoincrement insert row).
It's very shorter to write...
cursor = dbconnect.cursor()
cursor.execute("update mytable...", (data, data...))
Using the method you suggest is overkill. (why make it simple when you can
have it complicated :-)
Okay, I'm gonna parse the ZMySQLDA connection string to get my own DB API
Connection object.

Cheers

--Gilles

PS : please CC your replies to zope@[...].org

----- Original Message -----
From: "Martin Gebert" <Murphy@[...].de> 
To: "Gilles Lenfant" <gilles@[...].net> 
Sent: Monday, December 16, 2002 5:02 PM
Subject: Re: [Zope] Getting a Mysqldb.Connection objetct form ZMySAQLDA


>  AFAIK ZMySQLDA uses the underlying _mysql class directly, not the Python
>  DB API compliant MySQLdb class (any votes against that?).
>  What's the problem with your query string? Why can't you use Z SQL
>  Methods? You know you can build the SQL statements with DTML constructs?
> 
>  Martin
> 
>  Gilles Lenfant schrieb:
> 
>  >Hi,
>  >
>  >Is it possible to get a MySQLdb.Connection object from a ZMySQLDA object
?
>  >I need this because my Python product builds the query string dynamically
>  >and a ZSQL Method is not suitable for this.
>  >Or should I parse the connection string and build my own Connection
object ?
>  >
>  >Thanks in advance for your help
>  >
>  >--Gilles
>  >
>  >
>  >
>  >
>  >_______________________________________________
>  >Zope maillist  -  Zope@[...].org
>  >http://lists.zope.org/mailman/listinfo/zope
>  >**   No cross posts or HTML encoding!  **
>  >(Related lists -
>  > http://lists.zope.org/mailman/listinfo/zope-announce
>  > http://lists.zope.org/mailman/listinfo/zope-dev )
>  >
>  >
>  >
>  >
> 
> 
> 



_______________________________________________
Zope maillist  -  Zope@[...].org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )
Thread:
Gilles Lenfant
Dieter Maurer
Gilles Lenfant
Martin Gebert

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved