Re: escaping arrays in perl dbi

Поиск
Список
Период
Сортировка
От Vincent Stoessel
Тема Re: escaping arrays in perl dbi
Дата
Msg-id 3CDAE35C.6000109@xaymaca.com
обсуждение исходный текст
Ответ на Re: escaping arrays in perl dbi  (Tod McQuillin <devin@spamcop.net>)
Список pgsql-sql
Thank you everyone for all of the great answers.

Dave Carrigan wrote:
> Tod McQuillin <devin@spamcop.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



В списке pgsql-sql по дате отправления:

Предыдущее
От: Gabriel Dovalo Carril
Дата:
Сообщение: Re: Can this query be faster?
Следующее
От: Ian Barwick
Дата:
Сообщение: Re: escaping arrays in perl dbi