[Zope] blob and ZMySQLDA

John Hunter jdhunter@ace.bsd.uchicago.edu
Tue, 01 Jan 2002 15:46:38 -0600


I am trying to create a user interface in zope to a mysql database
that has a BLOB entry.  I would like the user to be able to specify a
file on the user's filesystem, and put that binary file into the
database.

I am not sure how best to do this.  Does anyone have an example of an
SQL method or external method that takes a file from the users system
and puts it in as a binary blob into and SQL database?

Is it possible to do without first loading entire the contents of the
file into memory?

I first tried to write an SQL method


INSERT INTO eeg VALUES (
       <dtml-sqlvar id type="int">,
       <dtml-sqlvar eeg type="blob">,  #this is no good
       <dtml-sqlvar description type="string">
       );
But was not sure how to handle the blob type.  This led me to believe
       that I would have to use and External Method rather than an SQL
       Method.

Suggestions?

Thanks,
John Hunter