From: | Vincent Stoessel <vincent(at)xaymaca(dot)com> |
---|---|
To: | Dave Carrigan <dave(at)rudedog(dot)org> |
Cc: | Tod McQuillin <devin(at)spamcop(dot)net>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: escaping arrays in perl dbi |
Date: | 2002-05-09 21:00:12 |
Message-ID: | 3CDAE35C.6000109@xaymaca.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Thank you everyone for all of the great answers.
Dave Carrigan wrote:
> Tod McQuillin <devin(at)spamcop(dot)net> writes:
>
>
>>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.
>
>
> This is the best way to do it, but you can shorten it with:
>
> $dbh->do("update basket set f_order = ? where cap = ?",
> undef, '{"apple",0}', 'I');
>
> If you don't want to use the parameterized mechanism, Perl's qq operator
> is your friend:
>
> $dbh->do(qq(update basket set f_order = {"apple",0} where cap = 'I'));
>
--
Vincent Stoessel
Linux Systems Developer
vincent xaymaca.com
From | Date | Subject | |
---|---|---|---|
Next Message | Ian Barwick | 2002-05-09 23:09:27 | Re: escaping arrays in perl dbi |
Previous Message | Mike Diehl | 2002-05-09 19:21:42 | Re: having trouble w/ having clause... |