[Zope] DB connection + External Method

Casey Duncan casey@zope.com
Mon, 1 Jul 2002 09:35:00 -0400


On Monday 01 July 2002 06:41 am, Ruslan Spivak wrote:
> Hello zope users,
>=20
> I have a question: how can I use DB Connection in Zope folder from
> within an External Method?
>=20
> Any suggestions will be appreciated.
>=20
> Best regards,
>  Ruslan                          mailto:alienoid@is.lg.ua

Here's a sample for ya:

def useSQL(self):
    """Query a database adapter in an external method"""
    db =3D self.my_database_adapter()
    i, results =3D db.query('select * from my_table')
    for record in results:
        print record.my_field

hth,

-Casey
   =20