cvs: pear /DB/DB mysql.php mysqli.php

From: Date: Fri, 09 Jun 2006 11:58:57 +0000
Subject: cvs: pear /DB/DB mysql.php mysqli.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-40596@lists.php.net to get a copy of this message
danielc Fri Jun 9 11:58:57 2006 UTC Modified files: /pear/DB/DB mysql.php mysqli.php Log: * Add ability to escape backticks in identifiers. Bug 7737. http://cvs.php.net/viewcvs.cgi/pear/DB/DB/mysql.php?r1=1.119&r2=1.120&diff_format=u Index: pear/DB/DB/mysql.php diff -u pear/DB/DB/mysql.php:1.119 pear/DB/DB/mysql.php:1.120 --- pear/DB/DB/mysql.php:1.119 Sat Apr 8 12:51:00 2006 +++ pear/DB/DB/mysql.php Fri Jun 9 11:58:57 2006 @@ -20,7 +20,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: mysql.php,v 1.119 2006/04/08 12:51:00 danielc Exp $ + * @version CVS: $Id: mysql.php,v 1.120 2006/06/09 11:58:57 danielc Exp $ * @link http://pear.php.net/package/DB */ @@ -752,9 +752,10 @@ /** * Quotes a string so it can be safely used as a table or column name + * (WARNING: using names that require this is a REALLY BAD IDEA) * - * MySQL can't handle the backtick character (<kbd>`</kbd>) in - * table or column names. + * WARNING: Older versions of MySQL can't handle the backtick + * character (<kbd>`</kbd>) in table or column names. * * @param string $str identifier name to be quoted * @@ -765,7 +766,7 @@ */ function quoteIdentifier($str) { - return '' . $str . ''; + return '' . str_replace('', '`', $str) . ''; } // }}} http://cvs.php.net/viewcvs.cgi/pear/DB/DB/mysqli.php?r1=1.71&r2=1.72&diff_format=u Index: pear/DB/DB/mysqli.php diff -u pear/DB/DB/mysqli.php:1.71 pear/DB/DB/mysqli.php:1.72 --- pear/DB/DB/mysqli.php:1.71 Thu Mar 2 08:12:17 2006 +++ pear/DB/DB/mysqli.php Fri Jun 9 11:58:57 2006 @@ -19,7 +19,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: mysqli.php,v 1.71 2006/03/02 08:12:17 lsmith Exp $ + * @version CVS: $Id: mysqli.php,v 1.72 2006/06/09 11:58:57 danielc Exp $ * @link http://pear.php.net/package/DB */ @@ -823,9 +823,10 @@ /** * Quotes a string so it can be safely used as a table or column name + * (WARNING: using names that require this is a REALLY BAD IDEA) * - * MySQL can't handle the backtick character (<kbd>`</kbd>) in - * table or column names. + * WARNING: Older versions of MySQL can't handle the backtick + * character (<kbd>`</kbd>) in table or column names. * * @param string $str identifier name to be quoted * @@ -836,7 +837,7 @@ */ function quoteIdentifier($str) { - return '' . $str . ''; + return '' . str_replace('', '`', $str) . ''; } // }}}

« previous php.pear.cvs (#40596) next »