Re: PQescapeLiteral in Libpq - Mailing list pgsql-novice

From David Johnston
Subject Re: PQescapeLiteral in Libpq
Date
Msg-id 1389296138266-5786147.post@n5.nabble.com
Whole thread Raw
In response to PQescapeLiteral in Libpq  ("lmanorders" <lmanorders@gmail.com>)
Responses Re: PQescapeLiteral in Libpq  ("lmanorders" <lmanorders@gmail.com>)
List pgsql-novice
lmanorders wrote
> I'm using the libpq.dll libraries to connect to postgress. When I issue a
> call to PQescapeLiteral with a file path as the argument, the result
> string seems to always start with a bogus " E". For example, "C:\MyFile"
> is returned as " E'C:\\:MyFile'" (not including the double quotes). Is
> this a normal result or can't PQescapeLiteral be used to escape a file
> path literal? If not, are there any functions that can be used to "escape"
> a file path?
>
> Thanks, Lynn

What do you expect it to give in this instance?

I don't get why there is an extra colon in your output (typo on your part?)
but the "E" and the double-backslash are present because the "E" converts
the literal into one that accepts escape sequences (of the form
backslash-something, e.g., \n for a newline).  Since backslash is an escape
indicator in order to output a literal "\" you have to double/escape it
"\\".

David J.




--
View this message in context: http://postgresql.1045698.n5.nabble.com/PQescapeLiteral-in-Libpq-tp5786141p5786147.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.


pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: PQescapeLiteral in Libpq
Next
From: "lmanorders"
Date:
Subject: Re: PQescapeLiteral in Libpq