Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 912B7475CA9 for ; Thu, 21 Nov 2002 14:52:23 -0500 (EST) Received: from mail01.svc.cra.dublin.eircom.net (mail01.svc.cra.dublin.eircom.net [159.134.118.17]) by postgresql.org (Postfix) with SMTP id 85B0C475B33 for ; Thu, 21 Nov 2002 14:52:22 -0500 (EST) Received: (qmail 66747 messnum 118724 invoked from network[159.134.166.182/p694.as1.limerick1.eircom.net]); 21 Nov 2002 19:52:22 -0000 Received: from p694.as1.limerick1.eircom.net (HELO dansat.data-plan.com) (159.134.166.182) by mail01.svc.cra.dublin.eircom.net (qp 66747) with SMTP; 21 Nov 2002 19:52:22 -0000 Received: from dansat.data-plan.com (localhost [127.0.0.1]) by dansat.data-plan.com (8.12.6/8.12.6) with ESMTP id gALJqOao021036; Thu, 21 Nov 2002 19:52:24 GMT (envelope-from timbo@dansat.data-plan.com) Received: (from timbo@localhost) by dansat.data-plan.com (8.12.6/8.12.6/Submit) id gALJqJdG021035; Thu, 21 Nov 2002 19:52:19 GMT Date: Thu, 21 Nov 2002 19:52:19 +0000 From: Tim Bunce To: Rudy Lippan Cc: Adam Witney , David Wheeler , dbi-dev@perl.org, pgsql-interfaces Subject: Re: :PgSQL: More Queestions Message-ID: <20021121195219.GQ17107@dansat.data-plan.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/142 X-Sequence-Number: 3390 Or ignore colons that have a digit as the previous character as that would never be a placeholder. Tim. On Thu, Nov 21, 2002 at 02:20:52PM -0500, Rudy Lippan wrote: > On Thu, 21 Nov 2002, Adam Witney wrote: > > > One thing you may want to keep in mind is the situation concerning array > > slices > > > > If you send a statement like this > > > > my $sth = $dbh->prepare("select cube[1:2][1][1] from test4"); > > > > Then the :2 gets treated as a placeholder and gets substituted. From the > > trace > > Ugg. > > Maybe as a possible idea, what do you think? > > --- dbdimp.orig Thu Nov 21 15:51:06 2002 > +++ dbdimp.c Thu Nov 21 15:56:24 2002 > @@ -692,6 +692,8 @@ > if (*src != ':' && *src != '?') { > if (*src == '\'' || *src == '"') { > in_literal = *src; > + } else if ('[' == *src) { > + in_literal = ']'; > } > *dest++ = *src++; > continue; > @@ -1139,6 +1141,8 @@ > if (*src != ':' && *src != '?') { > if (*src == '\'' || *src == '"') { > in_literal = *src; > + } else if ('[' == *src) { > + in_literal = ']'; > } > *dest++ = *src++; > continue; > > > Untested, but compiles. :) (well I did do a quick test on your above stmt > and it works for that one, but may break other things. YMMV) > > > > > > dbd_st_execute: statement = >select cube[1NULL][1][1] from test4< > > ERROR: parser: parse error at or near "NULL" at character 14 error 7 > > recorded: ERROR: parser: parse error at or near " > > NULL" at character 14 > > > > As no parameters have been bound to the placeholder then a NULL is > > substituted and so it fails. > > > > Or maybe I was doing it wrong and there is a way to get around this already? > > > > As a quick workaround $dbh->prepare("cube[1:?][1][1]"); make '2' your > first param to execute() > > > -r >