From: Tim Bunce <Tim.Bunce@pobox.com>
To: Rudy Lippan <rlippan@remotelinux.com>
Cc: Tim Bunce <Tim.Bunce@pobox.com>
Cc: Adam Witney <awitney@sghms.ac.uk>
Cc: David Wheeler <david@wheeler.net>
Cc: dbi-dev@perl.org, pgsql-interfaces <pgsql-interfaces@postgresql.org>
Subject: Re: :PgSQL: More Queestions
Date: Fri, 22 Nov 2002 09:31:26 +0000
Message-ID: <20021122093126.GC24516@dansat.data-plan.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0211211541560.21197-100000@elfride.ineffable.net>
References: <20021121195219.GQ17107@dansat.data-plan.com>
<Pine.LNX.4.44.0211211541560.21197-100000@elfride.ineffable.net>
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.
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, awitney@sghms.ac.uk, david@wheeler.net
Subject: Re: :PgSQL: More Queestions
In-Reply-To: <20021122093126.GC24516@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