Re: [Zope-DB] blobs and dtml-sqlvar
----- Original Message ----- From: "e deleflie" <edeleflie@gmail.com> To: <zope-db@zope.org> Sent: Friday, June 01, 2007 7:58 PM Subject: [Zope-DB] blobs and dtml-sqlvar
I'm using MySQLDBA, and I've got a Z SQL Method like this:
select * from myTable where someValue=<dtml-sqlvar myValue type=string>
The issue being that 'myValue' is actually a Hex value in a Blob column. The only types possible for dtml-sqlvar seem to be string and int (as far as I can tell).
I noticed that when I use 'type=string' the value is always placed in inverted commas (and so MySQL thinks it is a string and rejects it).... and when I put 'type=int' the Hex value is rejected by Zope.
Is it possible that MySQLDBA can not handle blobs / Hex values at all? I'm confused that dtml-sqlvar only sees 2 types of data.
I use ZMySQLDA quite a bit, but I have never used a blob column. According to the documentation the available types are: string, int, float and nb. I had a quick look through the ZMySQLDA source code and saw blob types being defined, but didn't see (during my quick look) how they were being used. So... try the 'nb' type and if that does not work, have a look at the source code and see how the blob types are being used. Not a whole lot of help, but maybe point you in a direction... Good Luck! Jonathan
I'm using MySQLDBA, and I've got a Z SQL Method like this:
select * from myTable where someValue=<dtml-sqlvar myValue type=string>
The issue being that 'myValue' is actually a Hex value in a Blob column. The only types possible for dtml-sqlvar seem to be string and int (as far as I can tell).
I noticed that when I use 'type=string' the value is always placed in inverted commas (and so MySQL thinks it is a string and rejects it).... and when I put 'type=int' the Hex value is rejected by Zope.
Is it possible that MySQLDBA can not handle blobs / Hex values at all? I'm confused that dtml-sqlvar only sees 2 types of data. I have no idea how this works with mysql but in postgres I've used:
ZSQL: update company set logo=<dtml-var logo>::bytea where companyid=<dtml-sqlvar companyid type="int"> Python Script: from psycopg2 import Binary picture = container['logo.gif'].data # Image object container.set_logo(companyid=companyid, logo = Binary( obraz )) Maybe there is something similiar in MySQLDB. -- Maciej Wisniowski
participants (2)
-
Jonathan -
Maciej Wisniowski