Re: DBI placeholders

From: Adrian Phillips <adrianp(at)powertech(dot)no>
To: Evan Zane Macosko <macosko(at)fas(dot)harvard(dot)edu>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: DBI placeholders
Date: 2001-08-21 14:55:20
Message-ID: 87r8u5sbs7.fsf@grannyogg.localnet
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>>>>> "Evan" == Evan Zane Macosko <macosko(at)fas(dot)harvard(dot)edu> writes:

Evan> Hi everyone, I'm wondering if someone could explain to me
Evan> how placeholders work with Perl DBI linking to Postgresql.
Evan> I seem to have trouble using them in a loop. For example,
Evan> the code:

Evan> my $i = 0; $sth = $dbh->prepare("UPDATE yeast1 set ? = '?'
Evan> where yeast1.orf = temp.orf"); while ($i<$#columns) {
Evan> $sth->execute($i, $tables[$i-1]; $i++; }

Evan> This returns an error from the Pg parser. Any suggestions?
Evan> Also, this query is incredibly slow--does anyone have
Evan> suggestions for optimization?

Placeholders are for values not for column names, and you shouldn't
have quotes around the ? either.

Sincerely,

Adrian Phillips

--
Your mouse has moved.
Windows NT must be restarted for the change to take effect.
Reboot now? [OK]

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gayland Gump 2001-08-21 15:43:25 macaddr data type issue
Previous Message Tom Lane 2001-08-21 14:18:50 Re: Postgresql backend error