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

Mark Trostler mark at zzo.com
Fri Mar 14 20:57:55 GMT 2008


I had some problem with using double single quotes - which I cannot 
remember now - so ended up using char(39) although after some playing 
the double single quote thing seems to be working fine too...
	Mark

Ash Berlin wrote:
> 
> 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
> 
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: 
> http://www.grokbase.com/group/dbix-class@lists.rawmode.org
> 
> 



More information about the DBIx-Class mailing list