Re: General question about DBI/DBD
От | Doug McNaught |
---|---|
Тема | Re: General question about DBI/DBD |
Дата | |
Msg-id | m3pu6ruc8f.fsf@belphigor.mcnaught.org обсуждение исходный текст |
Ответ на | problem connecting client to a postgresSQL server ("darwin" <dharval@digitelone.com>) |
Список | pgsql-general |
Paul Tomblin <ptomblin@xcski.com> writes: [converting Pg.pm to DBD::Pg] > Also, the big program does a whole bunch of > $conn->exec("SELECT * FROM tablename WHERE indexed_column = '$key'"); > and things like that. Is there a way in DBD:Pg I can re-parse those > queries with "...indexed_column = :1" and then supply a different key each > time? I remember when I used to write C programs that accessed Oracle > (about 8 years ago, so the details are hazy), that was a major performance > improvement. You can basically do: $stmt = $dbh->prepare("SELECT * FROM tablename WHERE indexed_column = ?"); $stmt->execute($key1); $stmt->execute($key2); This is nice because it will do any escaping in $key that needs to be done. However, PG doesn't cache query plans in this situation (unlike Oracle) so you won't see a big performance win. (Apologies if my syntax is off; I mostly use Java now.) -Doug -- Let us cross over the river, and rest under the shade of the trees. --T. J. Jackson, 1863
В списке pgsql-general по дате отправления: