[Zope] zmysqlda + python

Andy Dustman andy@dustman.net
Thu, 5 Jul 2001 12:50:04 -0400 (EDT)


On Wed, 4 Jul 2001, Tamas Amon wrote:

> How can I use zmysqlda object (name is MSQL) in a python-script?

I have never tried to do this myself. However, the only useful method is
likely to be query():

    def query(self,query_string, max_rows=1000):
        """Execute 'query_string' and return at most 'max_rows'."""

This returns two items: a list of dictionaries, which describe the columns
returned; and a tuple (rows) of tuples (columns). This is generally true
of all DA, though you might want to consider the tuples to be sequences
(other DAs may return lists).

The query_string must be the complete query, with all quoting and escaping
done.

You are probably better off, however, creating Z SQL Methods and calling
those from your Python Script.

-- 
Andy Dustman         PGP: 0xC72F3F1D
    @       .net     http://dustman.net/andy
I'll give spammers one bite of the apple, but they'll
have to guess which bite has the razor blade in it.