pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: scott.marlowe <scott.marlowe@ihs.com>
To: Martin Marques <martin@bugs.unl.edu.ar>
Cc: Robby Russell <rrussell@commandprompt.com>
Cc: Stephen <jleelim@xxxxxx.com>
Cc: pgsql-php@postgresql.org
Subject: Re: Support for prepared queries
Date: Fri, 24 Oct 2003 16:30:01 -0600 (MDT)
Message-ID: <Pine.LNX.4.33.0310241623570.26036-100000@css120.ihs.com> (raw)
In-Reply-To: <200310241850.56494.martin@bugs.unl.edu.ar>

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:

<?php
$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))."<BR>";
?>

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.




view thread (15+ messages)  latest in thread

Message-ID: <Pine.LNX.4.33.0310241623570.26036-100000@css120.ihs.com>
Permalink:  ../Pine.LNX.4.33.0310241623570.26036-100000@css120.ihs.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.33.0310241623570.26036-100000@css120.ihs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: scott.marlowe@ihs.com, martin@bugs.unl.edu.ar, rrussell@commandprompt.com, jleelim@xxxxxx.com
  Subject: Re: Support for prepared queries
  In-Reply-To: <Pine.LNX.4.33.0310241623570.26036-100000@css120.ihs.com>
  References: <200310241850.56494.martin@bugs.unl.edu.ar> <Pine.LNX.4.33.0310241623570.26036-100000@css120.ihs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox