pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tim Bunce <Tim.Bunce@pobox.com>
To: Rudy Lippan <rlippan@remotelinux.com>
Cc: Tim Bunce <Tim.Bunce@pobox.com>
Cc: David Wheeler <david@wheeler.net>
Cc: dbi-dev@perl.org
Cc: pgsql-interfaces@postgresql.org
Subject: Re: DBD::PgSQL: More Queestions
Date: Wed, 20 Nov 2002 15:02:13 +0000
Message-ID: <20021120150213.GZ381@dansat.data-plan.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0211200839150.6288-100000@elfride.ineffable.net>
References: <20021120104950.GU381@dansat.data-plan.com>
	<Pine.LNX.4.44.0211200839150.6288-100000@elfride.ineffable.net>

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.



view thread (11+ messages)  latest in thread

Message-ID: <20021120150213.GZ381@dansat.data-plan.com>
Permalink:  ../20021120150213.GZ381@dansat.data-plan.com/
Also on:    postgresql.org/message-id/20021120150213.GZ381@dansat.data-plan.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: Tim.Bunce@pobox.com, rlippan@remotelinux.com, david@wheeler.net, dbi-dev@perl.org
  Subject: Re: DBD::PgSQL: More Queestions
  In-Reply-To: <20021120150213.GZ381@dansat.data-plan.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox