Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id EA263475AF9 for ; Thu, 9 May 2002 17:01:48 -0400 (EDT) Received: from www.optimumdigital.com (unknown [64.245.24.5]) by postgresql.org (Postfix) with ESMTP id 653FB475A41 for ; Thu, 9 May 2002 17:01:47 -0400 (EDT) Received: from xaymaca.com ([63.115.42.161]) by www.optimumdigital.com (8.11.6/8.11.6) with ESMTP id g49KrgH26429; Thu, 9 May 2002 16:53:42 -0400 Message-ID: <3CDAE35C.6000109@xaymaca.com> Date: Thu, 09 May 2002 17:00:12 -0400 From: Vincent Stoessel User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0+) Gecko/20020505 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Dave Carrigan Cc: Tod McQuillin , pgsql-sql@postgresql.org Subject: Re: escaping arrays in perl dbi References: <87lmattk5w.fsf@cbgb.rudedog.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Archive-Number: 200205/82 X-Sequence-Number: 7718 Thank you everyone for all of the great answers. Dave Carrigan wrote: > Tod McQuillin 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