Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id F0A6E476754 for ; Fri, 22 Nov 2002 04:31:39 -0500 (EST) Received: from mail03.svc.cra.dublin.eircom.net (mail03.svc.cra.dublin.eircom.net [159.134.118.19]) by postgresql.org (Postfix) with SMTP id EAEF8476746 for ; Fri, 22 Nov 2002 04:31:37 -0500 (EST) Received: (qmail 97749 messnum 568979 invoked from network[159.134.165.208/p464.as1.limerick1.eircom.net]); 22 Nov 2002 09:31:35 -0000 Received: from p464.as1.limerick1.eircom.net (HELO dansat.data-plan.com) (159.134.165.208) by mail03.svc.cra.dublin.eircom.net (qp 97749) with SMTP; 22 Nov 2002 09:31:35 -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 gAM9VXao024730; Fri, 22 Nov 2002 09:31:33 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 gAM9VQ7l024729; Fri, 22 Nov 2002 09:31:26 GMT Date: Fri, 22 Nov 2002 09:31:26 +0000 From: Tim Bunce To: Rudy Lippan Cc: Tim Bunce , Adam Witney , David Wheeler , dbi-dev@perl.org, pgsql-interfaces Subject: Re: :PgSQL: More Queestions Message-ID: <20021122093126.GC24516@dansat.data-plan.com> References: <20021121195219.GQ17107@dansat.data-plan.com> 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/144 X-Sequence-Number: 3392 On Thu, Nov 21, 2002 at 03:54:56PM -0500, Rudy Lippan wrote: > On Thu, 21 Nov 2002, Tim Bunce wrote: > > > Or ignore colons that have a digit as the previous character > > as that would never be a placeholder. > > Since DBD::Pg emulates place holders, it is possible to have them after a > digit. Possible sure, but place holder values should always be viewed and used as complete lexical tokens. Being over-clever with 'token concatenation' by doing things like "SELECT * FROM log_:1" and binding a date like 20021122 as a number to select from table log_20021122 is a bad idea. (FYI I'm not familiar with PostgresSQL's dialect of SQL.) > I thought that using the [ as a literal marker might break less existing > code, for example $d->prepare->("insert into foo (int_date) > VALUES(200301:1"); Or any such other silly uses. Such silly uses deserve to be broken and replaced with $d->prepare->("insert into foo (int_date) VALUES(:1)") or $d->prepare->("insert into foo (int_date) VALUES(200301$foo)") > And besides the array > data type will probably be used less than other types. > > The best solution might be to treat [] as a literal wrt placeholders, but > allow [:1 for the [:1] case, which is the only case that would work with > the existing code. Currently, For [:1:2] preparse would see 2 place holders Viewing place holder values as complete lexical tokens make that not a sensible thing to do. And, for the only valid uses of concatenated placeholders, the same effect could be achieved with one placeholder and concatenating the values bound to it. > and for [:1::2] preparse would see a place holder and a cast. Is "::2" a valid cast that people would actually use in real code? So far I think I'd just extend my original proposal to say "Ignore colons that have a digit or colon as the previous character". Tim.