From: Luc S. <luc...@ad...> - 2003-07-03 13:23:18
|
I put some data in a table, which has a record of type 'bytea'. I inserted that data using the PgSQL.PgQuoteBytea method. When I want to extract the data, (I guess) I need, just after retrieving the result(s) from a SELECT, to use PgSQL.PgUnQuoteBytea. But when I use it, I get the error "PgUnQuoteString() argument 1 must be string, not instance' ". Doing a "print myinstance.__class__" prints 'pyPgSQL.PgSQL.PgBytea'. So I guess it's ok, so why do I get an error? Here is the snippet of code I used: =========== recup = """SELECT docbody FROM docs where docid=%s """ % PgSQL.PgQuoteString(form.getvalue('docid')) cur.execute(recup) res = cur.fetchall() print PgSQL.PgUnQuoteBytea(res[0]['docbody']) =========== Looking at the documentation for the methods, I see that PgUnQuoteBytea takes a string as parameter (!?), so if I try to stringify it, I get the following error: "Bad input string for type bytea", doing this: =========== c = `res[0]['docbody']` d = PgSQL.PgUnQuoteBytea(c) =========== Any idea? Thanks, Luc Stepniewski |