cvs: pear /DB/DB pgsql.php
| From: | Adam Harvey | Date: | Fri, 12 Jan 2007 05:45:09 +0000 |
| Subject: | cvs: pear /DB/DB pgsql.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-44201@lists.php.net to get a copy of this message | ||
aharvey Fri Jan 12 05:45:09 2007 UTC
Modified files:
/pear/DB/DB pgsql.php
Log:
Updated DB_pgsql::escapeSimple() to use pg_escape_string if available.
http://cvs.php.net/viewvc.cgi/pear/DB/DB/pgsql.php?r1=1.133&r2=1.134&diff_format=u
Index: pear/DB/DB/pgsql.php
diff -u pear/DB/DB/pgsql.php:1.133 pear/DB/DB/pgsql.php:1.134
--- pear/DB/DB/pgsql.php:1.133 Fri Jan 12 02:41:07 2007
+++ pear/DB/DB/pgsql.php Fri Jan 12 05:45:09 2007
@@ -21,7 +21,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: pgsql.php,v 1.133 2007/01/12 02:41:07 aharvey Exp $
+ * @version CVS: $Id: pgsql.php,v 1.134 2007/01/12 05:45:09 aharvey Exp $
* @link http://pear.php.net/package/DB
*/
@@ -502,9 +502,6 @@
* {@internal PostgreSQL treats a backslash as an escape character,
* so they are escaped as well.
*
- * Not using pg_escape_string() yet because it requires PostgreSQL
- * to be at version 7.2 or greater.}}
- *
* @param string $str the string to be escaped
*
* @return string the escaped string
@@ -514,7 +511,11 @@
*/
function escapeSimple($str)
{
- return str_replace("'", "''",
str_replace('\\', '\\\\', $str));
+ if (function_exists('pg_escape_string')) {
+ return pg_escape_string($str);
+ } else {
+ return str_replace("'", "''",
str_replace('\\', '\\\\', $str));
+ }
}
// }}}