[Zope-DB] Re:

Simon.Price@trendcomms.com Simon.Price@trendcomms.com
Mon, 9 Jun 2003 15:13:37 +0100


Alex,

thanks for the reply.

Yes I agree, the method you have described is really easy and I have no
problem doing it that way.
However, I am writing this as a bundled product, so just as you downloaded
the ZMySQLDA adapter, and all you have to do is add a ZMySQL database
connection, that is how I wish my final product to be installed - as a
complete bundle, without the end user having to add  Zmysql methods to
folders, etc..

To do this you write your app as a python product and install it in the
<zope directory>/lib/python/products directory.
Now I believe from within your python scripts you can make calls to the
ZmySQLDA directly to add a connection and to pull off queries, by making
calls the DA.py manage_addZMySQLConnection function and the db.py query
function that comes with the ZMySQLDA product. I am just having problems
with the syntax of these calls from within the scope of a python product.

These queries can then be called and accessed by dtml exactly as you
described.

So in summary I am looking for an example of how to script the adding of a
ZMysql database connection and method, rather than adding them through the
Zope Management interface.

many thanks

simon



                                                                                                                                       
                      "Alex Cowan"                                                                                                     
                      <alex@funcom.com         To:      <zope-db@zope.org>, <Simon.Price@trendcomms.com>                               
                      >                        cc:                                                                                     
                                               Subject: Re: [Zope-DB] Help !! Using ZMysqlDA from a Zope Product                       
                      09/06/2003 14:40                                                                                                 
                                                                                                                                       
                                                                                                                                       




Hmm I'm not sure exactly what you're asking.

Pulling data from a MySQL database with zope is relatively easy, you just
need a ZMysqlDB connection, a Z SQL Method and a DTML Document.

Once you have those you write the query you want in the Z SQL Method and in
the DTML Document is something like

<dtml-in ZSQLMethodname>
<dtml-var column1>
<dtml-var column2>
<dtml-var column3>
</dtml-in>

You can put html etc around the dtml tags to format the output as you want.
If you could write a bit more about exactly what you want (what you are
trying to do, what you are using) I may be able to help more.

Alex

----- Original Message -----
From: <Simon.Price@trendcomms.com>
To: <zope-db@zope.org>
Sent: Monday, June 09, 2003 3:24 PM
Subject: [Zope-DB] Help !! Using ZMysqlDA from a Zope Product


> Hi all,
>
> I am relatively new to Zope, so if this is a basic question please
forgive
> me.
>
> I am writing an app as a Zope product and would like to use mysql as the
> backend database.
> I can pull the data out of mysql using standard Mysqldb python calls,
> however manipulating the results in DTML is proving to be a nightmare.
> So I would like to be able to make calls using the
> "manage_addZMySQLConnection".
>
> Has anybody used this method from within a product and if so, would they
> mind providing me with an example of how to connect, and make a query.
>
> Many thanks
>
> simon
>
>
>
__________________________________________________________________________
>
> Trend Communications Ltd.
> Knaves Beech Estate, Loudwater, Bucks, HP10 9QZ, United Kingdom.
> Tel: +44 1628 524977.
> Fax: +44 1628 810094 (not for confidential documents).
>
> Web: http://www.trendcomms.com
>
> No liability is accepted by Trend Communications Ltd for any loss or
damage
> incurred through use of this email.
>
>
>
> ________________________________________________________________________
> This email has been scanned for all viruses by the MessageLabs SkyScan
> service on behalf of Trend Communications Ltd.
>
> _______________________________________________
> Zope-DB mailing list
> Zope-DB@zope.org
> http://mail.zope.org/mailman/listinfo/zope-db
>


________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service on behalf of Trend Communications Ltd.



__________________________________________________________________________

Trend Communications Ltd.
Knaves Beech Estate, Loudwater, Bucks, HP10 9QZ, United Kingdom.
Tel: +44 1628 524977.
Fax: +44 1628 810094 (not for confidential documents).

Web: http://www.trendcomms.com

No liability is accepted by Trend Communications Ltd for any loss or damage
incurred through use of this email.



________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service on behalf of Trend Communications Ltd.