Re: Re: pyPgSQL 2.3 Released.

[email protected]
Newsgroups gmane.comp.python.db.pypgsql.user
Message-ID <[email protected]>
Oliver Vecernik wrote:
> Billy G. Allie schrieb:
> > [...]
>  >
> > Support for reference cursors was added.  Since PostgreSQL 7.2, you could
> > create cursors in PL/pgSQL and pass a reference to the open cursor back to
> > the client.  PgSQL will now cast those referenced cursors into a Cursor
> > object that can be used to fetch the results in  the cursor.  For example
> > (assuming that mmYearInfo() returns a reference curosr):
> 
> Is it possible to get the source for mmYearInfo() to run this sample?

Here is the source for mmYearInfo().  It can be used as an example for 
creating functions that returns a reference cursor, but it will not work 
without the schema and data.  Unfortunately, the schema and data are not mine 
to give.

CREATE FUNCTION mmyearinfo () RETURNS refcursor
    AS '
DECLARE
    ref refcursor;
BEGIN
    OPEN ref FOR
        SELECT t1.model_year, t1.mktg_div_name, t1.model_desc,
               t1.book_types, t3.vehicle_syskey
        FROM mmyearen t1, mktgdiv t2, vehicle t3
        WHERE t1.model_year = t3.model_year AND
              t1.mktg_div_name = t2.mktg_div_name AND
              t1.model_desc = t3.model_desc AND
              t2.mktg_div_id = t3.mktg_div_id AND
              t3.lang_code = ''EN''
        ORDER BY model_year DESC, mktg_div_name, model_desc;
    RETURN ref;
END;
'
    LANGUAGE plpgsql;

-- 
____       | Billy G. Allie    | Domain....: [email protected]
|  /|      | 7436 Hartwell     | MSN.......: [email protected]
|-/-|----- | Dearborn, MI 48126|
|/  |LLIE  | (313) 582-1540    |
signature.asc (application/pgp-signature, 1.9 KB)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Content-Type: text/plain; charset=us-ascii

Oliver Vecernik wrote:
> Billy G. Allie schrieb:
> > [...]
>  >
> > Support for reference cursors was added.  Since PostgreSQL 7.2, you could
> > create cursors in PL/pgSQL and pass a reference to the open cursor back to
> > the client.  PgSQL will now cast those referenced cursors into a Cursor
> > object that can be used to fetch the results in  the cursor.  For example
> > (assuming that mmYearInfo() returns a reference curosr):
> 
> Is it possible to get the source for mmYearInfo() to run this sample?

Here is the source for mmYearInfo().  It can be used as an example for 
creating functions that returns a reference cursor, but it will not work 
without the schema and data.  Unfortunately, the schema and data are not mine 
to give.

CREATE FUNCTION mmyearinfo () RETURNS refcursor
    AS '
DECLARE
    ref refcursor;
BEGIN
    OPEN ref FOR
        SELECT t1.model_year, t1.mktg_div_name, t1.model_desc,
               t1.book_types, t3.vehicle_syskey
        FROM mmyearen t1, mktgdiv t2, vehicle t3
        WHERE t1.model_year = t3.model_year AND
              t1.mktg_div_name = t2.mktg_div_name AND
              t1.model_desc = t3.model_desc AND
              t2.mktg_div_id = t3.mktg_div_id AND
              t3.lang_code = ''EN''
        ORDER BY model_year DESC, mktg_div_name, model_desc;
    RETURN ref;
END;
'
    LANGUAGE plpgsql;

- -- 
____       | Billy G. Allie    | Domain....: [email protected]
|  /|      | 7436 Hartwell     | MSN.......: [email protected]
|-/-|----- | Dearborn, MI 48126|
|/  |LLIE  | (313) 582-1540    |


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.2 (UnixWare)
Comment: Exmh version 2.2 06/23/2000

iD8DBQE+F5YcnmIkMXoVVdURAjAZAJ0ZowT4H3xSrlKZMWKcO7LTzau5LACg1d++
8V3Uwi4sOFInjQ75DeB85dY=
=dOq/
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.