From: Ben L. <pyp...@zu...> - 2003-04-14 16:38:31
|
Thank-very much for your help Gerhard and Karsten. I've just implemented the code suggested by Gerhard and it does exactly what I require. It can see it should work with the Bytea stuff but I need to make some more changes to by app before I can test that. Thanks again, Ben. P.S. If anyone is writing web apps I can highly recommend the combination Postgres, pyPgSQL and mod_python. It runs extremely quickly on four year old hardware. On Monday 14 Apr 2003 2:42 pm, Karsten Hilbert wrote: > > sql = "UPDATE %s SET " % bizobj.table > > for field in bizobj.fields: > > sql += "%s = '%s' " % (field.name, field.value) > > sql += ";" > > I always had to use > > sql = "update table set field=%s;" > cursor.execute(sql, PgBytea(value)) > > with bytea data. It didn't work the other way. > > Note that it is permissible to have more formatters in a > string than there are values to replace them. Just be careful > to replace the right ones at the right time. > > > TypeError: query() argument 1 must be string without null bytes, not str > > '%s' % value will in effect insert str(value) which isn't > right for ByteA. > > Karsten |