On Thu, 9 May 2002, Vincent Stoessel wrote:
> I am trying to figure out how I need to change the string below in
> order to do an insert into my table using perl dbi. perl seems to choke
> on the curly brackets. Any help would be appriciated.
>
> $dbh->do("update basket set f_order ='{"apple",0}' where cap ='I'");
You are using double quotes as your string delimiter, and also double
quotes inside it.
Probably this would work:
$dbh->do("update basket set f_order ='{\"apple\",0}' where cap ='I'");
or this:
$dbh->do(qq/update basket set f_order ='{"apple",0}' where cap ='I'/);
But try using DBI parameters like this:
$dbh->prepare("update basket set f_order = ? where cap = ?");
$dbh->execute('{"apple",0}', 'I');
DBI should take care of all the quoting and escaping for you.
--
Tod McQuillin