are cursors necessary? - Mailing list pgsql-general

From Mark Harrison
Subject are cursors necessary?
Date
Msg-id 3FCFB948.90100@pixar.com
Whole thread Raw
Responses Re: are cursors necessary?  (Richard Huxton <dev@archonet.com>)
Re: are cursors necessary?  (Alex Satrapa <alex@lintelsys.com.au>)
List pgsql-general
In the program testlibpq.c, these five SQL statements are executed:

    res = PQexec(conn, "BEGIN");
    res = PQexec(conn, "DECLARE myportal CURSOR FOR select * from pg_database");
    res = PQexec(conn, "FETCH ALL in myportal");
    res = PQexec(conn, "CLOSE myportal");
    res = PQexec(conn, "END");

Is this just to illustrate how to create transactions and cursors, or is there
some material difference between trimming the program down to just:

    res = PQexec(conn, "select * from pg_database");

Is there any value in my own query-only programs to declaring the cursor
for each search?

Many TIA,
Mark

--
Mark Harrison
Pixar Animation Studios


pgsql-general by date:

Previous
From: "Arjen van der Meijden"
Date:
Subject: Re: Making a tree with "millions and millions" of dynamic nodes
Next
From: "scott.marlowe"
Date:
Subject: Re: Triggers, Stored Procedures, PHP. was: Re: PostgreSQL