pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedlibpq
36+ messages / 18 participants
[nested] [flat]
* libpq
@ 1998-12-19 15:59 Behzad Ardakani <Behzad@utilator.com>
0 siblings, 0 replies; 36+ messages in thread
From: Behzad Ardakani @ 1998-12-19 15:59 UTC (permalink / raw)
To: pgsql-interfaces
hi
I run redhat linux 5.2 and have problems when im trying too compile the
first example
in www.postgresql.org/docs/programmer/libpq-chapter4118.htm.
i do "cc -o pqtest pqtest.c"
and i get
"/tmp/cca025511.o(.text+0x311): undefined reference to PQclear"
the error message is for all the PQ function.
please helpme:)
Behzad Ardakani
Utilator AB
Box 857
801 31 Gävle
phone: +46 (0)26 65 24 20
mobile: +46 (0)739 388 115
fax: +46 (0)26 61 41 20
e-mail: behzad@utilator.com
website: http://www.utilator.com
^ permalink raw reply [nested|flat] 36+ messages in thread
* libpq++
@ 1999-04-23 06:28 Shad Cool <shad@gi.com.au>
0 siblings, 0 replies; 36+ messages in thread
From: Shad Cool @ 1999-04-23 06:28 UTC (permalink / raw)
To: pgsql-interfaces
Hi all,
Im new to C++ and the docs on libpq++ do not contain any examples. If any one had any source code (or examples) using this library and the associated classes I would appreciate it if they could send it to me.
Thanks.
Shad Cool.
Dynamic Programming Solutions.
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: [INTERFACES] libpq++
@ 1999-04-24 17:44 KaDe <kade@carolo.net>
0 siblings, 1 reply; 36+ messages in thread
From: KaDe @ 1999-04-24 17:44 UTC (permalink / raw)
To: Shad Cool <shad@gi.com.au>; pgsql-interfaces
Im new to C++ and the docs on libpq++ do not contain any examples. If any one had any source code (or examples) using this library and the associated classes I would appreciate it if they could send it to me
If you have intalled the docs, in a directory doc/src/interfaces/libpq++/examples (or something like that, I can't have a look right now) you will find some simple sources.
By the way, since my upgrade to 6.4 on a Debian installation, I've lost the man page for libpq++.
Is it a Debian-bug or something else ?
--
Un LUG a Charleroi - BELGIUM
http://carolo.net/carolinux
On y utilisera Postgres
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: [INTERFACES] libpq++
@ 1999-04-25 13:14 Oliver Elphick <olly@lfix.co.uk>
parent: KaDe <kade@carolo.net>
0 siblings, 0 replies; 36+ messages in thread
From: Oliver Elphick @ 1999-04-25 13:14 UTC (permalink / raw)
To: KaDe <kade@carolo.net>; +Cc: Shad Cool <shad@gi.com.au>; pgsql-interfaces
"KaDe" wrote:
>By the way, since my upgrade to 6.4 on a Debian installation, I've lost =
>the man page for libpq++.
>Is it a Debian-bug or something else ?
[I am Debian maintainer for PostgreSQL]
In my copy of 6.4.2, from which I built the package, the directory src/interfaces/libpq++/man is missing. It seems to have been deleted
from the source at the ftp site.
--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP key from public servers; key ID 32B8FAA1
========================================
"Nay, in all these things we are more than conquerors
through him that loved us." Romans 8:37
^ permalink raw reply [nested|flat] 36+ messages in thread
* libpq++
@ 2001-03-07 19:52 J. T. Vermeulen <jtv@cistron-office.nl>
0 siblings, 5 replies; 36+ messages in thread
From: J. T. Vermeulen @ 2001-03-07 19:52 UTC (permalink / raw)
To: pgsql-interfaces
Is anyone maintaining libpq++? My patches are beginning to seriously
overlap each other, making it hard to submit them individually.
If there's nobody out there, I'd be willing to maintain this code and
make more extensive changes. In particular, I would like to:
- introduce exceptions instead of manual checking, as suggested in TODO;
- update the manual;
- review all the little consts, bools, explicits and such;
- replace PgTransaction by a more fine-grained and exception-safe
mechanism outside the PgDatabase hierarchy;
- provide STL-conformant interfaces for iterating over result sets;
- allow fields to be accessed in a type-safe manner;
- ensure clean compilation under g++ 3.0;
- bring functionality up-to-date with libpq if, as & where needed
Would that be OK?
Jeroen
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: libpq++
@ 2001-03-07 21:35 Randy Jonasz <rjonasz@click2net.com>
parent: J. T. Vermeulen <jtv@cistron-office.nl>
4 siblings, 1 reply; 36+ messages in thread
From: Randy Jonasz @ 2001-03-07 21:35 UTC (permalink / raw)
To: J. T. Vermeulen <jtv@cistron-office.nl>; +Cc: pgsql-interfaces
Hi Jeroen,
I'm very interested in a total revamp of the C++ API. I'd like to mirror
the roguewave dbtools++ api in some ways as well as building a STL
compliant interface. Would you be interested in working together on this?
Cheers,
Randy
On Wed, 7 Mar 2001, J. T. Vermeulen wrote:
> Is anyone maintaining libpq++? My patches are beginning to seriously
> overlap each other, making it hard to submit them individually.
>
> If there's nobody out there, I'd be willing to maintain this code and
> make more extensive changes. In particular, I would like to:
>
> - introduce exceptions instead of manual checking, as suggested in TODO;
> - update the manual;
> - review all the little consts, bools, explicits and such;
> - replace PgTransaction by a more fine-grained and exception-safe
> mechanism outside the PgDatabase hierarchy;
> - provide STL-conformant interfaces for iterating over result sets;
> - allow fields to be accessed in a type-safe manner;
> - ensure clean compilation under g++ 3.0;
> - bring functionality up-to-date with libpq if, as & where needed
>
> Would that be OK?
>
>
> Jeroen
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://www.postgresql.org/search.mpl
>
>
Randy Jonasz
Software Engineer
Click2net Inc.
Web: http://www.click2net.com
Phone: (905) 271-3550
"You cannot possibly pay a philosopher what he's worth,
but try your best" -- Aristotle
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: libpq++
@ 2001-03-07 21:43 Bruce Momjian <pgman@candle.pha.pa.us>
parent: J. T. Vermeulen <jtv@cistron-office.nl>
4 siblings, 0 replies; 36+ messages in thread
From: Bruce Momjian @ 2001-03-07 21:43 UTC (permalink / raw)
To: J. T. Vermeulen <jtv@cistron-office.nl>; +Cc: pgsql-interfaces
Sounds great. We are in 7.1 beta hold, so keep going and we can apply
anything you have once we start on 7.2.
> Is anyone maintaining libpq++? My patches are beginning to seriously
> overlap each other, making it hard to submit them individually.
>
> If there's nobody out there, I'd be willing to maintain this code and
> make more extensive changes. In particular, I would like to:
>
> - introduce exceptions instead of manual checking, as suggested in TODO;
> - update the manual;
> - review all the little consts, bools, explicits and such;
> - replace PgTransaction by a more fine-grained and exception-safe
> mechanism outside the PgDatabase hierarchy;
> - provide STL-conformant interfaces for iterating over result sets;
> - allow fields to be accessed in a type-safe manner;
> - ensure clean compilation under g++ 3.0;
> - bring functionality up-to-date with libpq if, as & where needed
>
> Would that be OK?
>
>
> Jeroen
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://www.postgresql.org/search.mpl
>
--
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] 36+ messages in thread
* Re: libpq++
@ 2001-03-07 22:02 Bruce Momjian <pgman@candle.pha.pa.us>
parent: J. T. Vermeulen <jtv@cistron-office.nl>
4 siblings, 1 reply; 36+ messages in thread
From: Bruce Momjian @ 2001-03-07 22:02 UTC (permalink / raw)
To: J. T. Vermeulen <jtv@cistron-office.nl>; +Cc: pgsql-interfaces
> Is anyone maintaining libpq++? My patches are beginning to seriously
> overlap each other, making it hard to submit them individually.
>
> If there's nobody out there, I'd be willing to maintain this code and
> make more extensive changes. In particular, I would like to:
>
> - introduce exceptions instead of manual checking, as suggested in TODO;
> - update the manual;
> - review all the little consts, bools, explicits and such;
> - replace PgTransaction by a more fine-grained and exception-safe
> mechanism outside the PgDatabase hierarchy;
> - provide STL-conformant interfaces for iterating over result sets;
> - allow fields to be accessed in a type-safe manner;
> - ensure clean compilation under g++ 3.0;
> - bring functionality up-to-date with libpq if, as & where needed
>
> Would that be OK?
Also, would you review this?
ftp://candle.pha.pa.us/pub/postgresql/libpq++.mbox
and merge any valuable changes into your copy of the code. Much of it
is already in there.
--
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] 36+ messages in thread
* Re: libpq++
@ 2001-03-07 22:18 Tom Lane <tgl@sss.pgh.pa.us>
parent: J. T. Vermeulen <jtv@cistron-office.nl>
4 siblings, 0 replies; 36+ messages in thread
From: Tom Lane @ 2001-03-07 22:18 UTC (permalink / raw)
To: J. T. Vermeulen <jtv@cistron-office.nl>; +Cc: pgsql-interfaces
"J. T. Vermeulen" <jtv@cistron-office.nl> writes:
> Is anyone maintaining libpq++?
No one's been seen doing any major work on it in quite a while,
AFAIR.
> If there's nobody out there, I'd be willing to maintain this code and
> make more extensive changes. In particular, I would like to:
Go for it!
regards, tom lane
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: libpq++
@ 2001-03-07 22:20 J. T. Vermeulen <jtv@cistron-office.nl>
parent: Bruce Momjian <pgman@candle.pha.pa.us>
0 siblings, 2 replies; 36+ messages in thread
From: J. T. Vermeulen @ 2001-03-07 22:20 UTC (permalink / raw)
To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: J. T. Vermeulen <jtv@cistron-office.nl>; pgsql-interfaces
On Wed, 07 Mar 2001, Bruce Momjian wrote:
> > Would that be OK?
>
> Also, would you review this?
>
> ftp://candle.pha.pa.us/pub/postgresql/libpq++.mbox
>
> and merge any valuable changes into your copy of the code. Much of it
> is already in there.
Will do. Can I take it there have been no other changes between 7.0.3 and 7.2
as far as libpq++ is concerned, so I can continue to work with the version I
have?
Jeroen
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: libpq++
@ 2001-03-07 22:23 Bruce Momjian <pgman@candle.pha.pa.us>
parent: J. T. Vermeulen <jtv@cistron-office.nl>
1 sibling, 0 replies; 36+ messages in thread
From: Bruce Momjian @ 2001-03-07 22:23 UTC (permalink / raw)
To: J. T. Vermeulen <jtv@cistron-office.nl>; +Cc: pgsql-interfaces
> On Wed, 07 Mar 2001, Bruce Momjian wrote:
>
> > > Would that be OK?
> >
> > Also, would you review this?
> >
> > ftp://candle.pha.pa.us/pub/postgresql/libpq++.mbox
> >
> > and merge any valuable changes into your copy of the code. Much of it
> > is already in there.
>
> Will do. Can I take it there have been no other changes between 7.0.3 and 7.2
> as far as libpq++ is concerned, so I can continue to work with the version I
> have?
I don't think much has been done with 7.1 libpq++. I would download the
snapshot and do a diff against 7.0.3 to be sure.
Attached are the changes I see since 7.0.0. They are very minor.
--
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
Index: libpq++.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/libpq++.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -c -r1.9 -r1.10
*** libpq++.h 2000/04/22 22:39:15 1.9
--- libpq++.h 2001/01/24 19:43:32 1.10
***************
*** 13,22 ****
* in the build environment the individual include files are not
* yet installed in a subdirectory.
*
! * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
! * $Id: libpq++.h,v 1.9 2000/04/22 22:39:15 tgl Exp $
*
*-------------------------------------------------------------------------
*/
--- 13,22 ----
* in the build environment the individual include files are not
* yet installed in a subdirectory.
*
! * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
! * $Id: libpq++.h,v 1.10 2001/01/24 19:43:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Index: pgconnection.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgconnection.cc,v
retrieving revision 1.9
retrieving revision 1.10
diff -c -r1.9 -r1.10
*** pgconnection.cc 2000/04/22 22:39:15 1.9
--- pgconnection.cc 2000/07/27 19:44:01 1.10
***************
*** 10,16 ****
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
! * $Header: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgconnection.cc,v 1.9 2000/04/22 22:39:15 tgl Exp $
*
*-------------------------------------------------------------------------
*/
--- 10,16 ----
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
! * $Header: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgconnection.cc,v 1.10 2000/07/27 19:44:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
***************
*** 46,61 ****
// Close the connection only if needed
// This feature will most probably be used by the derived classes that
// need not close the connection after they are destructed.
! if ( pgCloseConnection ) {
if(pgResult) PQclear(pgResult);
if(pgConn) PQfinish(pgConn);
}
}
// PgConnection::connect
// establish a connection to a backend
ConnStatusType PgConnection::Connect(const char* conninfo)
{
// Connect to the database
pgConn = PQconnectdb(conninfo);
--- 46,77 ----
// Close the connection only if needed
// This feature will most probably be used by the derived classes that
// need not close the connection after they are destructed.
! CloseConnection();
! }
!
!
! // PgConnection::CloseConnection()
! // close down the connection if there is one
! void PgConnection::CloseConnection()
! {
! // if the connection is open, close it first
! if ( pgCloseConnection ) {
if(pgResult) PQclear(pgResult);
+ pgResult=NULL;
if(pgConn) PQfinish(pgConn);
+ pgConn=NULL;
+ pgCloseConnection=0;
}
}
+
// PgConnection::connect
// establish a connection to a backend
ConnStatusType PgConnection::Connect(const char* conninfo)
{
+ // if the connection is open, close it first
+ CloseConnection();
+
// Connect to the database
pgConn = PQconnectdb(conninfo);
Index: pgconnection.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgconnection.h,v
retrieving revision 1.7
retrieving revision 1.10
diff -c -r1.7 -r1.10
*** pgconnection.h 2000/04/22 22:39:15 1.7
--- pgconnection.h 2001/02/10 02:31:30 1.10
***************
*** 10,19 ****
* NOTES
* Currently under construction.
*
! * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
! * $Id: pgconnection.h,v 1.7 2000/04/22 22:39:15 tgl Exp $
*
*-------------------------------------------------------------------------
*/
--- 10,19 ----
* NOTES
* Currently under construction.
*
! * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
! * $Id: pgconnection.h,v 1.10 2001/02/10 02:31:30 tgl Exp $
*
*-------------------------------------------------------------------------
*/
***************
*** 38,44 ****
#endif
extern "C" {
! #include "postgres.h"
#include "libpq-fe.h"
}
--- 38,44 ----
#endif
extern "C" {
! #include "postgres_fe.h"
#include "libpq-fe.h"
}
***************
*** 81,86 ****
--- 81,87 ----
protected:
ConnStatusType Connect(const char* conninfo);
+ void CloseConnection();
string IntToString(int);
// Default constructor is only available to subclasses
PgConnection();
Index: pgcursordb.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgcursordb.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -c -r1.5 -r1.6
*** pgcursordb.h 2000/04/22 22:39:15 1.5
--- pgcursordb.h 2001/01/24 19:43:32 1.6
***************
*** 10,20 ****
* NOTES
* Currently under construction.
*
! * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
*
! * $Id: pgcursordb.h,v 1.5 2000/04/22 22:39:15 tgl Exp $
*
*-------------------------------------------------------------------------
*/
--- 10,20 ----
* NOTES
* Currently under construction.
*
! * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
! * $Id: pgcursordb.h,v 1.6 2001/01/24 19:43:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Index: pgdatabase.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgdatabase.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -c -r1.8 -r1.9
*** pgdatabase.h 2000/04/22 22:39:15 1.8
--- pgdatabase.h 2001/01/24 19:43:32 1.9
***************
*** 10,20 ****
* NOTES
* Currently under construction.
*
! * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
*
! * $Id: pgdatabase.h,v 1.8 2000/04/22 22:39:15 tgl Exp $
*
*-------------------------------------------------------------------------
*/
--- 10,20 ----
* NOTES
* Currently under construction.
*
! * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
! * $Id: pgdatabase.h,v 1.9 2001/01/24 19:43:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Index: pglobject.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pglobject.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -c -r1.5 -r1.6
*** pglobject.h 2000/04/22 22:39:15 1.5
--- pglobject.h 2001/01/24 19:43:32 1.6
***************
*** 7,17 ****
* declaration of the PGlobj class.
* PGlobj encapsulates a large object interface to Postgres backend
*
! * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
*
! * $Id: pglobject.h,v 1.5 2000/04/22 22:39:15 tgl Exp $
*
*-------------------------------------------------------------------------
*/
--- 7,17 ----
* declaration of the PGlobj class.
* PGlobj encapsulates a large object interface to Postgres backend
*
! * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
! * $Id: pglobject.h,v 1.6 2001/01/24 19:43:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Index: pgtransdb.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgtransdb.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -c -r1.5 -r1.6
*** pgtransdb.h 2000/04/22 22:39:15 1.5
--- pgtransdb.h 2001/01/24 19:43:32 1.6
***************
*** 10,20 ****
* NOTES
* Currently under construction.
*
! * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
*
! * $Id: pgtransdb.h,v 1.5 2000/04/22 22:39:15 tgl Exp $
*
*-------------------------------------------------------------------------
*/
--- 10,20 ----
* NOTES
* Currently under construction.
*
! * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
! * $Id: pgtransdb.h,v 1.6 2001/01/24 19:43:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Index: examples/Makefile
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/Makefile,v
retrieving revision 1.10
retrieving revision 1.12
diff -c -r1.10 -r1.12
*** examples/Makefile 2000/03/02 02:00:59 1.10
--- examples/Makefile 2000/06/17 00:10:20 1.12
***************
*** 15,33 ****
#CXXFLAGS= $(CFLAGS) -Wno-error -Wno-unused -Wl,-Bdynamic
CXXFLAGS= $(CFLAGS)
! INCLUDE_OPT= -I$(HEADERDIR)
- CXXFLAGS+= $(INCLUDE_OPT)
-
LDFLAGS+= -L$(LIBPQDIR) -lpq++
-
- #
- # And where libpq goes, so goes the authentication stuff...
- #
- ifdef KRBVERS
- LDFLAGS+= $(KRBLIBS)
- CXXFLAGS+= $(KRBFLAGS)
- endif
PROGS= testlibpq0 testlibpq1 testlibpq2 testlibpq3 \
testlibpq4 testlibpq5 testlibpq6 testlo
--- 15,23 ----
#CXXFLAGS= $(CFLAGS) -Wno-error -Wno-unused -Wl,-Bdynamic
CXXFLAGS= $(CFLAGS)
! CXXFLAGS+= -I$(HEADERDIR)
LDFLAGS+= -L$(LIBPQDIR) -lpq++
PROGS= testlibpq0 testlibpq1 testlibpq2 testlibpq3 \
testlibpq4 testlibpq5 testlibpq6 testlo
Index: examples/testlibpq0.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq0.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -c -r1.5 -r1.6
*** examples/testlibpq0.cc 1999/12/03 18:28:32 1.5
--- examples/testlibpq0.cc 2000/05/29 21:25:04 1.6
***************
*** 9,21 ****
*
*
* IDENTIFICATION
! * $Header: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq0.cc,v 1.5 1999/12/03 18:28:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <iostream.h>
! #include <libpq++.h>
int main()
{
--- 9,21 ----
*
*
* IDENTIFICATION
! * $Header: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq0.cc,v 1.6 2000/05/29 21:25:04 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <iostream.h>
! #include "libpq++.h"
int main()
{
Index: examples/testlibpq1.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq1.cc,v
retrieving revision 1.7
retrieving revision 1.8
diff -c -r1.7 -r1.8
*** examples/testlibpq1.cc 2000/04/25 21:00:29 1.7
--- examples/testlibpq1.cc 2000/05/29 21:25:04 1.8
***************
*** 8,14 ****
#include <iostream.h>
#include <iomanip.h>
! #include <libpq++.h>
int main()
{
--- 8,14 ----
#include <iostream.h>
#include <iomanip.h>
! #include "libpq++.h"
int main()
{
Index: examples/testlibpq2.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq2.cc,v
retrieving revision 1.8
retrieving revision 1.9
diff -c -r1.8 -r1.9
*** examples/testlibpq2.cc 2000/04/25 21:00:29 1.8
--- examples/testlibpq2.cc 2000/05/29 21:25:04 1.9
***************
*** 8,14 ****
#include <iostream.h>
#include <iomanip.h>
! #include <libpq++.h>
int main()
{
--- 8,14 ----
#include <iostream.h>
#include <iomanip.h>
! #include "libpq++.h"
int main()
{
Index: examples/testlibpq3.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq3.cc,v
retrieving revision 1.8
retrieving revision 1.9
diff -c -r1.8 -r1.9
*** examples/testlibpq3.cc 2000/04/25 21:00:29 1.8
--- examples/testlibpq3.cc 2000/05/29 21:25:04 1.9
***************
*** 9,15 ****
#include <iostream.h>
#include <iomanip.h>
! #include <libpq++.h>
int main()
{
--- 9,15 ----
#include <iostream.h>
#include <iomanip.h>
! #include "libpq++.h"
int main()
{
Index: examples/testlibpq4.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq4.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -c -r1.6 -r1.7
*** examples/testlibpq4.cc 2000/04/25 21:00:29 1.6
--- examples/testlibpq4.cc 2000/05/29 21:25:04 1.7
***************
*** 19,25 ****
*
*/
#include <iostream.h>
! #include <libpq++.h>
#include <stdlib.h>
main()
--- 19,25 ----
*
*/
#include <iostream.h>
! #include "libpq++.h"
#include <stdlib.h>
main()
Index: examples/testlibpq5.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq5.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -c -r1.6 -r1.7
*** examples/testlibpq5.cc 2000/04/25 21:00:29 1.6
--- examples/testlibpq5.cc 2000/05/29 21:25:04 1.7
***************
*** 27,33 ****
*
*/
#include <iostream.h>
! #include <libpq++.h>
#include <stdlib.h>
extern "C" {
#include "postgres.h" // for Postgres types
--- 27,33 ----
*
*/
#include <iostream.h>
! #include "libpq++.h"
#include <stdlib.h>
extern "C" {
#include "postgres.h" // for Postgres types
Index: examples/testlibpq6.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq6.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -c -r1.5 -r1.6
*** examples/testlibpq6.cc 2000/04/25 21:00:29 1.5
--- examples/testlibpq6.cc 2000/05/29 21:25:04 1.6
***************
*** 5,11 ****
*
*/
#include <iostream.h>
! #include <libpq++.h>
#include <stdlib.h>
main()
--- 5,11 ----
*
*/
#include <iostream.h>
! #include "libpq++.h"
#include <stdlib.h>
main()
Index: examples/testlo.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlo.cc,v
retrieving revision 1.7
retrieving revision 1.8
diff -c -r1.7 -r1.8
*** examples/testlo.cc 2000/04/25 21:00:29 1.7
--- examples/testlo.cc 2000/05/29 21:25:04 1.8
***************
*** 7,18 ****
*
*
* IDENTIFICATION
! * $Header: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlo.cc,v 1.7 2000/04/25 21:00:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <iostream.h>
! #include <libpq++.h>
#include <stdlib.h>
int main(int argc, char **argv)
--- 7,18 ----
*
*
* IDENTIFICATION
! * $Header: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlo.cc,v 1.8 2000/05/29 21:25:04 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <iostream.h>
! #include "libpq++.h"
#include <stdlib.h>
int main(int argc, char **argv)
Attachments:
[text/plain] /bjm/diff (16.1K, ../../200103072223.RAA04626@candle.pha.pa.us/2-%2Fbjm%2Fdiff)
download | inline:
Index: libpq++.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/libpq++.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -c -r1.9 -r1.10
*** libpq++.h 2000/04/22 22:39:15 1.9
--- libpq++.h 2001/01/24 19:43:32 1.10
***************
*** 13,22 ****
* in the build environment the individual include files are not
* yet installed in a subdirectory.
*
! * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
! * $Id: libpq++.h,v 1.9 2000/04/22 22:39:15 tgl Exp $
*
*-------------------------------------------------------------------------
*/
--- 13,22 ----
* in the build environment the individual include files are not
* yet installed in a subdirectory.
*
! * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
! * $Id: libpq++.h,v 1.10 2001/01/24 19:43:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Index: pgconnection.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgconnection.cc,v
retrieving revision 1.9
retrieving revision 1.10
diff -c -r1.9 -r1.10
*** pgconnection.cc 2000/04/22 22:39:15 1.9
--- pgconnection.cc 2000/07/27 19:44:01 1.10
***************
*** 10,16 ****
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
! * $Header: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgconnection.cc,v 1.9 2000/04/22 22:39:15 tgl Exp $
*
*-------------------------------------------------------------------------
*/
--- 10,16 ----
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
! * $Header: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgconnection.cc,v 1.10 2000/07/27 19:44:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
***************
*** 46,61 ****
// Close the connection only if needed
// This feature will most probably be used by the derived classes that
// need not close the connection after they are destructed.
! if ( pgCloseConnection ) {
if(pgResult) PQclear(pgResult);
if(pgConn) PQfinish(pgConn);
}
}
// PgConnection::connect
// establish a connection to a backend
ConnStatusType PgConnection::Connect(const char* conninfo)
{
// Connect to the database
pgConn = PQconnectdb(conninfo);
--- 46,77 ----
// Close the connection only if needed
// This feature will most probably be used by the derived classes that
// need not close the connection after they are destructed.
! CloseConnection();
! }
!
!
! // PgConnection::CloseConnection()
! // close down the connection if there is one
! void PgConnection::CloseConnection()
! {
! // if the connection is open, close it first
! if ( pgCloseConnection ) {
if(pgResult) PQclear(pgResult);
+ pgResult=NULL;
if(pgConn) PQfinish(pgConn);
+ pgConn=NULL;
+ pgCloseConnection=0;
}
}
+
// PgConnection::connect
// establish a connection to a backend
ConnStatusType PgConnection::Connect(const char* conninfo)
{
+ // if the connection is open, close it first
+ CloseConnection();
+
// Connect to the database
pgConn = PQconnectdb(conninfo);
Index: pgconnection.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgconnection.h,v
retrieving revision 1.7
retrieving revision 1.10
diff -c -r1.7 -r1.10
*** pgconnection.h 2000/04/22 22:39:15 1.7
--- pgconnection.h 2001/02/10 02:31:30 1.10
***************
*** 10,19 ****
* NOTES
* Currently under construction.
*
! * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
! * $Id: pgconnection.h,v 1.7 2000/04/22 22:39:15 tgl Exp $
*
*-------------------------------------------------------------------------
*/
--- 10,19 ----
* NOTES
* Currently under construction.
*
! * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
! * $Id: pgconnection.h,v 1.10 2001/02/10 02:31:30 tgl Exp $
*
*-------------------------------------------------------------------------
*/
***************
*** 38,44 ****
#endif
extern "C" {
! #include "postgres.h"
#include "libpq-fe.h"
}
--- 38,44 ----
#endif
extern "C" {
! #include "postgres_fe.h"
#include "libpq-fe.h"
}
***************
*** 81,86 ****
--- 81,87 ----
protected:
ConnStatusType Connect(const char* conninfo);
+ void CloseConnection();
string IntToString(int);
// Default constructor is only available to subclasses
PgConnection();
Index: pgcursordb.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgcursordb.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -c -r1.5 -r1.6
*** pgcursordb.h 2000/04/22 22:39:15 1.5
--- pgcursordb.h 2001/01/24 19:43:32 1.6
***************
*** 10,20 ****
* NOTES
* Currently under construction.
*
! * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
*
! * $Id: pgcursordb.h,v 1.5 2000/04/22 22:39:15 tgl Exp $
*
*-------------------------------------------------------------------------
*/
--- 10,20 ----
* NOTES
* Currently under construction.
*
! * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
! * $Id: pgcursordb.h,v 1.6 2001/01/24 19:43:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Index: pgdatabase.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgdatabase.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -c -r1.8 -r1.9
*** pgdatabase.h 2000/04/22 22:39:15 1.8
--- pgdatabase.h 2001/01/24 19:43:32 1.9
***************
*** 10,20 ****
* NOTES
* Currently under construction.
*
! * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
*
! * $Id: pgdatabase.h,v 1.8 2000/04/22 22:39:15 tgl Exp $
*
*-------------------------------------------------------------------------
*/
--- 10,20 ----
* NOTES
* Currently under construction.
*
! * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
! * $Id: pgdatabase.h,v 1.9 2001/01/24 19:43:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Index: pglobject.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pglobject.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -c -r1.5 -r1.6
*** pglobject.h 2000/04/22 22:39:15 1.5
--- pglobject.h 2001/01/24 19:43:32 1.6
***************
*** 7,17 ****
* declaration of the PGlobj class.
* PGlobj encapsulates a large object interface to Postgres backend
*
! * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
*
! * $Id: pglobject.h,v 1.5 2000/04/22 22:39:15 tgl Exp $
*
*-------------------------------------------------------------------------
*/
--- 7,17 ----
* declaration of the PGlobj class.
* PGlobj encapsulates a large object interface to Postgres backend
*
! * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
! * $Id: pglobject.h,v 1.6 2001/01/24 19:43:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Index: pgtransdb.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/pgtransdb.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -c -r1.5 -r1.6
*** pgtransdb.h 2000/04/22 22:39:15 1.5
--- pgtransdb.h 2001/01/24 19:43:32 1.6
***************
*** 10,20 ****
* NOTES
* Currently under construction.
*
! * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
*
! * $Id: pgtransdb.h,v 1.5 2000/04/22 22:39:15 tgl Exp $
*
*-------------------------------------------------------------------------
*/
--- 10,20 ----
* NOTES
* Currently under construction.
*
! * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
! * $Id: pgtransdb.h,v 1.6 2001/01/24 19:43:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Index: examples/Makefile
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/Makefile,v
retrieving revision 1.10
retrieving revision 1.12
diff -c -r1.10 -r1.12
*** examples/Makefile 2000/03/02 02:00:59 1.10
--- examples/Makefile 2000/06/17 00:10:20 1.12
***************
*** 15,33 ****
#CXXFLAGS= $(CFLAGS) -Wno-error -Wno-unused -Wl,-Bdynamic
CXXFLAGS= $(CFLAGS)
! INCLUDE_OPT= -I$(HEADERDIR)
- CXXFLAGS+= $(INCLUDE_OPT)
-
LDFLAGS+= -L$(LIBPQDIR) -lpq++
-
- #
- # And where libpq goes, so goes the authentication stuff...
- #
- ifdef KRBVERS
- LDFLAGS+= $(KRBLIBS)
- CXXFLAGS+= $(KRBFLAGS)
- endif
PROGS= testlibpq0 testlibpq1 testlibpq2 testlibpq3 \
testlibpq4 testlibpq5 testlibpq6 testlo
--- 15,23 ----
#CXXFLAGS= $(CFLAGS) -Wno-error -Wno-unused -Wl,-Bdynamic
CXXFLAGS= $(CFLAGS)
! CXXFLAGS+= -I$(HEADERDIR)
LDFLAGS+= -L$(LIBPQDIR) -lpq++
PROGS= testlibpq0 testlibpq1 testlibpq2 testlibpq3 \
testlibpq4 testlibpq5 testlibpq6 testlo
Index: examples/testlibpq0.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq0.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -c -r1.5 -r1.6
*** examples/testlibpq0.cc 1999/12/03 18:28:32 1.5
--- examples/testlibpq0.cc 2000/05/29 21:25:04 1.6
***************
*** 9,21 ****
*
*
* IDENTIFICATION
! * $Header: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq0.cc,v 1.5 1999/12/03 18:28:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <iostream.h>
! #include <libpq++.h>
int main()
{
--- 9,21 ----
*
*
* IDENTIFICATION
! * $Header: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq0.cc,v 1.6 2000/05/29 21:25:04 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <iostream.h>
! #include "libpq++.h"
int main()
{
Index: examples/testlibpq1.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq1.cc,v
retrieving revision 1.7
retrieving revision 1.8
diff -c -r1.7 -r1.8
*** examples/testlibpq1.cc 2000/04/25 21:00:29 1.7
--- examples/testlibpq1.cc 2000/05/29 21:25:04 1.8
***************
*** 8,14 ****
#include <iostream.h>
#include <iomanip.h>
! #include <libpq++.h>
int main()
{
--- 8,14 ----
#include <iostream.h>
#include <iomanip.h>
! #include "libpq++.h"
int main()
{
Index: examples/testlibpq2.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq2.cc,v
retrieving revision 1.8
retrieving revision 1.9
diff -c -r1.8 -r1.9
*** examples/testlibpq2.cc 2000/04/25 21:00:29 1.8
--- examples/testlibpq2.cc 2000/05/29 21:25:04 1.9
***************
*** 8,14 ****
#include <iostream.h>
#include <iomanip.h>
! #include <libpq++.h>
int main()
{
--- 8,14 ----
#include <iostream.h>
#include <iomanip.h>
! #include "libpq++.h"
int main()
{
Index: examples/testlibpq3.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq3.cc,v
retrieving revision 1.8
retrieving revision 1.9
diff -c -r1.8 -r1.9
*** examples/testlibpq3.cc 2000/04/25 21:00:29 1.8
--- examples/testlibpq3.cc 2000/05/29 21:25:04 1.9
***************
*** 9,15 ****
#include <iostream.h>
#include <iomanip.h>
! #include <libpq++.h>
int main()
{
--- 9,15 ----
#include <iostream.h>
#include <iomanip.h>
! #include "libpq++.h"
int main()
{
Index: examples/testlibpq4.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq4.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -c -r1.6 -r1.7
*** examples/testlibpq4.cc 2000/04/25 21:00:29 1.6
--- examples/testlibpq4.cc 2000/05/29 21:25:04 1.7
***************
*** 19,25 ****
*
*/
#include <iostream.h>
! #include <libpq++.h>
#include <stdlib.h>
main()
--- 19,25 ----
*
*/
#include <iostream.h>
! #include "libpq++.h"
#include <stdlib.h>
main()
Index: examples/testlibpq5.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq5.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -c -r1.6 -r1.7
*** examples/testlibpq5.cc 2000/04/25 21:00:29 1.6
--- examples/testlibpq5.cc 2000/05/29 21:25:04 1.7
***************
*** 27,33 ****
*
*/
#include <iostream.h>
! #include <libpq++.h>
#include <stdlib.h>
extern "C" {
#include "postgres.h" // for Postgres types
--- 27,33 ----
*
*/
#include <iostream.h>
! #include "libpq++.h"
#include <stdlib.h>
extern "C" {
#include "postgres.h" // for Postgres types
Index: examples/testlibpq6.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlibpq6.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -c -r1.5 -r1.6
*** examples/testlibpq6.cc 2000/04/25 21:00:29 1.5
--- examples/testlibpq6.cc 2000/05/29 21:25:04 1.6
***************
*** 5,11 ****
*
*/
#include <iostream.h>
! #include <libpq++.h>
#include <stdlib.h>
main()
--- 5,11 ----
*
*/
#include <iostream.h>
! #include "libpq++.h"
#include <stdlib.h>
main()
Index: examples/testlo.cc
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlo.cc,v
retrieving revision 1.7
retrieving revision 1.8
diff -c -r1.7 -r1.8
*** examples/testlo.cc 2000/04/25 21:00:29 1.7
--- examples/testlo.cc 2000/05/29 21:25:04 1.8
***************
*** 7,18 ****
*
*
* IDENTIFICATION
! * $Header: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlo.cc,v 1.7 2000/04/25 21:00:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <iostream.h>
! #include <libpq++.h>
#include <stdlib.h>
int main(int argc, char **argv)
--- 7,18 ----
*
*
* IDENTIFICATION
! * $Header: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq++/examples/testlo.cc,v 1.8 2000/05/29 21:25:04 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <iostream.h>
! #include "libpq++.h"
#include <stdlib.h>
int main(int argc, char **argv)
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: libpq++
@ 2001-03-07 22:44 Tom Lane <tgl@sss.pgh.pa.us>
parent: J. T. Vermeulen <jtv@cistron-office.nl>
1 sibling, 1 reply; 36+ messages in thread
From: Tom Lane @ 2001-03-07 22:44 UTC (permalink / raw)
To: J. T. Vermeulen <jtv@cistron-office.nl>; +Cc: Bruce Momjian <pgman@candle.pha.pa.us>; pgsql-interfaces
"J. T. Vermeulen" <jtv@cistron-office.nl> writes:
> Will do. Can I take it there have been no other changes between 7.0.3
> and 7.2 as far as libpq++ is concerned, so I can continue to work with
> the version I have?
No, you shouldn't take it. For one thing, Peter E. has been
reorganizing the configure/build process, and that has impacted pretty
nearly everything. The changes aren't likely to be extensive, but you'd
still be facing a merge task when you are ready to submit diffs. Seems
like you might as well try to avoid that by starting from something more
current than 7.0.3.
7.1beta5 would probably be a reasonable starting point.
regards, tom lane
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: libpq++
@ 2001-03-07 23:02 J. T. Vermeulen <jtv@cistron-office.nl>
parent: Randy Jonasz <rjonasz@click2net.com>
0 siblings, 1 reply; 36+ messages in thread
From: J. T. Vermeulen @ 2001-03-07 23:02 UTC (permalink / raw)
To: Randy Jonasz <rjonasz@click2net.com>; +Cc: J. T. Vermeulen <jtv@cistron-office.nl>; pgsql-interfaces
On Wed, 07 Mar 2001, Randy Jonasz wrote:
> I'm very interested in a total revamp of the C++ API. I'd like to mirror
> the roguewave dbtools++ api in some ways as well as building a STL
> compliant interface. Would you be interested in working together on this?
Very. I'm sure they must've done a good job, seeing they have Todd Veldhuys
(the first to publish C++ expression templates) on board. But provided, of
course, that libpq++ can remain a reasonably light wrapper around the C
interface--or at least spend most of its code adapting the C API to the way
C++ wants things to be done.
First however I'll have to merge the changes from at least the three groups
of diffs that I have already. But for when the time comes, I'd be delighted
if you could point me to a brief introduction somewhere that tells me at a
quick glance what the general ideas behind the RogueWave API is. Oh, did I
mention I was interested in something short and nutshell-contained? ;-)
Jeroen
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: libpq++
@ 2001-03-07 23:13 J. T. Vermeulen <jtv@cistron-office.nl>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 36+ messages in thread
From: J. T. Vermeulen @ 2001-03-07 23:13 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: J. T. Vermeulen <jtv@cistron-office.nl>; Bruce Momjian <pgman@candle.pha.pa.us>; pgsql-interfaces
On Wed, 07 Mar 2001, Tom Lane wrote:
> No, you shouldn't take it. For one thing, Peter E. has been
> reorganizing the configure/build process, and that has impacted pretty
> nearly everything. The changes aren't likely to be extensive, but you'd
> still be facing a merge task when you are ready to submit diffs. Seems
> like you might as well try to avoid that by starting from something more
> current than 7.0.3.
>
> 7.1beta5 would probably be a reasonable starting point.
Whew--thanks! Indeed, I'm just reading through the CVS overview and I see it
now.
Downloadink 7.1b5 & lookink forward to more merging...
Jeroen
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: libpq++
@ 2001-03-08 21:31 Randy Jonasz <rjonasz@click2net.com>
parent: J. T. Vermeulen <jtv@cistron-office.nl>
0 siblings, 1 reply; 36+ messages in thread
From: Randy Jonasz @ 2001-03-08 21:31 UTC (permalink / raw)
To: J.T.Vermeulen <jtv@cistron-office.nl>; +Cc: pgsql-interfaces
That's great! I think the current C++ API could be improved by a bottom
up rewrite. This would facilitate a true OOP design and permit code such
as:
pgdatabase db( "coninfo" );
pgresult res = db.query( "sql");
psgresult::iterator row = res.begin();
pgresult::iterator end = res.end();
while( start < end ) {
*row >> var1 >> var2;
//or
var1 = row["colname"];
//or
var1 = row[col];
}
I'd like to see the result container comply with STL standard so results
can be used with the STL algorithms or copied into other containers. I've
talked about this in the past, and agree that lazy conversion of values
into their appropriate types would be of use as well.
what do you think?
Cheers,
Randy
On Thu, 8 Mar 2001, J.T.Vermeulen wrote:
> On Wed, 07 Mar 2001, Randy Jonasz wrote:
>
> > I'm very interested in a total revamp of the C++ API. I'd like to mirror
> > the roguewave dbtools++ api in some ways as well as building a STL
> > compliant interface. Would you be interested in working together on this?
>
> Very. I'm sure they must've done a good job, seeing they have Todd Veldhuys
> (the first to publish C++ expression templates) on board. But provided, of
> course, that libpq++ can remain a reasonably light wrapper around the C
> interface--or at least spend most of its code adapting the C API to the way
> C++ wants things to be done.
>
> First however I'll have to merge the changes from at least the three groups
> of diffs that I have already. But for when the time comes, I'd be delighted
> if you could point me to a brief introduction somewhere that tells me at a
> quick glance what the general ideas behind the RogueWave API is. Oh, did I
> mention I was interested in something short and nutshell-contained? ;-)
>
>
> Jeroen
>
>
>
Randy Jonasz
Software Engineer
Click2net Inc.
Web: http://www.click2net.com
Phone: (905) 271-3550
"You cannot possibly pay a philosopher what he's worth,
but try your best" -- Aristotle
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: libpq++
@ 2001-03-11 19:20 J. T. Vermeulen <jtv@cistron.nl>
parent: Randy Jonasz <rjonasz@click2net.com>
0 siblings, 0 replies; 36+ messages in thread
From: J. T. Vermeulen @ 2001-03-11 19:20 UTC (permalink / raw)
To: Randy Jonasz <rjonasz@click2net.com>; +Cc: J.T.Vermeulen <jtv@cistron-office.nl>; pgsql-interfaces
On Thu, 08 Mar 2001, Randy Jonasz wrote:
> psgresult::iterator row = res.begin();
> pgresult::iterator end = res.end();
>
> while( start < end ) {
>
> *row >> var1 >> var2;
> //or
> var1 = row["colname"];
> //or
> var1 = row[col];
>
> }
Right! For now I wouldn't so far as to make the result sets
modifiable though. That would be opening a whole new can of
worms. Also, there is the issue of type safety to be dealt
with. I think that has priority over operator << on result
sets.
So initially at least, const_iterators only. But definitely
yes on the sequence algorithms, and perhaps we could find a
meaningful way to work in associative behaviour as well.
One side effect of having a type-safe interface would be that
the COPY command no longer requires complete compile-time
knowledge of a table's definition. If COPY is faster than
INSERT for mass inserts (I have no idea whether it is, but it
might just skip a bit of parsing on the server side and send
less data over the wire), that would allow for faster
data insertion while keeping the program reasonably robust
w.r.t. schema changes.
Another thing that could be done is to also have a more
restricted interface where you don't send SQL at all, and all
operations are encoded in the class interface. That might
make it possible to have more-or-less generic failover built
into the frontend (automatically restore active triggers when
connection to server is recovered, stuff like that).
Jeroen
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: libpq++
@ 2001-04-29 20:04 Bruce Momjian <pgman@candle.pha.pa.us>
0 siblings, 3 replies; 36+ messages in thread
From: Bruce Momjian @ 2001-04-29 20:04 UTC (permalink / raw)
To: justinb@tricord.com; +Cc: pgsql-interfaces
I am not so much the libpq++ maintainer as the one who applies people's
patches. There is an interfaces list that would love to hear about your
work. I am CC'ing them on this. We certainly need libpq++
improvements. If you would prefer not to deal with the interfaces list,
send something to me and I will send it over there.
> Bruce -
> Are you the current maintainer of libpq++? I've got some stuff that
> would make it a much more inheritable class (at least from my perspective),
> and wouldn't break anything. If you're interested, let me know, and I'll
> outline it for you.
>
> -justinb
>
> --
> Justin Banks Tricord, Inc. justinb@tricord.com
> Education... has produced a vast population able to read but unable to
> distinguish what is worth reading. -G. M. Trevelyan
>
--
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] 36+ messages in thread
* Re: libpq++
@ 2001-04-30 03:07 Justin Banks <justinb@mr-boo.com>
parent: Bruce Momjian <pgman@candle.pha.pa.us>
2 siblings, 0 replies; 36+ messages in thread
From: Justin Banks @ 2001-04-30 03:07 UTC (permalink / raw)
To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: pgsql-interfaces
>>>>> "Bruce" == Bruce Momjian <pgman@candle.pha.pa.us> writes:
Bruce> I am not so much the libpq++ maintainer as the one who applies
Bruce> people's patches. There is an interfaces list that would love to
Bruce> hear about your work. I am CC'ing them on this. We certainly need
Bruce> libpq++ improvements. If you would prefer not to deal with the
Bruce> interfaces list, send something to me and I will send it over there.
Here's what I've done. The following code will create a number of different
connections to the B.E., even though there's no reason to have more than
one. This prevents one from inheriting PgDatabase, and then creating an array
of 100 or so of those objects.
#include <iostream.h>
#include <stdlib.h>
#include <libpq++.h>
class base : public PgDatabase {
public:
base() {
cout << "base class instantiating" << endl;
Connect("host=db dbname=golem user=golemadmin password=bleen");
}
virtual ~base() {
cout << "Base class destructing" << endl;
}
};
class derived : public base {
public:
derived() {
cout << "derived class instantiating" << endl;
}
~derived() {
cout << "derived class destructing" << endl;
}
};
int
main(int argc, char* argv[]) {
int cnt, tuples;
derived* classes, *ptr;
derived single;
if(argc > 1)
cnt = atoi(argv[1]);
else
cnt = 5;
cout << "getting array of " << cnt << " objects" << endl;
classes = new derived[cnt];
cout << "array allocated, sleeping for validation" << endl;
sleep(5);
for(int i = 0; i < cnt; i++) {
cout << "testing object " << i << endl;
ptr = &(classes[i]);
ptr->Exec("select * from defaults");
tuples = ptr->Tuples();
cout << "got " << tuples << " tuples" << endl;
for(int j = 0; j < tuples; j++) {
cout << "4th field is " << ptr->GetValue(j, 4) << endl;
}
}
delete[] classes;
cout << "aggregates deleted" << endl;
single.Exec("select table_name from tables limit 1");
cout << "exec of single finished" << endl;
cout << "value is " << single.GetValue(0, 0) << endl;
exit(0);
}
What I'd like to have happen is for a total of one connection to the database
to be made, and have all these objects share that connection transparently. I
made this happen by using a shared memory segment to store the connection
pointer. Here's the diff. It doesn't seem to break anything, but then again,
my coverage is rather limited at this point.
Diff follows :
--- pgconnection.cc.orig Sun Apr 29 16:09:02 2001
+++ pgconnection.cc Sun Apr 29 21:35:36 2001
@@ -17,7 +17,6 @@
#include "pgconnection.h"
-
// ****************************************************************
//
// PgConnection Implementation
@@ -54,7 +53,15 @@
// close down the connection if there is one
void PgConnection::CloseConnection()
{
- // if the connection is open, close it first
+#if USING_SYSV_IPC == 1
+ struct shmid_ds shminfo;
+
+ shmctl(shmid, IPC_STAT, &shminfo);
+ //
+ // if we're the only one left ...
+ //
+ if(shminfo.shm_nattch == 1) {
+#endif
if ( pgCloseConnection ) {
if(pgResult) PQclear(pgResult);
pgResult=NULL;
@@ -62,6 +69,10 @@
pgConn=NULL;
pgCloseConnection=0;
}
+#if USING_SYSV_IPC == 1
+ }
+ shmdt(addr);
+#endif
}
@@ -69,11 +80,60 @@
// establish a connection to a backend
ConnStatusType PgConnection::Connect(const char* conninfo)
{
+#if USING_SYSV_IPC == 1
+ int key = (int)getpid();
+ struct shmid_ds shminfo;
+#endif
+
// if the connection is open, close it first
CloseConnection();
// Connect to the database
+#if USING_SYSV_IPC == 1
+ if((shmid = shmget(key, sizeof(addr), IPC_CREAT|SHM_W|SHM_R)) >= 0) {
+ if((addr = (int*)shmat(shmid, 0, 0)) > 0) {
+ //
+ // now, we have our segment. If we're the first attacher, then we need
+ // to do the connect. If we're not the first attacher, then the
+ // connection is already made, we just need to check and make sure
+ // it's okay, connecting again if we have to.
+ //
+ if(shmctl(shmid, IPC_STAT, &shminfo) == 0) {
+ if(shminfo.shm_nattch == 1) {
+ pgConn = PQconnectdb(conninfo);
+ *addr = (int)pgConn;
+ }
+ else {
+ pgConn = (PGconn*)*addr;
+ if(Status() == CONNECTION_BAD) {
+ pgConn = PQconnectdb(conninfo);
+ *addr = (int)pgConn;
+ }
+ }
+ }
+ else {
+ //
+ // fallback to safe connection
+ //
+ pgConn = PQconnectdb(conninfo);
+ }
+ }
+ else {
+ //
+ // fallback to safe connection
+ //
+ pgConn = PQconnectdb(conninfo);
+ }
+ }
+ else {
+ //
+ // fallback to safe connection
+ //
+ pgConn = PQconnectdb(conninfo);
+ }
+#else
pgConn = PQconnectdb(conninfo);
+#endif
// Now we have a connection we must close (even if it's bad!)
pgCloseConnection = 1;
--- pgconnection.h.orig Sun Apr 29 16:09:54 2001
+++ pgconnection.h Sun Apr 29 17:07:57 2001
@@ -46,6 +46,15 @@
using namespace std;
#endif
+#if HAVE_SYS_SHM_H == 1 && HAVE_SYS_IPC_H == 1
+ #include <sys/types.h>
+ #include <sys/ipc.h>
+ #include <sys/shm.h>
+ #include <unistd.h>
+ #define USING_SYSV_IPC 1
+#else
+ #define USING_SYSV_IPC 0
+#endif
// ****************************************************************
//
@@ -91,6 +100,9 @@
// so make copy constructor and assignment op private.
PgConnection(const PgConnection&);
PgConnection& operator= (const PgConnection&);
+#if USING_SYSV_IPC == 1
+ int shmid, *addr;
+#endif
};
#endif // PGCONNECTION_H
I think that's it. I've got more at work, so I may have missed something, but
I don't think so.
-justinb
--
Justin Banks @ home
Distrust any enterprise that requires new clothes. -Thoreau
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: libpq++
@ 2001-04-30 12:53 Justin Banks <justinb@mr-boo.com>
parent: Bruce Momjian <pgman@candle.pha.pa.us>
2 siblings, 1 reply; 36+ messages in thread
From: Justin Banks @ 2001-04-30 12:53 UTC (permalink / raw)
To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: pgsql-interfaces
>>>>> "Bruce" == Bruce Momjian <pgman@candle.pha.pa.us> writes:
Bruce> I am not so much the libpq++ maintainer as the one who applies
Bruce> people's patches. There is an interfaces list that would love to
Bruce> hear about your work. I am CC'ing them on this. We certainly need
Bruce> libpq++ improvements. If you would prefer not to deal with the
Bruce> interfaces list, send something to me and I will send it over there.
As one would have expected, I've found a problem. The c++ std. says that
Automatic objects are not destroyed as a result of calling exit(), and so, a
automatic PgDatabase in main() (or most anywhere, actually), would not have
it's destructor called during an exit(), thereby leaving junk shm. segments
around. I'm not sure that an atexit can be called on a member function with no
argument, so I'll do some experimenting with macros and temporary block
insertion. Better ideas welcome ;)
-justinb
--
Justin Banks @ home
'We have no intention of shipping another bloated operating system and
forcing that down the throats of our Windows customers'
-- Paul Maritz, Microsoft Group Vice President
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: Re: libpq++
@ 2001-05-03 13:47 J. T. Vermeulen <jtv@cistron-office.nl>
parent: Bruce Momjian <pgman@candle.pha.pa.us>
2 siblings, 1 reply; 36+ messages in thread
From: J. T. Vermeulen @ 2001-05-03 13:47 UTC (permalink / raw)
To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: pgsql-interfaces
On Sun, 29 Apr 2001, Bruce Momjian wrote:
> I am not so much the libpq++ maintainer as the one who applies people's
> patches. There is an interfaces list that would love to hear about your
> work. I am CC'ing them on this. We certainly need libpq++
> improvements. If you would prefer not to deal with the interfaces list,
> send something to me and I will send it over there.
Working on rewrite--can do some serious work once my new laptop arrives.
Jeroen
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: Re: libpq++
@ 2001-05-03 14:41 Justin Banks <justinb@tricord.com>
parent: J. T. Vermeulen <jtv@cistron-office.nl>
0 siblings, 0 replies; 36+ messages in thread
From: Justin Banks @ 2001-05-03 14:41 UTC (permalink / raw)
To: J. T. Vermeulen <jtv@cistron-office.nl>; +Cc: Bruce Momjian <pgman@candle.pha.pa.us>; pgsql-interfaces
>>>>> "J" == J T Vermeulen <jtv@cistron-office.nl> writes:
J> On Sun, 29 Apr 2001, Bruce Momjian wrote:
>> I am not so much the libpq++ maintainer as the one who applies people's
>> patches. There is an interfaces list that would love to hear about your
>> work. I am CC'ing them on this. We certainly need libpq++ improvements.
>> If you would prefer not to deal with the interfaces list, send something
>> to me and I will send it over there.
J> Working on rewrite--can do some serious work once my new laptop arrives.
OK. The shmem stuff requires some more work in order for the cursor stuff to
work right, anyway.
-justinb
--
Justin Banks Tricord, Inc. justinb@tricord.com
In the good old days physicists repeated each other's experiments,
just to be sure. Today they stick to FORTRAN, so that they can
share each other's programs, bugs included. - Dijkstra 1975
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: Re: libpq++
@ 2001-05-03 19:13 Tom Lane <tgl@sss.pgh.pa.us>
parent: Justin Banks <justinb@mr-boo.com>
0 siblings, 1 reply; 36+ messages in thread
From: Tom Lane @ 2001-05-03 19:13 UTC (permalink / raw)
To: justinb@mr-boo.com; +Cc: Bruce Momjian <pgman@candle.pha.pa.us>; pgsql-interfaces
Justin Banks <justinb@mr-boo.com> writes:
> As one would have expected, I've found a problem. The c++ std. says that
> Automatic objects are not destroyed as a result of calling exit(), and so, a
> automatic PgDatabase in main() (or most anywhere, actually), would not have
> it's destructor called during an exit(), thereby leaving junk shm. segments
> around.
Unless your kernel is broken, application exit will cause the backend
connection to be closed, whereupon the backend will exit gracefully.
I see nothing to worry about here.
I'm not sure where you got this notion that clients get to touch any
of Postgres' shared memory ;-) but they don't.
regards, tom lane
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: Re: libpq++
@ 2001-05-03 19:15 Bruce Momjian <pgman@candle.pha.pa.us>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 36+ messages in thread
From: Bruce Momjian @ 2001-05-03 19:15 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-interfaces
> Justin Banks <justinb@mr-boo.com> writes:
> > As one would have expected, I've found a problem. The c++ std. says that
> > Automatic objects are not destroyed as a result of calling exit(), and so, a
> > automatic PgDatabase in main() (or most anywhere, actually), would not have
> > it's destructor called during an exit(), thereby leaving junk shm. segments
> > around.
>
> Unless your kernel is broken, application exit will cause the backend
> connection to be closed, whereupon the backend will exit gracefully.
> I see nothing to worry about here.
>
> I'm not sure where you got this notion that clients get to touch any
> of Postgres' shared memory ;-) but they don't.
I think he is creating his own shared memory area:
---------------------------------------------------------------------------
What I'd like to have happen is for a total of one connection to the
database to be made, and have all these objects share that connection
transparently. I made this happen by using a shared memory segment to
store the connection pointer. Here's the diff. It doesn't seem to break
anything, but then again, my coverage is rather limited at this point.
--
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] 36+ messages in thread
* Re: Re: libpq++
@ 2001-05-03 19:25 Tom Lane <tgl@sss.pgh.pa.us>
parent: Bruce Momjian <pgman@candle.pha.pa.us>
0 siblings, 1 reply; 36+ messages in thread
From: Tom Lane @ 2001-05-03 19:25 UTC (permalink / raw)
To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: pgsql-interfaces
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> I think he is creating his own shared memory area:
Oh, I see. Isn't that pretty silly, considering that there's no way
for such objects to share a DBconnection if they are in different
application processes? Seems like a simple static variable would do
the job just as well with a lot fewer portability and resource-leakage
issues...
regards, tom lane
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: Re: libpq++
@ 2001-05-03 19:37 Justin Banks <justinb@tricord.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 36+ messages in thread
From: Justin Banks @ 2001-05-03 19:37 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Bruce Momjian <pgman@candle.pha.pa.us>; pgsql-interfaces
>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
Tom> Bruce Momjian <pgman@candle.pha.pa.us> writes:
>> I think he is creating his own shared memory area:
Tom> Oh, I see. Isn't that pretty silly, considering that there's no way
Tom> for such objects to share a DBconnection if they are in different
Tom> application processes? Seems like a simple static variable would do
Tom> the job just as well with a lot fewer portability and resource-leakage
Tom> issues...
If you have a class, say 'class host', that represents a table in your
database, in which you are storing host information, and you want each host to
also be a database object, you now have two choices, as far as I can tell. You
can connect to the database in the chain of constructors somewhere, or you can
put it off until you actually issue a query of some kind. Either way, you get
punished quite severely if you want say, a
int N = 75;
host * cluster_of_boxes = new host[N](default_parameters_of_some_kind);
since you either then have N connections to the backend, or every time you
want to go to the DB you take a big hit. With my modification, you only get
one connection to the backend, and all your host objects share it.
You're right - this only works because the shared connections all occur in the
same address space. It doesn't buy you anything between applications, only
inside an application. The problem is that there's no way for different
instantiations of classes inheriting database-ness from the PgDatabase class
to share a PGconn* unless the PgDatabase class provides a way for different
instantiations to know that existing connections are available.
-justinb
--
Justin Banks Tricord, Inc. justinb@tricord.com
"The time you enjoy wasting is not wasted time."
- Bertrand Russell
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: Re: libpq++
@ 2001-05-03 19:42 Tom Lane <tgl@sss.pgh.pa.us>
parent: Justin Banks <justinb@tricord.com>
0 siblings, 1 reply; 36+ messages in thread
From: Tom Lane @ 2001-05-03 19:42 UTC (permalink / raw)
To: justinb@tricord.com; +Cc: Bruce Momjian <pgman@candle.pha.pa.us>; pgsql-interfaces
Justin Banks <justinb@tricord.com> writes:
> You're right - this only works because the shared connections all
> occur in the same address space. It doesn't buy you anything between
> applications, only inside an application. The problem is that there's
> no way for different instantiations of classes inheriting
> database-ness from the PgDatabase class to share a PGconn* unless the
> PgDatabase class provides a way for different instantiations to know
> that existing connections are available.
And what's wrong with a static class variable for that purpose?
The shmem segment looks like the hardest possible way to get the
same result.
regards, tom lane
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: Re: libpq++
@ 2001-05-03 21:05 Justin Banks <justinb@tricord.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 36+ messages in thread
From: Justin Banks @ 2001-05-03 21:05 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: justinb@tricord.com, Bruce Momjian <pgman@candle.pha.pa.us>; pgsql-interfaces
>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
Tom> And what's wrong with a static class variable for that purpose? The
Tom> shmem segment looks like the hardest possible way to get the same
Tom> result.
I'm kinda embarrased to say I didn't think of that, actually. That would only
mean exposing the default constructor of PgDatabase, so the derived class
could put off connecting indefinitely, right?
-justinb
--
Justin Banks Tricord, Inc. justinb@tricord.com
<Randomly selected signature here>
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: libpq++
@ 2001-05-09 17:35 Bruce Momjian <pgman@candle.pha.pa.us>
parent: J. T. Vermeulen <jtv@cistron-office.nl>
4 siblings, 0 replies; 36+ messages in thread
From: Bruce Momjian @ 2001-05-09 17:35 UTC (permalink / raw)
To: J. T. Vermeulen <jtv@cistron-office.nl>; +Cc: pgsql-interfaces
> Is anyone maintaining libpq++? My patches are beginning to seriously
> overlap each other, making it hard to submit them individually.
>
> If there's nobody out there, I'd be willing to maintain this code and
> make more extensive changes. In particular, I would like to:
>
> - introduce exceptions instead of manual checking, as suggested in TODO;
> - update the manual;
> - review all the little consts, bools, explicits and such;
> - replace PgTransaction by a more fine-grained and exception-safe
> mechanism outside the PgDatabase hierarchy;
> - provide STL-conformant interfaces for iterating over result sets;
> - allow fields to be accessed in a type-safe manner;
> - ensure clean compilation under g++ 3.0;
> - bring functionality up-to-date with libpq if, as & where needed
>
> Would that be OK?
Sure. I can apply your patches now whenever I receive them. This will
allow others to work with your changes right away.
--
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] 36+ messages in thread
* Re: libpq++
@ 2001-05-09 19:15 Carlos Moreno <moreno@mochima.com>
0 siblings, 1 reply; 36+ messages in thread
From: Carlos Moreno @ 2001-05-09 19:15 UTC (permalink / raw)
To: J. T. Vermeulen <jtv@cistron-office.nl>; Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: pgsql-interfaces
>> - provide STL-conformant interfaces for iterating over result sets;
>> - allow fields to be accessed in a type-safe manner;
This would be beautiful! I can picture myself having fun
writing code like this:
conn.Exec ("select .....");
copy (conn.tuples().begin(), conn.tuples().end(),
ostream_iterator<tuple> (cout, "\n"));
(or even conn.begin(), conn.end())
or:
void custom_print_row (const tuple & row)
{
cout << "ID: " << row["ID"] << endl
<< "Name: " << row["name"] << endl
<< "Age: " << current_year() - row["year_born"]
<< endl << endl;
}
for_each (conn.begin(), conn.end(), custom_print_row);
Things like that... Definitely nice!
Carlos
--
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: libpq++
@ 2001-05-14 13:17 J. T. Vermeulen <jtv@cistron-office.nl>
parent: Carlos Moreno <moreno@mochima.com>
0 siblings, 0 replies; 36+ messages in thread
From: J. T. Vermeulen @ 2001-05-14 13:17 UTC (permalink / raw)
To: Carlos Moreno <moreno@mochima.com>; +Cc: J. T. Vermeulen <jtv@cistron-office.nl>; Bruce Momjian <pgman@candle.pha.pa.us>; pgsql-interfaces
On Wed, 09 May 2001, Carlos Moreno wrote:
> >> - provide STL-conformant interfaces for iterating over result sets;
> >> - allow fields to be accessed in a type-safe manner;
>
> This would be beautiful! I can picture myself having fun
> writing code like this:
One drawback is there won't be any non-const iterators on queries, nor proper
interaction with input iterators. Still thinking about that.
^ permalink raw reply [nested|flat] 36+ messages in thread
* libpq
@ 2003-01-02 06:09 Egil Moeller <redhog@redhog.org>
0 siblings, 0 replies; 36+ messages in thread
From: Egil Moeller @ 2003-01-02 06:09 UTC (permalink / raw)
To: pgsql-interfaces
I'm ATM trying to use the libpq to access a PostgreSQL 7.2 database with
multibyte character encoding turned on and set to UNICODE. Client encoding
is UNICODE, too. I'm trying to insert data into a table with a column of
type bytea, escaping the data using PQescapeBytea (and of course
surrounding its output with ' and ' in the insert statement). However,
when doing so, I get the error message 'ERROR: Unterminated quoted
string'. How come this happens, and what may I have done wrong? I am also
curious as to why there is no PQunescapeBytea in 7.2 (there is one in 7.3,
according to the documentation). How is data returned from a select of a
bytea field to be interpreted?
Regards,
Egil
P.S. Please do rreply to my personal address, aswell as to the list, as I
have the recieve-mail option turned of for this list. D.S.
--
http://redhog.org
GPG Public key: http://redhog.org/PGP%20Public%20key.asc
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!
^ permalink raw reply [nested|flat] 36+ messages in thread
* libpq++
@ 2003-06-26 13:03 Josh Harris <joshh@cti.co.za>
0 siblings, 0 replies; 36+ messages in thread
From: Josh Harris @ 2003-06-26 13:03 UTC (permalink / raw)
To: pgsql-interfaces
Hi there.
I am having trouble getting C++ to interface with a PostgreSQL database. I
want to use the libpq++ library, but can't quite figure out quite how.
I am using PostgreSQL 7.3.1 on WinXP. This distribution doesn't seem to have
shipped with libpq++, so I downloaded it seperately. The problem is that I
can't seem to get any of the example code to compile. I am using MinGW. I
have linked my project to the libpq.a library, included all the source files
in the libpq++4.0 folder that I downloaded, and specified the path to their
headers.
Does anyone have any experience with libpq++ on windows using MinGW?
Any help would be much appreciated.
Thanks,
Josh Harris.
joshh@cti.co.za
^ permalink raw reply [nested|flat] 36+ messages in thread
* LIBPQ
@ 2003-10-23 20:01 creid <creid@netbcg.com>
0 siblings, 1 reply; 36+ messages in thread
From: creid @ 2003-10-23 20:01 UTC (permalink / raw)
To: pgsql-interfaces
Can anyone help me understand what it is I need to do to simply retrieve
date and time columns into C variables that are readable. All other columns
are come across successfully but the date and time. I have tried double to
store the pg date and char[9] for time, among other typedef tries. My
psotgres columns are defined as: mytime time, mydate date.
Thanks
C
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: LIBPQ
@ 2003-10-27 07:10 Tomasz Myrta <jasiek@klaster.net>
parent: creid <creid@netbcg.com>
0 siblings, 0 replies; 36+ messages in thread
From: Tomasz Myrta @ 2003-10-27 07:10 UTC (permalink / raw)
To: creid <creid@netbcg.com>; +Cc: pgsql-interfaces
Dnia 2003-10-23 22:01, Użytkownik creid napisał:
> Can anyone help me understand what it is I need to do to simply retrieve
> date and time columns into C variables that are readable. All other columns
> are come across successfully but the date and time. I have tried double to
> store the pg date and char[9] for time, among other typedef tries. My
> psotgres columns are defined as: mytime time, mydate date.
>
> Thanks
> C
1. char[9] is too short for displaying time. Default text representation
of time is:
08:06:05.474477
You can:
- use longer variable char[16]
- format your time to have 08:06:05 only using to_char(...)
- change your columns from "time" to "time(0)"
2. char[9] is also too short for date. Default text representation for
date (European format) is:
2003-10-27
You need char[11] for this.
Regards,
Tomasz Myrta
^ permalink raw reply [nested|flat] 36+ messages in thread
* Re: LIBPQ
@ 2003-10-27 16:52 Anis W. Nugroho <anis_wn@gawab.com>
0 siblings, 0 replies; 36+ messages in thread
From: Anis W. Nugroho @ 2003-10-27 16:52 UTC (permalink / raw)
To: pgsql-interfaces
The efficient way to prepare your variables is test the query in
the
postgres front-end (psql) watch the result from the query and
set
your variable up according to that result.
Good luck,
Anis WN
________________________________
15 Mbytes Free Web-based and POP3
Sign up now: http://www.gawab.com
^ permalink raw reply [nested|flat] 36+ messages in thread
* fwd: libpq
@ 2005-03-18 20:34 Gabor Berenyi <ber_44@yahoo.com>
0 siblings, 0 replies; 36+ messages in thread
From: Gabor Berenyi @ 2005-03-18 20:34 UTC (permalink / raw)
To: PostgreSQL-patches <pgsql-patches@postgresql.org>; pgsql-interfaces
My letter was rejected so I uploaded the attachement:
http://school.tar.hu/maybe_a_dll_bug.zip
Here is the letter itself:
Now I send you [...]
a bug report (maybe_a_dll_bug.zip). I think it's not a
libpq.dll bug, but a related one at least. I would
very much appreciate your help.
maybe_a_dll_bug.zip contains a simple project that
dynamically loads libpq.dll and doesn't work.
Wine says (under Linux): validation failed for
vsinit.dll
Win98 and XP say: error in MSVCRT.DLL
Can you compile and run this simple project (it
contains no Borland-specific code, at least not the
Windows part)? Do I have the wrong DLLs? If yes, could
you send me the correct ones, please?
Thank you.
With love, Gabor
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/
^ permalink raw reply [nested|flat] 36+ messages in thread
end of thread, other threads:[~2005-03-18 20:34 UTC | newest]
Thread overview: 36+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-12-19 15:59 libpq Behzad Ardakani <Behzad@utilator.com>
1999-04-23 06:28 libpq++ Shad Cool <shad@gi.com.au>
1999-04-24 17:44 Re: [INTERFACES] libpq++ KaDe <kade@carolo.net>
1999-04-25 13:14 ` Re: [INTERFACES] libpq++ Oliver Elphick <olly@lfix.co.uk>
2001-03-07 19:52 libpq++ J. T. Vermeulen <jtv@cistron-office.nl>
2001-03-07 21:35 ` Re: libpq++ Randy Jonasz <rjonasz@click2net.com>
2001-03-07 23:02 ` Re: libpq++ J. T. Vermeulen <jtv@cistron-office.nl>
2001-03-08 21:31 ` Re: libpq++ Randy Jonasz <rjonasz@click2net.com>
2001-03-11 19:20 ` Re: libpq++ J. T. Vermeulen <jtv@cistron.nl>
2001-03-07 21:43 ` Re: libpq++ Bruce Momjian <pgman@candle.pha.pa.us>
2001-03-07 22:02 ` Re: libpq++ Bruce Momjian <pgman@candle.pha.pa.us>
2001-03-07 22:20 ` Re: libpq++ J. T. Vermeulen <jtv@cistron-office.nl>
2001-03-07 22:23 ` Re: libpq++ Bruce Momjian <pgman@candle.pha.pa.us>
2001-03-07 22:44 ` Re: libpq++ Tom Lane <tgl@sss.pgh.pa.us>
2001-03-07 23:13 ` Re: libpq++ J. T. Vermeulen <jtv@cistron-office.nl>
2001-03-07 22:18 ` Re: libpq++ Tom Lane <tgl@sss.pgh.pa.us>
2001-05-09 17:35 ` Re: libpq++ Bruce Momjian <pgman@candle.pha.pa.us>
2001-04-29 20:04 Re: libpq++ Bruce Momjian <pgman@candle.pha.pa.us>
2001-04-30 03:07 ` Re: libpq++ Justin Banks <justinb@mr-boo.com>
2001-04-30 12:53 ` Re: libpq++ Justin Banks <justinb@mr-boo.com>
2001-05-03 19:13 ` Re: Re: libpq++ Tom Lane <tgl@sss.pgh.pa.us>
2001-05-03 19:15 ` Re: Re: libpq++ Bruce Momjian <pgman@candle.pha.pa.us>
2001-05-03 19:25 ` Re: Re: libpq++ Tom Lane <tgl@sss.pgh.pa.us>
2001-05-03 19:37 ` Re: Re: libpq++ Justin Banks <justinb@tricord.com>
2001-05-03 19:42 ` Re: Re: libpq++ Tom Lane <tgl@sss.pgh.pa.us>
2001-05-03 21:05 ` Re: Re: libpq++ Justin Banks <justinb@tricord.com>
2001-05-03 13:47 ` Re: Re: libpq++ J. T. Vermeulen <jtv@cistron-office.nl>
2001-05-03 14:41 ` Re: Re: libpq++ Justin Banks <justinb@tricord.com>
2001-05-09 19:15 Re: libpq++ Carlos Moreno <moreno@mochima.com>
2001-05-14 13:17 ` Re: libpq++ J. T. Vermeulen <jtv@cistron-office.nl>
2003-01-02 06:09 libpq Egil Moeller <redhog@redhog.org>
2003-06-26 13:03 libpq++ Josh Harris <joshh@cti.co.za>
2003-10-23 20:01 LIBPQ creid <creid@netbcg.com>
2003-10-27 07:10 ` Re: LIBPQ Tomasz Myrta <jasiek@klaster.net>
2003-10-27 16:52 Re: LIBPQ Anis W. Nugroho <anis_wn@gawab.com>
2005-03-18 20:34 fwd: libpq Gabor Berenyi <ber_44@yahoo.com>
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