From: Tim Bunce <Tim.Bunce@pobox.com>
To: Rudy Lippan <rlippan@remotelinux.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: Thu, 21 Nov 2002 19:52:19 +0000
Message-ID: <20021121195219.GQ17107@dansat.data-plan.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0211211357560.21197-100000@elfride.ineffable.net>
References: <BA026BAC.BF01%a.witney@sghms.ac.uk>
<Pine.LNX.4.44.0211211357560.21197-100000@elfride.ineffable.net>
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
>
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: <20021121195219.GQ17107@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