Re: Quoting '?' placeholder in Perl's DBD::Pg?

From: David Christian <davidc(at)comtechmobile(dot)com>
To: Lincoln Yeoh <lyeoh(at)pop(dot)jaring(dot)my>, pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Quoting '?' placeholder in Perl's DBD::Pg?
Date: 2001-09-27 17:36:36
Message-ID: B7D8DBE4.A05%davidc@comtechmobile.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

$dbh->quote() won't do it? I haven't tried this.

$string = 'asdad?rerwe';
$quoted = $dbh->quote($string);
insert into blah (a) values ($quoted);

Just a thought.
David

On 9/27/01 12:40 PM, "Lincoln Yeoh" <lyeoh(at)pop(dot)jaring(dot)my> wrote:

> Hi anyone know how I can quote or turn off the ? placeholder in Perl's
> DBD::Pg?
>
> I've asked on the perl modules newsgroups but I didn't get any satisfactory
> answer.
>
> Say I'm constructing a custom SQL query and it turns out that there is a ?
> somewhere, how do I quote it out? It gets recognised as a placeholder by
> the DBD::Pg driver.
> e.g.
> my $SQL=<<"EOT";
> insert into blah (a,b) values ('asdad?rerwe','blah')
> EOT
>
> The ? gets interpreted as a placeholder.
>
> Sure I can do
> my $SQL=<<"EOT";
> insert into blah (a,b) values (?,?)
> EOT
>
> And do the execute thing. But if the number of columns changes from query
> to query, and so on it might be less convenient to use placeholders.
>
> If it really can't be done, then yeah I'll use placeholders. But it seems
> strange if you can't.
>
> Cheerio,
> Link.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Doug McNaught 2001-09-27 17:45:59 Re: what is wrong with this SQL?
Previous Message Steve Wolfe 2001-09-27 17:18:31 Re: Performance question (stripped down the problem)