Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 77F46475D01 for ; Wed, 20 Nov 2002 10:02:16 -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 87405475C5F for ; Wed, 20 Nov 2002 10:02:15 -0500 (EST) Received: (qmail 52027 messnum 563211 invoked from network[159.134.167.71/p839.as1.limerick1.eircom.net]); 20 Nov 2002 15:02:18 -0000 Received: from p839.as1.limerick1.eircom.net (HELO dansat.data-plan.com) (159.134.167.71) by mail03.svc.cra.dublin.eircom.net (qp 52027) with SMTP; 20 Nov 2002 15:02:18 -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 gAKF2Jao011604; Wed, 20 Nov 2002 15:02:19 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 gAKF2DnB011603; Wed, 20 Nov 2002 15:02:13 GMT Date: Wed, 20 Nov 2002 15:02:13 +0000 From: Tim Bunce To: Rudy Lippan Cc: Tim Bunce , David Wheeler , dbi-dev@perl.org, pgsql-interfaces@postgresql.org Subject: Re: DBD::PgSQL: More Queestions Message-ID: <20021120150213.GZ381@dansat.data-plan.com> References: <20021120104950.GU381@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/129 X-Sequence-Number: 3377 On Wed, Nov 20, 2002 at 08:58:59AM -0500, Rudy Lippan wrote: > On Wed, 20 Nov 2002, Tim Bunce wrote: > > > > I notice that > > > DBD::ODBC, for example, doesn't appear to do anything special with > > > regard to comments. And if comments *are* supported by DBI, and DBD::Pg > > > is doing the right thing by watching out for them, wouldn't it be > > > smarter for DBD::Pg to cut them *out* of its internal copy of the SQL > > > statement so that dbd_st_execute() doesn't also have to deal with them? > > > > Why should dbd_st_execute have to "deal" with them? The whole string > > should just be sent off to the server. > > PostgreSQL itself does not (yet) support placeholders, so DBD::Pg emulates > them by scanning the string again in dbd_st_execute() looking for > placeholders and substituting them quoted values of what was passed to > execute(). Ah, okay. The goal is always to reduce the work that execute() does as far as possible. I'd suggest that the preparse code generate a list of the 'fragments' of SQL between the placeholders. All execute has to do is effectively join the parts together. But it's probably not worth worrying about. The cost of the scan is tiny and would be dwarfed by other issues like how you handle memory allocation (like, measure all fragments and placeholder values first then allocate and merge, or concatenate each part into an SV). Tim.