Re: [Dbdpg-general] Re: 'prepare' is not quite schema-safe

From: David Wheeler <david(at)kineticode(dot)com>
To: Vlad <marchenko(at)gmail(dot)com>
Cc: Neil Conway <neilc(at)samurai(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org, dbdpg-general(at)gborg(dot)postgresql(dot)org
Subject: Re: [Dbdpg-general] Re: 'prepare' is not quite schema-safe
Date: 2005-05-02 16:24:48
Message-ID: FA10545C-5728-435B-8C7B-ADABED4AD755@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On May 2, 2005, at 06:36 , Vlad wrote:

> as I understood Tom's message, he's not advising dbd::pg driver to
> rely on the fact that earlier prepared query is still valid.

That's not going to change. It's your responsibility, as the
programmer, to know when you need to expire the cache:

$dbh->do("SET search_path TO one");
my $sth1 = $dbh->prepare_cached("SELECT * FROM test WHERE item = ?");
$sth1->execute("one");

$dbh->do("set search_path to two");
@{$dbh->{CachedKids}} = (); # Expire the cache!
my $sth2 = $dbh->prepare_cached("SELECT * FROM test WHERE item = ?");
$sth2->execute("two");

(Sorry that was stuck in another reply to Neil. Trying to do too many
things at once!)

Best,

David

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dianne Chen 2005-05-02 16:28:30 7.3.9 Install Question - init.d/postgresql error?
Previous Message David Wheeler 2005-05-02 16:24:02 Re: [Dbdpg-general] Re: 'prepare' is not quite schema-safe