[Dbix-class] Error with escaped apostrophe and bind param

Ash Berlin ash_cpan at firemirror.com
Fri Mar 14 19:55:40 GMT 2008


On 14 Mar 2008, at 19:36, Mark Trostler wrote:

> the quote() function is quite lame in my experience - for raw SQL I  
> use:
>
>    # get rid of any backshlased single quotes
>    $value =~ s/\\'/'/g;
>
>    # Fixup regular single quotes
>    $value =~ s/'/', char(39), '/g;
>
>    # Get rid of question marks
>    $value =~ s/\?/', char(63), '/g;
>
> So "What's up" ends up like: 'What', char(39), 's up'
>
> 	Mark
>
>

Not condoning quoting stuff yourself at all, but why not 'What''s up' ?

mysql> select 'What''s up' \G
*************************** 1. row ***************************
What's up: What's up
1 row in set (0.00 sec)


I'm fairly positive this is what the SQL standard says you should do  
too.

-ash



More information about the DBIx-Class mailing list