[Zope] ZSQL newbie question

Dieter Maurer dieter@handshake.de
Wed, 21 Jun 2000 22:56:56 +0200 (CEST)


kamon ayeva writes:
 > I have a text file object containing data I want to use to update a MySQL 
 > table.
 > I can get the data using the LocalFS object product and the howto from 
 > jfarr, but I don't know how to use ZSQL method and DTML method to inject 
 > this data in the table.
You should know (or learn) a bit of SQL, especially the SQL
"insert" command. You should have had a look into
the Z SQL Methods User Guide (--> zope.org/Documentation).

After that, only a tiny bit is missing:

  you file object will provide a method "read".
  You can use it to return the file content as a string.
  You put this string on a parameter position for
  an SQL insert. Something like:
 
	<dtml-call "sqlinsert(...,data=file.read())">

  As you probably expect, I used "sqlinsert" for
  your Z SQL method that uses the SQL "insert" command to
  insert a new row into a table and "file" for your
  file object. The "..." stand for the other arguments
  and values, that define the remaining fields in your
  table.

  Note the "...". These double quotes are essential.



Dieter