Thread: non-SQL C interface ? (fwd)

non-SQL C interface ? (fwd)

From
Jan Vicherek
Date:

  Hi,

 I  got no answer from pgsql-questions   list.

  basically I'm using only one table at a time, and I need only a few
simple operations on tuples (find,  add, updates, delete).

  -- after a  quick look at all `cd src;  find .  -name '*.h'` I didn't
find any such similar interface.

 Can sombody advise me how could I get this simple interface ?

 I'm fluent in C/C++.

       Thanx,

             Jan


 -- Gospel of Jesus is the saving power of God for all who believe --
Jan Vicherek ## To some, nothing is impossible. ##  www.ied.com/~honza
    >>>    Free Software Union President  ...  www.fslu.org    <<<
Interactive Electronic Design Inc.    -#-    PGP: finger honza@ied.com

---------- Forwarded message ----------
Date: Fri, 16 Jan 1998 16:03:05 -0500 (EST)
From: Jan Vicherek <honza@ied.com>
To: pgsql-questions@postgresql.org
Subject: non-SQL C interface ?


  If I would like to access the database through a C interface using a few
simple database operations, like
open db
select fields to work with
select index to use
select a record
update a record
add  a record
delete a record
lock a table against updates, unlock

 and that's it. (Taken from Informinx 3.3, "ALL-II" C interface.)

 We are looking into porting an app written for this Informix interface
into Postgres, and I would wrinte a library simulating these calls.

  Is there a set of calls seomwhere inside of PGSQL that I could use in my
simulation library to utilize ?

    THanx,

      Jan


 -- Gospel of Jesus is the saving power of God for all who believe --
Jan Vicherek ## To some, nothing is impossible. ##  www.ied.com/~honza
    >>>    Free Software Union President  ...  www.fslu.org    <<<
Interactive Electronic Design Inc.    -#-    PGP: finger honza@ied.com



Re: [HACKERS] non-SQL C interface ? (fwd)

From
Peter T Mount
Date:
On Sun, 18 Jan 1998, Jan Vicherek wrote:
>   Hi,
>
>  I  got no answer from pgsql-questions   list.

I saw this there, but was knee deep in code at the time

>   basically I'm using only one table at a time, and I need only a few
> simple operations on tuples (find,  add, updates, delete).
>
>   -- after a  quick look at all `cd src;  find .  -name '*.h'` I didn't
> find any such similar interface.
>
>  Can sombody advise me how could I get this simple interface ?
>
>  I'm fluent in C/C++.

I think the simplest way of doing this is to write your own stubs, that
then sit on top of libpq. This is the way I've done this in the past.

[snip]

>  and that's it. (Taken from Informinx 3.3, "ALL-II" C interface.)
>
>  We are looking into porting an app written for this Informix interface
> into Postgres, and I would wrinte a library simulating these calls.
>
>   Is there a set of calls seomwhere inside of PGSQL that I could use in my
> simulation library to utilize ?

As your trying to simulate another api, and it looked like it's fairly
simple, then it should be simple to do this, leaving libpq to do the
actual network stuff to the database.

--
Peter T Mount  petermount@earthling.net or pmount@maidast.demon.co.uk
Main Homepage: http://www.demon.co.uk/finder
Work Homepage: http://www.maidstone.gov.uk Work EMail: peter@maidstone.gov.uk


Re: [HACKERS] non-SQL C interface ? (fwd)

From
Jan Vicherek
Date:
On Sun, 18 Jan 1998, Peter T Mount wrote:

> >   basically I'm using only one table at a time, and I need only a few
> > simple operations on tuples (find,  add, updates, delete).
> >
> >  Can sombody advise me how could I get this simple interface ?
>
> I think the simplest way of doing this is to write your own stubs, that
> then sit on top of libpq. This is the way I've done this in the past.

  It seems like a  bit of overkill, since this would still have to go
through the SQL parser,optimizer,executor,etc. If I want to access the
tables only one at a time, and only load the rows into a simple C
structure, it seems like there has to be this interface, since the SQL
executor has to get to the data somehow too. And I thought it would be
through this C interface that I'm looking for.

 here goes the list of simple few calls I  need :
open db
select fields to work with
select index to use
select a record
update a record
add  a record
delete a record
lock a table against updates, unlock

> >  and that's it. (Taken from Informinx 3.3, "ALL-II" C interface.)
> >
> >  We are looking into porting an app written for this Informix interface
> > into Postgres, and I would wrinte a library simulating these calls.
> >
> >   Is there a set of calls seomwhere inside of PGSQL that I could use in my
> > simulation library to utilize ?
>
> As your trying to simulate another api, and it looked like it's fairly
> simple, then it should be simple to do this, leaving libpq to do the
> actual network stuff to the database.

  but libpq and do *only* SQL calls only, right ? Or can libpq do some of
these lower-level stuff too? that would be excellent !

      Thanx,

          Jan

 -- Gospel of Jesus is the saving power of God for all who believe --
Jan Vicherek ## To some, nothing is impossible. ##  www.ied.com/~honza
    >>>    Free Software Union President  ...  www.fslu.org    <<<
Interactive Electronic Design Inc.    -#-    PGP: finger honza@ied.com