[Zope] importing data to mysql from zope

Michel Pelletier michel@digicool.com
Thu, 29 Jul 1999 09:37:41 -0400


> -----Original Message-----
> From: ainis [mailto:ainis@impro.mii.lt]
> Sent: Thursday, July 29, 1999 5:26 AM
> To: zope@zope.org
> Subject: [Zope] importing data to mysql from zope
> 
> 
> Well, it's easy to pass variables to ZSQL Methods and create 
> new records
> in this way in database.
> The question is:
>     Is there any way to pass whole data files to be imported to the
> database? I know "LOAD DATA bla bla bla" stuff but this is 
> done from the
> mysql client. The whole point would be doing this from browser.
> 

By whole data fields do you mean elements of an HTML list?  This is
quite easy.  Configure a ZSQL method called 'mySQLMethod' to accept a
number of arguments, let's call them 'a', 'b', and 'c'.

Now create a form:

<form action="insertData">
<input name="a">
<input name="b">
<input name="c">
<input type=submit value=" Click ">

Then a DTML method called 'insertData' containing:

<!--#call mySQLMethod-->

'mySQLMethod' will automagicly look in the namespace of the REQUEST for
the values of a b and c.  Since a b and c were passed into insertData in
a form, it will find them there.

This is equivelent to calling the ZSQL method like this:

<!--#call "mySQLMethod(a=a, b=b, c=c)"-->

-Michel

> Any ideas?
> 
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
> 
> (To receive general Zope announcements, see:
> http://www.zope.org/mailman/listinfo/zope-announce
> 
> For developer-specific issues, zope-dev@zope.org -
> http://www.zope.org/mailman/listinfo/zope-dev )
>