From: Gerhard <ger...@op...> - 2002-11-13 12:41:51
|
In article <200...@da...>, Mike Barrett wrote: > Howdy, so here's my problem: I've got a database with a bunch > of info in it. One of the fields is a 'text' field. Whenever > I extract data from this field it seems to work out fine, > however, this isn't the case whenever there are both > apastrophies and double-quotes in the text. If both appear > inside the field, then all of the apastrophies are escaped with > a single backslash. Can't reproduce that here (pyPgSQL 2.2): *Schema:* gerhard=# \d test Table "test" Column | Type | Modifiers --------+------+----------- a | text | *Code:* from pyPgSQL import PgSQL con = PgSQL.connect(host="localhost", database="gerhard", user="gerhard") cursor = con.cursor() x = """Hello, "pyPgSQL" user! What's up?""" cursor.execute("insert into test(a) values (%s)", (x,)) cursor.execute("select a from test where oid=%s", (cursor.oidValue,)) row = cursor.fetchone() assert(row.a == x) con.close() Can you provide a test case that demonstrates the problem? > Any idea why it's doing this? Any idea how I can change this > behavior? Maybe a PgUnQuoteString-like method or something? Nah. This should work transparently. No need to use the low-level methods once you're using PgSQL. -- Gerhard Häring OPUS GmbH München Tel.: +49 89 - 889 49 7 - 32 http://www.opus-gmbh.net/ |