X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 335C2D1B583 for ; Wed, 5 Nov 2003 15:53:50 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 62032-09 for ; Wed, 5 Nov 2003 11:53:22 -0400 (AST) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 15C66D1BB73 for ; Wed, 5 Nov 2003 11:53:14 -0400 (AST) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.10/8.12.10) with ESMTP id hA5FqGkS027862; Wed, 5 Nov 2003 08:52:17 -0700 (MST) Date: Wed, 5 Nov 2003 08:38:57 -0700 (MST) From: "scott.marlowe" To: Stephen Cc: Subject: Re: Support for prepared queries In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT X-IHS-MailScanner: Found to be clean X-IHS-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/9 X-Sequence-Number: 2402 Hey, I found this on sourceforge: http://sqlrelay.sourceforge.net/ No clue how well it works, but I might give it a try. On Tue, 4 Nov 2003, scott.marlowe wrote: > No, in fact in PHP5 php now purposely resets the connection between pages. > > You'd have to write some kind of pooling solution to get that kind of > behaviour. I don't know of anyone working on pooling in PHP. > > On Fri, 31 Oct 2003, Stephen wrote: > > > Any idea how the prepared query can be made to save across PHP invocations? > > How about using pg_pconnect (persistent connection), will it stay prepared > > when PHP comes again and reuse the connection? > > > > Stephen > > > > > > ""scott.marlowe"" wrote in message > > news:Pine.LNX.4.33.0310241623570.26036-100000@css120.ihs.com... > > > On Fri, 24 Oct 2003, Martin Marques wrote: > > > > > > > El Vie 24 Oct 2003 15:02, Robby Russell escribió: > > > > > Stephen wrote: > > > > > > Hi, > > > > > > > > > > > > Does anyone know if PHP supports prepared queries for PostgreSQL > > 7.3.x ? > > > > If > > > > > > not, when will prepared queries be supported? > > > > > > > > > > > > Thanks, Stephen > > > > > > > > > > > > > > > > You might want to look at PEAR db. I think it comes with php standard > > > > > now... so pear.php.net. > > > > > > > > Those are not prepared queries (at least in the sence of prepare -> > > execute). > > > > For prepared queries you have to know how to talk to libpq, and that's > > > > something that is done from the pgsql ext. > > > > > > This hunk of code works fine on my php 4.3.2 / postgresql 7.3.4 box: > > > > > > > > $conn = pg_connect("dbname=marl8412 user=marl8412"); > > > $a = pg_query($conn,"prepare test (int4) as select * from accounts where > > > aid= $1"); > > > $res = pg_query($conn,"execute test (45)"); > > > $row = pg_fetch_row($res); > > > print implode(" ",array_values($row))."
"; > > > ?> > > > > > > so yes, you can use a prepared queries in PHP. But, they won't live > > > across connections I don't think. Or at least I'm pretty sure you can't > > > count on them living from one page to the next. but if you're gonna have > > > a page where you run the same select with different select parameters over > > > and over it might be a win. > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > > TIP 9: the planner will ignore your desire to choose an index scan if your > > > joining column's datatypes do not match > > > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 9: the planner will ignore your desire to choose an index scan if your > > joining column's datatypes do not match > > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > >