pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
C/C++ interface
6+ messages / 4 participants
[nested] [flat]

* C/C++ interface
@ 2001-02-13 12:10  Volker Paul <vpaul@dohle.com>
  0 siblings, 2 replies; 6+ messages in thread

From: Volker Paul @ 2001-02-13 12:10 UTC (permalink / raw)
  To: pgsql-sql@postgresql.org

Hello,

in the C interface documentation there is an example using:

    res = PQexec(conn, "DECLARE mycursor CURSOR FOR select * from
pg_database");
    if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
    {
        fprintf(stderr, "DECLARE CURSOR command failed\n");
        PQclear(res);
        exit_nicely(conn);
    }
    PQclear(res);
    res = PQexec(conn, "FETCH ALL in mycursor");

...etc. So the statements are:

DECLARE mycursor CURSOR FOR select * from pg_database;
FETCH ALL in mycursor;

What's the difference between this and simply doing:
select * from pg_database;

I tried this in psql, the result seemed the same.

What I'm really using, however, is the C++ interface.
Its documentation is not yet complete.
There, too, I tried a version with and without cursor.
The result seems to be the same, but returned int is always 0
for the version without cursor, so I get no information whether
the query succeeded. 

Is someone maintaining the C++ interface and its documentation?


Thanks,

Volker Paul



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: C/C++ interface
@ 2001-02-13 14:56  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: Volker Paul <vpaul@dohle.com>
  1 sibling, 0 replies; 6+ messages in thread

From: Bruce Momjian @ 2001-02-13 14:56 UTC (permalink / raw)
  To: Volker Paul <vpaul@dohle.com>; +Cc: pgsql-sql@postgresql.org

Cursors and standard queries are pretty much the same, except the cursor
can control the rows returned.

> Hello,
> 
> in the C interface documentation there is an example using:
> 
>     res = PQexec(conn, "DECLARE mycursor CURSOR FOR select * from
> pg_database");
>     if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
>     {
>         fprintf(stderr, "DECLARE CURSOR command failed\n");
>         PQclear(res);
>         exit_nicely(conn);
>     }
>     PQclear(res);
>     res = PQexec(conn, "FETCH ALL in mycursor");
> 
> ...etc. So the statements are:
> 
> DECLARE mycursor CURSOR FOR select * from pg_database;
> FETCH ALL in mycursor;
> 
> What's the difference between this and simply doing:
> select * from pg_database;
> 
> I tried this in psql, the result seemed the same.
> 
> What I'm really using, however, is the C++ interface.
> Its documentation is not yet complete.
> There, too, I tried a version with and without cursor.
> The result seems to be the same, but returned int is always 0
> for the version without cursor, so I get no information whether
> the query succeeded. 
> 
> Is someone maintaining the C++ interface and its documentation?
> 
> 
> Thanks,
> 
> Volker Paul
> 


-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: C/C++ interface
@ 2001-02-13 15:02  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Volker Paul <vpaul@dohle.com>
  1 sibling, 1 reply; 6+ messages in thread

From: Tom Lane @ 2001-02-13 15:02 UTC (permalink / raw)
  To: Volker Paul <vpaul@dohle.com>; +Cc: pgsql-sql@postgresql.org

Volker Paul <vpaul@dohle.com> writes:
> Is someone maintaining the C++ interface and its documentation?

Not really.  Feel free to step up and lend a hand ...

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: C/C++ interface
@ 2001-02-16 08:24  Volker Paul <vpaul@dohle.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 6+ messages in thread

From: Volker Paul @ 2001-02-16 08:24 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql@postgresql.org

Tom Lane wrote:
> 
> Volker Paul <vpaul@dohle.com> writes:
> > Is someone maintaining the C++ interface and its documentation?
> 
> Not really.  Feel free to step up and lend a hand ...

I found some functions of the C++ binding library
that are not or scarcely documented, namely:
  int GetIsNull(int tup_num, int field_num);
  int GetIsNull(int tup_num, const char* field_name);
  int GetLine(char* string, int length);
  void PutLine(const char* string);
  const char* OidStatus();
  int EndCopy();

I would like to complete the documentation at these points,
and maybe add some small example C++ programs.

In which form should I write the documentation and where
should I send it?
(I have no possibility at the moment to test SGML documents,
i.e. convert them to HTML.)

Regards,

Volker Paul



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: C/C++ interface
@ 2001-02-16 10:03  dev@archonet.com
  parent: Volker Paul <vpaul@dohle.com>
  1 sibling, 0 replies; 6+ messages in thread

From: dev@archonet.com @ 2001-02-16 10:03 UTC (permalink / raw)
  To: Volker Paul <vpaul@dohle.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-sql@postgresql.org



>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 2/16/01, 8:24:09 AM, Volker Paul <vpaul@dohle.com> wrote regarding Re: 
[SQL] C/C++ interface:


> Tom Lane wrote:
> >
> > Volker Paul <vpaul@dohle.com> writes:
> > > Is someone maintaining the C++ interface and its documentation?
> >
> > Not really.  Feel free to step up and lend a hand ...

> I would like to complete the documentation at these points,
> and maybe add some small example C++ programs.

> In which form should I write the documentation and where
> should I send it?
> (I have no possibility at the moment to test SGML documents,
> i.e. convert them to HTML.)
> Regards,
> Volker Paul

I believe there are guidelines in the developer's section of the 
postgresql.org website - towards the end of the developer's docs.

- Richard Huxton



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: [SQL] C/C++ interface
@ 2001-02-16 14:40  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: Volker Paul <vpaul@dohle.com>
  1 sibling, 0 replies; 6+ messages in thread

From: Bruce Momjian @ 2001-02-16 14:40 UTC (permalink / raw)
  To: Volker Paul <vpaul@dohle.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-docs

There is a libpq++.sgml.  If you could send a patch against that, it
would be prefect.

> Tom Lane wrote:
> > 
> > Volker Paul <vpaul@dohle.com> writes:
> > > Is someone maintaining the C++ interface and its documentation?
> > 
> > Not really.  Feel free to step up and lend a hand ...
> 
> I found some functions of the C++ binding library
> that are not or scarcely documented, namely:
>   int GetIsNull(int tup_num, int field_num);
>   int GetIsNull(int tup_num, const char* field_name);
>   int GetLine(char* string, int length);
>   void PutLine(const char* string);
>   const char* OidStatus();
>   int EndCopy();
> 
> I would like to complete the documentation at these points,
> and maybe add some small example C++ programs.
> 
> In which form should I write the documentation and where
> should I send it?
> (I have no possibility at the moment to test SGML documents,
> i.e. convert them to HTML.)
> 
> Regards,
> 
> Volker Paul
> 


-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2001-02-16 14:40 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-02-13 12:10 C/C++ interface Volker Paul <vpaul@dohle.com>
2001-02-13 14:56 ` Bruce Momjian <pgman@candle.pha.pa.us>
2001-02-13 15:02 ` Tom Lane <tgl@sss.pgh.pa.us>
2001-02-16 08:24   ` Volker Paul <vpaul@dohle.com>
2001-02-16 10:03     ` dev@archonet.com
2001-02-16 14:40     ` Bruce Momjian <pgman@candle.pha.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox