[Phpmyadmin-devel] sqlAddSlashes

Marc Delisle marc at infomarc.info
Tue Jun 25 14:22:54 CEST 2013


Ayush Chaudhary a écrit :
> Hi, 
> 
> I was setting up some unit tests when I came across the function PMA_Util::sqlAddSlashes() Isn't it supposed to add slashes to single quotes? Because I tested this:
> 
> echo PMA_Util::sqlAddSlashes("pma_'db");
> 
> And the output was pma_''db
> 
> Is this the correct behaviour? 

Hi Ayush,
yes this is correct, see [0]. "A “'” inside a string quoted with “'” may 
be written as “''”. "

However, this function could be renamed escapeForSql() or something like 
that.

[0] 
http://dev.mysql.com/doc/refman/5.5/en/string-literals.html#character-escape-sequences

-- 
Marc Delisle
http://infomarc.info




More information about the Developers mailing list