Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 6E9D2475C1E for ; Thu, 9 May 2002 11:29:17 -0400 (EDT) Received: from mail.rudedog.org (vp242.dmp01.sea.blarg.net [206.124.142.242]) by postgresql.org (Postfix) with ESMTP id E401E476421 for ; Thu, 9 May 2002 11:28:43 -0400 (EDT) Received: from cbgb.rudedog.org (cbgb.rudedog.org [192.168.200.16]) by mail.rudedog.org (Postfix) with ESMTP id 7775F5EB26; Thu, 9 May 2002 08:28:46 -0700 (PDT) Received: by cbgb.rudedog.org (Postfix, from userid 1000) id BA0C26B5FE; Thu, 9 May 2002 08:28:43 -0700 (PDT) To: Tod McQuillin Cc: Vincent Stoessel , pgsql-sql@postgresql.org Subject: Re: escaping arrays in perl dbi References: From: Dave Carrigan Organization: Rudedog.org Date: 09 May 2002 08:28:43 -0700 In-Reply-To: Message-ID: <87lmattk5w.fsf@cbgb.rudedog.org> Lines: 24 User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200205/98 X-Sequence-Number: 7734 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')); -- Dave Carrigan (dave@rudedog.org) | Yow! Why am I in this ROOM in UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-DNS | DOWNTOWN PHILADELPHIA? Seattle, WA, USA | http://www.rudedog.org/ |