From: | Tod McQuillin <devin(at)spamcop(dot)net> |
---|---|
To: | Vincent Stoessel <vincent(at)xaymaca(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: escaping arrays in perl dbi |
Date: | 2002-05-09 14:36:15 |
Message-ID: | Pine.GSO.4.44.0205090932520.8544-100000@sysadmin |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Heiko | 2002-05-09 14:37:31 | Bad time external representation '' |
Previous Message | Vincent Stoessel | 2002-05-09 14:12:11 | escaping arrays in perl dbi |