[Zope-dev] Using db_connections from Zope products

Tom Brown altafare@yahoo.com
Wed, 20 Jun 2001 09:56:23 -0700 (PDT)


Thanks fo the info!  I had seen those How-Tos... but
was really asking.. How can I use APIs directly
instead of having an External ZSQL method.  I have
created a product and would like to be able to do sql
queries in order to populate members of my class.  For
this example, I have the creation of  a selection box
as a member and the options will be generated by a
select statement.
I have gone through the product creation how to and
was able to add, etc, my object.  I can display html,
make dtml on the fly, etc.. from an object, just
wanted to do a query as well.   .. would like to be
able to do something like the Connection class without
management interface, etc, or use pieces, just not
sure how

--- Jim Penny <jpenny@universal-fasteners.com> wrote:
> On Wed, Jun 20, 2001 at 08:54:41AM -0700, Tom Brown
> wrote:
> > I would like to make an SQL query directly from
> python
> > code.  Do I have to make a 
> > ZSQL Method dynamically, or is there another way
> > without making the class database 
> > dependent (i.e. Gadfly, PoPy, etc), utilizing an
> > existing db_con?  Suppose I am using the ZPoPy DA
> and 
> > have established a database connection externally.
> 
> > How can I access this database 
> > and submit a query from my own class?
> 
> You can use an established connection.
> 
> If it is ZSQL based, you will have to deal with the
> results
> object. 
> 
> A good overview of the results object is
> http://www.zope.org/Members/spinwing/ZSQL_Results
> 
> You might also look at the somewhat dated
>
http://www.zope.org/Members/jpenny/Accessing_a_ZSQL_Method_from_an_External_Method
> 
> This would work from Script (Python), as well.
> 
> Jim Penny 
> 
> > 
> > Thanks,
> > Tom Brown
> > altafare@yahoo.com
> > 


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/