Re: Queries using the C API

From: Jurgen Defurne <defurnj(at)glo(dot)be>
To: postgreSQL general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Queries using the C API
Date: 2000-05-16 16:59:34
Message-ID: 39217E76.71FB247B@glo.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)glo(dot)be

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2000-05-16 17:04:34 HTML version of book fixed, again
Previous Message Diego Schvartzman 2000-05-16 16:15:35 Re: Performance