Search Postgresql Archives

Re: standard_conforming_strings and pg_escape_string()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Conrad Lender <crlender@xxxxxxxxx> writes:
> I'm using PostgreSQL 8.3 with PHP's "pgsql" module (libpq 8.3.7). When
> the server's standard_conforming_strings setting is off (this is
> currently still the default, I believe), I use something like this to
> escape strings:

>   if ($escWildcards) {
>     $str = strtr($str, array("%" => '\%', "_" => '\_'));
>   }
>   return "E'" . pg_escape_string($str) . "'";

The above cannot possibly work.  pg_escape_string is generating what it
supposes to be a normal string literal, and then you are sticking an 'E'
on the front which changes the escaping rules.  It is not the function's
fault that this fails.

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux