Re: Queries using the C API - Mailing list pgsql-general

From Jurgen Defurne
Subject Re: Queries using the C API
Date
Msg-id 39217E76.71FB247B@glo.be
Whole thread Raw
In response to Queries using the C API  (Marcos Barreto de Castro <mbdecastro@yahoo.com>)
List pgsql-general
Marcos Barreto de Castro wrote:

>    My questions are: Is there a skip function in
> Postgresql that I can use to browse through the
> records in a table forwards and backwards (That table
> has 50,000 records)? If not, how would I be able to
> develop
> such a mechanism as the one explained above? Are there
> examples of existing algorithms or even functions,
> libraries of functions fit for the job? Are there
> examples of free software developed using the
> Postgresql C API? If so, where can I find them?
>

You have to create a cursor :
DECLARE cursor_name CURSOR
FOR <enter your query here as a select statement> ;

Your select statement will act as a filter on your tables.

The declaration of the cursor (using embedded or dynamic
SQL statements) will open the cursor.

Then you can use FETCH FORWARD and FETCH BACKWARD
to browse through the cursor.

If you want to use the same cursor, but with another query,
then you need to close it (CLOSE cursor_name), recompose your
select statement and reopen the cursor.

I know xBase, and I have even used CodeBase (but that was 10
years ago). You will probably have to work somewhat harder on
using postgreSQL, although if your browse infrastructure good,
you could probably write a similar interface to postgreSQL as is
used in CodeBase.

Good luck,

Jurgen Defurne
defurnj@glo.be



pgsql-general by date:

Previous
From: "Diego Schvartzman"
Date:
Subject: Re: Performance
Next
From: Bruce Momjian
Date:
Subject: HTML version of book fixed, again