Re: Re: Escaped apastrophes

Mike Barrett <[email protected]>
Newsgroups gmane.comp.python.db.pypgsql.user
Message-ID <[email protected]>
Actually, this ended up being a mistake on my part.  I was just looking at
the returned values in the python interpreter, rather than actually comparing
or printing them.  Thanks for your help :)

On Wed, Nov 13, 2002 at 12:38:06PM +0000, Gerhard H?ring wrote:
> In article <[email protected]>, 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/
> 
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by: Are you worried about 
> your web server security? Click here for a FREE Thawte 
> Apache SSL Guide and answer your Apache SSL security 
> needs: http://www.gothawte.com/rd523.html
> _______________________________________________
> Pypgsql-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pypgsql-users

-- 
     ________________________________________________________________________
                Mike Barrett | "I used to read, now I go to raves."
             [email protected] | -- Random MUNI Rider, speaking
              www.daboyz.org |    to my friend Allison.
     ------------------------+-----------------------------------------------


-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing 
your web site with SSL, click here to get a FREE TRIAL of a Thawte 
Server Certificate: http://www.gothawte.com/rd524.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.