Re: Prepared Statements
Karsten Hilbert <[email protected]>
| Newsgroups | gmane.comp.python.db.pypgsql.user |
|---|---|
| Message-ID | <[email protected]> |
> 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 -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf