Re: How do I use the backend APIs - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: How do I use the backend APIs
Date
Msg-id 20060217092104.GB9254@svana.org
Whole thread Raw
In response to How do I use the backend APIs  ("Chad" <chadzakary@hotmail.com>)
Responses Re: How do I use the backend APIs
List pgsql-general
On Thu, Feb 16, 2006 at 07:41:09AM -0800, Chad wrote:
> Hi,
>
> In Postgres, is there a C language API which would give me access to
> BTrees like Berkeley DB does? eg to seek to a particular key/value pair
> and iterate forward from there? If not whats the nearest thing to this
> in Postgres?

Well, in the backend you can do things like open a btree index, setup
an ScanKey to indicate which values you want and then keep calling
getnext(). If you set your scankey to (col1 >= 'A') it will start at
'A' and go up from there...

Most of the time though you just create a query and use SPI_exec. Then
you don't actually have to worry about details like names of the
indexes, OIDs, types, comparison functions, etc...

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment

pgsql-general by date:

Previous
From: "Dave Page"
Date:
Subject: Re: Problem with postgres installation
Next
From: David Goodenough
Date:
Subject: Implicit conversion from string to timestamp