note 70596 added to ref.pgsql
| From: | php-general at lists dot php dot net | Date: | Sat, 21 Oct 2006 05:10:55 +0000 |
| Subject: | note 70596 added to ref.pgsql | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-118901@lists.php.net to get a copy of this message | ||
Lots of advice on stored procedures didn't work for me. This did:
<?php
$response = pg_query( $connection, "BEGIN; DECLARE s CURSOR FOR SELECT
get_consumer('harry'); FETCH ALL IN s; END;" );
?>
..where harry looks like this:
CREATE OR REPLACE FUNCTION get_consumer( varchar )
RETURNS refcursor
AS '
DECLARE
_name ALIAS FOR $1;
r refcursor;
BEGIN
OPEN r FOR SELECT name FROM consumer
WHERE
consumer.name = _name
;
RETURN r;
END
' LANGUAGE 'plpgsql';
----
Server IP: 202.89.36.242
Probable Submitter: 80.98.84.252 (proxied: 1.1 localhost.localdomain)
----
Manual Page -- http://www.php.net/manual/en/ref.pgsql.php
Edit -- https://master.php.net/note/edit/70596
Del: integrated -- https://master.php.net/note/delete/70596/integrated
Del: useless -- https://master.php.net/note/delete/70596/useless
Del: bad code -- https://master.php.net/note/delete/70596/bad+code
Del: spam -- https://master.php.net/note/delete/70596/spam
Del: non-english -- https://master.php.net/note/delete/70596/non-english
Del: in docs -- https://master.php.net/note/delete/70596/in+docs
Del: other reasons-- https://master.php.net/note/delete/70596
Reject -- https://master.php.net/note/reject/70596
Search -- https://master.php.net/manage/user-notes.php