Re: escaping arrays in perl dbi
| От | Tod McQuillin |
|---|---|
| Тема | Re: escaping arrays in perl dbi |
| Дата | |
| Msg-id | Pine.GSO.4.44.0205090932520.8544-100000@sysadmin обсуждение исходный текст |
| Ответ на | escaping arrays in perl dbi (Vincent Stoessel <vincent@xaymaca.com>) |
| Ответы |
Re: escaping arrays in perl dbi
|
| Список | 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
В списке pgsql-sql по дате отправления: