Does php/postgres support placeholder"s?
Does php/postgres support placeholder"s?
am 27.04.2005 22:47:14 von John Mohr
This is a multi-part message in MIME format.
------=_NextPart_000_0020_01C54B40.61FBCFD0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Does php/postgres support placeholder's in queries and updates. Something
that looks like "select * from x where key=?" ? I notice that the call
interface doesn't support all of the documented calls, for example pg_query
and pg_send_query, but not pg_query_params (according to pgsql.c, the
postgres php -> postgres interface program).
------=_NextPart_000_0020_01C54B40.61FBCFD0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
charset=3Diso-8859-1">
Does =
php/postgres=20
support placeholder's in queries and updates. Something that looks like =
"select=20
* from x where key=3D?" ? I notice that the call interface doesn't =
support all of=20
the documented calls, for example pg_query and pg_send_query, but not=20
pg_query_params (according to pgsql.c, the postgres php -> postgres =
interface=20
program).
------=_NextPart_000_0020_01C54B40.61FBCFD0--
Re: Does php/postgres support placeholder"s?
am 28.04.2005 02:11:06 von John DeSoi
On Apr 27, 2005, at 4:47 PM, John Mohr wrote:
> Does php/postgres support placeholder's in queries and updates.
> Something that looks like "select * from x where key=?" ? I notice
> that the call interface doesn't support all of the documented calls,
> for example pg_query and pg_send_query, but not pg_query_params
> (according to pgsql.c, the postgres php -> postgres interface
> program).
I see docs for pg_prepare and pg_execute and execute, but it may only
be in the CVS version. I seem to recall a recent mention on the list
that a more complete interface is coming with PHP 5.1.
http://www.php.net/manual/en/ref.pgsql.php
John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://archives.postgresql.org
Re: Does php/postgres support placeholder"s?
am 28.04.2005 03:22:31 von Christopher Kings-Lynne
It has special functions for it in 5.1 CVS, but not in release.
However, you can just do it yourself using the PREPARE and EXECUTE
statements:
http://www.postgresql.org/docs/8.0/interactive/sql-prepare.h tml
http://www.postgresql.org/docs/8.0/interactive/sql-execute.h tml
Chris
John Mohr wrote:
>
> Does php/postgres support placeholder's in queries and updates.
> Something that looks like "select * from x where key=?" ? I notice that
> the call interface doesn't support all of the documented calls, for
> example pg_query and pg_send_query, but not pg_query_params (according
> to pgsql.c, the postgres php -> postgres interface program).
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
Does php/postgres support placeholder"s?
am 28.04.2005 12:53:35 von Volkan YAZICI
Hi,
On 4/27/05, John Mohr wrote:
> Does php/postgres support placeholder's in queries and updates. Something
> that looks like "select * from x where key=3D?" ?
I think you meant parameters by "placeholders". For example:
INSERT INTO tbl (f1, f2, f3...) VALUES ($1, $2, $3, ...);
SELECT count(oid) FROM tbl WHERE field =3D $1;
AFAIC, PHP PostgreSQL API doesn't support any X_params() functions.
(Seems like stucked in escapeThatBuggyString() functions.)
> I notice that the call
> interface doesn't support all of the documented calls, for example pg_que=
ry
> and pg_send_query, but not pg_query_params (according to pgsql.c, the
> postgres php -> postgres interface program).
Some of the functions I found that don't exist in both latest release
and CVS tree:
pg_prepare()
pg_query_params()
pg_field_type_oid()
pg_send_prepare()
pg_send_query_params()
(CVS checkout for ext/pgsql/pgsql.c:
http://cvs.php.net/co.php/php-src/ext/pgsql/pgsql.c?r=3D1.24 4.2.38)
Also, async query functions' interface is new as well. (Committed @
"Sat Mar 19 03:46:55 2005" Related diff:
http://cvs.php.net/php-src/ext/pgsql/pgsql.c?r1=3D1.315&onb= 3D0)
Regards.
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings