diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-04-22 22:39:15 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-04-22 22:39:15 +0000 |
| commit | 290978fff07d1b9570272cd9d3bf9d21359576d1 (patch) | |
| tree | 8b6abf8d9a87b88aff6984924b700765f7539ca1 /src/interfaces/libpq++/pglobject.cc | |
| parent | 51c92941c668028f60d8ff1eb86489af4dbba391 (diff) | |
| download | postgresql-290978fff07d1b9570272cd9d3bf9d21359576d1.tar.gz | |
Remove broken tracing code (which would be dangerous if it did work...)
libpq++.h contained copies of the class declarations in the other libpq++
include files, which was bogus enough, but the declarations were not
completely in step with the real declarations. Remove these in favor
of including the headers with #include. Make PgConnection destructor
virtual (not absolutely necessary, but seems like a real good idea
considering the number of subclasses derived from it). Give all classes
declared private copy constructors and assignment operators, to prevent
compiler from thinking it can copy these objects safely.
Diffstat (limited to 'src/interfaces/libpq++/pglobject.cc')
| -rw-r--r-- | src/interfaces/libpq++/pglobject.cc | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/interfaces/libpq++/pglobject.cc b/src/interfaces/libpq++/pglobject.cc index b6a53f7b20..5eee243686 100644 --- a/src/interfaces/libpq++/pglobject.cc +++ b/src/interfaces/libpq++/pglobject.cc @@ -10,17 +10,17 @@ * Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pglobject.cc,v 1.5 1999/05/30 15:17:58 tgl Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pglobject.cc,v 1.6 2000/04/22 22:39:15 tgl Exp $ * *------------------------------------------------------------------------- */ + +#include "pglobject.h" extern "C" { #include "libpq/libpq-fs.h" } -#include "pglobject.h" - // **************************************************************** // // PgLargeObject Implementation @@ -33,8 +33,10 @@ PgLargeObject::PgLargeObject(const char* conninfo) : PgConnection(conninfo) { Init(); - Create(); - Open(); + if (! ConnectionBad()) { + Create(); + Open(); + } } // constructor @@ -43,12 +45,12 @@ PgLargeObject::PgLargeObject(const char* conninfo) PgLargeObject::PgLargeObject(Oid lobjId, const char* conninfo) : PgConnection(conninfo) { - Init(lobjId); - if ( !pgObject ) { - Create(); + if (! ConnectionBad()) { + if ( !pgObject ) + Create(); + Open(); } - Open(); } // destructor -- closes large object @@ -83,6 +85,8 @@ void PgLargeObject::Create() // open large object and check for errors void PgLargeObject::Open() { + // Close any prior object + Close(); // Open the object pgFd = lo_open(pgConn, pgObject, INV_READ|INV_WRITE); @@ -115,7 +119,8 @@ int PgLargeObject::Unlink() void PgLargeObject::Close() { - if (pgFd >= 0) lo_close(pgConn, pgFd); + if (pgFd >= 0) lo_close(pgConn, pgFd); + pgFd = -1; } @@ -159,4 +164,3 @@ string PgLargeObject::Status() { return loStatus; } - |
