Mailing List Archive

Re: How do I use my archetypes-generated form to insert datainto a mysql table?
----- Original Message -----
From: "Anna Falkowska" <afalkows@umich.edu>
To: <zope-db@zope.org>
Sent: Monday, October 16, 2006 8:13 AM
Subject: [Zope-DB] How do I use my archetypes-generated form to insert
datainto a mysql table?


>I made a form using ArchGenXML and want to use it to populate a table
> in a mysql database. So far I have not come across a good tutorial on
> how to do this. Someone suggested I use ZSQL methods. I understand how
> to create them, but how exactly would I call a ZSQL method with the
> information from my form?

You can use a python script or external method (or even a dtml method) to
access the form data and make the call to the zsql method. Here is an
example I have pulled from an external method:

rStat=self.Users.SQL_SearchUsers(UID=self.REQUEST['userId'])
if not rStat.dictionaries():
# no user account, log error, error return
SysEventsLogger(self, ....)
return (RFAIL, 0)

# here if we found some user record data, so build the return dictionary
dictList = rStat.dictionaries()
...

In the above example, 'userId' is a form field.

hth

Jonathan


_______________________________________________
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db