Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id A4B1A4763C9 for ; Thu, 9 May 2002 10:43:46 -0400 (EDT) Received: from sysadmin.chi.ubsw.com (sysadmin.chi.ubswarburg.com [146.180.1.66]) by postgresql.org (Postfix) with ESMTP id 6311A47597B for ; Thu, 9 May 2002 10:36:16 -0400 (EDT) Received: from devin by sysadmin.chi.ubsw.com with local (Exim 3.12 #2) id 175p1k-0002NV-00; Thu, 09 May 2002 09:36:16 -0500 Date: Thu, 9 May 2002 09:36:15 -0500 (CDT) From: Tod McQuillin X-X-Sender: devin@sysadmin To: Vincent Stoessel Cc: pgsql-sql@postgresql.org Subject: Re: escaping arrays in perl dbi In-Reply-To: <3CDA83BB.5000006@xaymaca.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200205/77 X-Sequence-Number: 7713 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