pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedPatches for libpq++
5+ messages / 2 participants
[nested] [flat]
* Patches for libpq++
@ 2001-02-21 17:55 J. T. Vermeulen <jtv@cistron-office.nl>
0 siblings, 2 replies; 5+ messages in thread
From: J. T. Vermeulen @ 2001-02-21 17:55 UTC (permalink / raw)
To: pgsql-interfaces
I'd like to suggest the following changes to bring libpq++ a bit more up to
date:
- fixes include path in Makefile
- makes some member functions const
- flags (but does not fix) what looks like a memory leak and a warning
- changes int return type on ConnectionBad() to bool
inline patch 1: postgresql-7.0.3-jtv/src/interfaces/libpq++/examples/Makefile, postgresql-7.0.3-jtv/src/interfaces/libpq++/pgconnection.cc, postgresql-7.0.3-jtv/src/interfaces/libpq++/pgconnection.h and 4 more (+22/-19 lines) download inline-1.patch
diff -u -r postgresql-7.0.3/src/interfaces/libpq++/examples/Makefile postgresql-7.0.3-jtv/src/interfaces/libpq++/examples/Makefile
--- postgresql-7.0.3/src/interfaces/libpq++/examples/Makefile Thu Mar 2 03:00:59 2000
+++ postgresql-7.0.3-jtv/src/interfaces/libpq++/examples/Makefile Wed Feb 21 16:16:14 2001
@@ -4,7 +4,8 @@
LIBNAME= libpq++
-HEADERDIR= /usr/local/pgsql/include
+#HEADERDIR= /usr/local/pgsql/include
+HEADERDIR=/usr/include/postgresql
LIBPQDIR= /usr/local/pgsql/lib
diff -u -r postgresql-7.0.3/src/interfaces/libpq++/pgconnection.cc postgresql-7.0.3-jtv/src/interfaces/libpq++/pgconnection.cc
--- postgresql-7.0.3/src/interfaces/libpq++/pgconnection.cc Sun Apr 23 00:39:15 2000
+++ postgresql-7.0.3-jtv/src/interfaces/libpq++/pgconnection.cc Wed Feb 21 17:16:51 2001
@@ -67,7 +67,7 @@
}
// PgConnection::status -- return connection or result status
-ConnStatusType PgConnection::Status()
+ConnStatusType PgConnection::Status() const
{
return PQstatus(pgConn);
}
@@ -123,19 +123,19 @@
-int PgConnection::ConnectionBad()
+bool PgConnection::ConnectionBad() const
{
return Status() == CONNECTION_BAD;
}
-const char* PgConnection::ErrorMessage()
+const char* PgConnection::ErrorMessage() const
{
return (const char *)PQerrorMessage(pgConn);
}
-const char* PgConnection::DBName()
+const char* PgConnection::DBName() const
{
return (const char *)PQdb(pgConn);
}
diff -u -r postgresql-7.0.3/src/interfaces/libpq++/pgconnection.h postgresql-7.0.3-jtv/src/interfaces/libpq++/pgconnection.h
--- postgresql-7.0.3/src/interfaces/libpq++/pgconnection.h Sun Apr 23 00:39:15 2000
+++ postgresql-7.0.3-jtv/src/interfaces/libpq++/pgconnection.h Wed Feb 21 17:17:13 2001
@@ -66,12 +66,12 @@
virtual ~PgConnection(); // close connection and clean up
// Connection status and error messages
- ConnStatusType Status();
- int ConnectionBad();
- const char* ErrorMessage();
+ ConnStatusType Status() const;
+ bool ConnectionBad() const;
+ const char* ErrorMessage() const;
// returns the database name of the connection
- const char* DBName();
+ const char* DBName() const;
// Query Execution interface
ExecStatusType Exec(const char* query); // send a query to the backend
diff -u -r postgresql-7.0.3/src/interfaces/libpq++/pgdatabase.cc postgresql-7.0.3-jtv/src/interfaces/libpq++/pgdatabase.cc
--- postgresql-7.0.3/src/interfaces/libpq++/pgdatabase.cc Sat Jan 29 17:58:52 2000
+++ postgresql-7.0.3-jtv/src/interfaces/libpq++/pgdatabase.cc Wed Feb 21 17:41:51 2001
@@ -45,6 +45,8 @@
po.align = width;
+ // TODO: Looks like memory leak
+ // TODO: Looks like PQprintOpt::fieldSep should be const char *
if(terseOutput) po.fieldSep = strdup("|");
else po.fieldSep = "";
@@ -150,15 +152,15 @@
}
-int PgDatabase::GetLine(char* string, int length)
+int PgDatabase::GetLine(char str[], int length)
{
-return PQgetline(pgConn, string, length);
+return PQgetline(pgConn, str, length);
}
-void PgDatabase::PutLine(const char* string)
+void PgDatabase::PutLine(const char str[])
{
-PQputline(pgConn, string);
+PQputline(pgConn, str);
}
diff -u -r postgresql-7.0.3/src/interfaces/libpq++/pgdatabase.h postgresql-7.0.3-jtv/src/interfaces/libpq++/pgdatabase.h
--- postgresql-7.0.3/src/interfaces/libpq++/pgdatabase.h Sun Apr 23 00:39:15 2000
+++ postgresql-7.0.3-jtv/src/interfaces/libpq++/pgdatabase.h Wed Feb 21 17:37:36 2001
@@ -63,8 +63,8 @@
int terseOutput = 0, int width = 0) ;
// copy command related access
- int GetLine(char* string, int length);
- void PutLine(const char* string);
+ int GetLine(char str[], int length);
+ void PutLine(const char str[]);
const char* OidStatus();
int EndCopy();
diff -u -r postgresql-7.0.3/src/interfaces/libpq++/pglobject.cc postgresql-7.0.3-jtv/src/interfaces/libpq++/pglobject.cc
--- postgresql-7.0.3/src/interfaces/libpq++/pglobject.cc Sun Apr 23 00:39:15 2000
+++ postgresql-7.0.3-jtv/src/interfaces/libpq++/pglobject.cc Wed Feb 21 17:19:56 2001
@@ -142,7 +142,7 @@
}
-int PgLargeObject::Tell()
+int PgLargeObject::Tell() const
{
return lo_tell(pgConn, pgFd);
}
@@ -160,7 +160,7 @@
}
-string PgLargeObject::Status()
+string PgLargeObject::Status() const
{
return loStatus;
}
diff -u -r postgresql-7.0.3/src/interfaces/libpq++/pglobject.h postgresql-7.0.3-jtv/src/interfaces/libpq++/pglobject.h
--- postgresql-7.0.3/src/interfaces/libpq++/pglobject.h Sun Apr 23 00:39:15 2000
+++ postgresql-7.0.3-jtv/src/interfaces/libpq++/pglobject.h Wed Feb 21 17:19:50 2001
@@ -47,12 +47,12 @@
int Read(char* buf, int len);
int Write(const char* buf, int len);
int LSeek(int offset, int whence);
- int Tell();
+ int Tell() const;
int Unlink();
Oid LOid();
Oid Import(const char* filename);
int Export(const char* filename);
- string Status();
+ string Status() const;
private:
// We don't support copying of PgLargeObject objects,
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Patches for libpq++
@ 2001-02-21 18:33 Bruce Momjian <pgman@candle.pha.pa.us>
parent: J. T. Vermeulen <jtv@cistron-office.nl>
1 sibling, 0 replies; 5+ messages in thread
From: Bruce Momjian @ 2001-02-21 18:33 UTC (permalink / raw)
To: J. T. Vermeulen <jtv@cistron-office.nl>; +Cc: pgsql-interfaces
Thanks. I will include this in 7.2. 7.1 is frozen for changes, I
think.
> I'd like to suggest the following changes to bring libpq++ a bit more up to
> date:
>
> - fixes include path in Makefile
> - makes some member functions const
> - flags (but does not fix) what looks like a memory leak and a warning
> - changes int return type on ConnectionBad() to bool
>
>
> diff -u -r postgresql-7.0.3/src/interfaces/libpq++/examples/Makefile postgresql-7.0.3-jtv/src/interfaces/libpq++/examples/Makefile
> --- postgresql-7.0.3/src/interfaces/libpq++/examples/Makefile Thu Mar 2 03:00:59 2000
> +++ postgresql-7.0.3-jtv/src/interfaces/libpq++/examples/Makefile Wed Feb 21 16:16:14 2001
> @@ -4,7 +4,8 @@
>
>
> LIBNAME= libpq++
> -HEADERDIR= /usr/local/pgsql/include
> +#HEADERDIR= /usr/local/pgsql/include
> +HEADERDIR=/usr/include/postgresql
> LIBPQDIR= /usr/local/pgsql/lib
>
>
> diff -u -r postgresql-7.0.3/src/interfaces/libpq++/pgconnection.cc postgresql-7.0.3-jtv/src/interfaces/libpq++/pgconnection.cc
> --- postgresql-7.0.3/src/interfaces/libpq++/pgconnection.cc Sun Apr 23 00:39:15 2000
> +++ postgresql-7.0.3-jtv/src/interfaces/libpq++/pgconnection.cc Wed Feb 21 17:16:51 2001
> @@ -67,7 +67,7 @@
> }
>
> // PgConnection::status -- return connection or result status
> -ConnStatusType PgConnection::Status()
> +ConnStatusType PgConnection::Status() const
> {
> return PQstatus(pgConn);
> }
> @@ -123,19 +123,19 @@
>
>
>
> -int PgConnection::ConnectionBad()
> +bool PgConnection::ConnectionBad() const
> {
> return Status() == CONNECTION_BAD;
> }
>
>
> -const char* PgConnection::ErrorMessage()
> +const char* PgConnection::ErrorMessage() const
> {
> return (const char *)PQerrorMessage(pgConn);
> }
>
>
> -const char* PgConnection::DBName()
> +const char* PgConnection::DBName() const
> {
> return (const char *)PQdb(pgConn);
> }
> diff -u -r postgresql-7.0.3/src/interfaces/libpq++/pgconnection.h postgresql-7.0.3-jtv/src/interfaces/libpq++/pgconnection.h
> --- postgresql-7.0.3/src/interfaces/libpq++/pgconnection.h Sun Apr 23 00:39:15 2000
> +++ postgresql-7.0.3-jtv/src/interfaces/libpq++/pgconnection.h Wed Feb 21 17:17:13 2001
> @@ -66,12 +66,12 @@
> virtual ~PgConnection(); // close connection and clean up
>
> // Connection status and error messages
> - ConnStatusType Status();
> - int ConnectionBad();
> - const char* ErrorMessage();
> + ConnStatusType Status() const;
> + bool ConnectionBad() const;
> + const char* ErrorMessage() const;
>
> // returns the database name of the connection
> - const char* DBName();
> + const char* DBName() const;
>
> // Query Execution interface
> ExecStatusType Exec(const char* query); // send a query to the backend
> diff -u -r postgresql-7.0.3/src/interfaces/libpq++/pgdatabase.cc postgresql-7.0.3-jtv/src/interfaces/libpq++/pgdatabase.cc
> --- postgresql-7.0.3/src/interfaces/libpq++/pgdatabase.cc Sat Jan 29 17:58:52 2000
> +++ postgresql-7.0.3-jtv/src/interfaces/libpq++/pgdatabase.cc Wed Feb 21 17:41:51 2001
> @@ -45,6 +45,8 @@
>
> po.align = width;
>
> + // TODO: Looks like memory leak
> + // TODO: Looks like PQprintOpt::fieldSep should be const char *
> if(terseOutput) po.fieldSep = strdup("|");
> else po.fieldSep = "";
>
> @@ -150,15 +152,15 @@
> }
>
>
> -int PgDatabase::GetLine(char* string, int length)
> +int PgDatabase::GetLine(char str[], int length)
> {
> -return PQgetline(pgConn, string, length);
> +return PQgetline(pgConn, str, length);
> }
>
>
> -void PgDatabase::PutLine(const char* string)
> +void PgDatabase::PutLine(const char str[])
> {
> -PQputline(pgConn, string);
> +PQputline(pgConn, str);
> }
>
>
> diff -u -r postgresql-7.0.3/src/interfaces/libpq++/pgdatabase.h postgresql-7.0.3-jtv/src/interfaces/libpq++/pgdatabase.h
> --- postgresql-7.0.3/src/interfaces/libpq++/pgdatabase.h Sun Apr 23 00:39:15 2000
> +++ postgresql-7.0.3-jtv/src/interfaces/libpq++/pgdatabase.h Wed Feb 21 17:37:36 2001
> @@ -63,8 +63,8 @@
> int terseOutput = 0, int width = 0) ;
>
> // copy command related access
> - int GetLine(char* string, int length);
> - void PutLine(const char* string);
> + int GetLine(char str[], int length);
> + void PutLine(const char str[]);
> const char* OidStatus();
> int EndCopy();
>
> diff -u -r postgresql-7.0.3/src/interfaces/libpq++/pglobject.cc postgresql-7.0.3-jtv/src/interfaces/libpq++/pglobject.cc
> --- postgresql-7.0.3/src/interfaces/libpq++/pglobject.cc Sun Apr 23 00:39:15 2000
> +++ postgresql-7.0.3-jtv/src/interfaces/libpq++/pglobject.cc Wed Feb 21 17:19:56 2001
> @@ -142,7 +142,7 @@
> }
>
>
> -int PgLargeObject::Tell()
> +int PgLargeObject::Tell() const
> {
> return lo_tell(pgConn, pgFd);
> }
> @@ -160,7 +160,7 @@
> }
>
>
> -string PgLargeObject::Status()
> +string PgLargeObject::Status() const
> {
> return loStatus;
> }
> diff -u -r postgresql-7.0.3/src/interfaces/libpq++/pglobject.h postgresql-7.0.3-jtv/src/interfaces/libpq++/pglobject.h
> --- postgresql-7.0.3/src/interfaces/libpq++/pglobject.h Sun Apr 23 00:39:15 2000
> +++ postgresql-7.0.3-jtv/src/interfaces/libpq++/pglobject.h Wed Feb 21 17:19:50 2001
> @@ -47,12 +47,12 @@
> int Read(char* buf, int len);
> int Write(const char* buf, int len);
> int LSeek(int offset, int whence);
> - int Tell();
> + int Tell() const;
> int Unlink();
> Oid LOid();
> Oid Import(const char* filename);
> int Export(const char* filename);
> - string Status();
> + string Status() const;
>
> private:
> // We don't support copying of PgLargeObject objects,
>
--
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] 5+ messages in thread
* Re: Patches for libpq++
@ 2001-02-21 18:53 Bruce Momjian <pgman@candle.pha.pa.us>
parent: J. T. Vermeulen <jtv@cistron-office.nl>
1 sibling, 1 reply; 5+ messages in thread
From: Bruce Momjian @ 2001-02-21 18:53 UTC (permalink / raw)
To: J. T. Vermeulen <jtv@cistron-office.nl>; +Cc: pgsql-interfaces
> I'd like to suggest the following changes to bring libpq++ a bit more up to
> date:
>
> - fixes include path in Makefile
> - makes some member functions const
> - flags (but does not fix) what looks like a memory leak and a warning
> - changes int return type on ConnectionBad() to bool
>
>
> diff -u -r postgresql-7.0.3/src/interfaces/libpq++/examples/Makefile postgresql-7.0.3-jtv/src/interfaces/libpq++/examples/Makefile
> --- postgresql-7.0.3/src/interfaces/libpq++/examples/Makefile Thu Mar 2 03:00:59 2000
> +++ postgresql-7.0.3-jtv/src/interfaces/libpq++/examples/Makefile Wed Feb 21 16:16:14 2001
> @@ -4,7 +4,8 @@
>
>
> LIBNAME= libpq++
> -HEADERDIR= /usr/local/pgsql/include
> +#HEADERDIR= /usr/local/pgsql/include
> +HEADERDIR=/usr/include/postgresql
> LIBPQDIR= /usr/local/pgsql/lib
This change will not be made. The source install is
/usr/local/pgsql/include. RPM's may install in /usr/include/postgresql,
but we don't make such changes on our end of that.
--
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] 5+ messages in thread
* Re: Patches for libpq++
@ 2001-02-21 19:27 J. T. Vermeulen <jtv@cistron-office.nl>
parent: Bruce Momjian <pgman@candle.pha.pa.us>
0 siblings, 1 reply; 5+ messages in thread
From: J. T. Vermeulen @ 2001-02-21 19:27 UTC (permalink / raw)
To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: J. T. Vermeulen <jtv@cistron-office.nl>; pgsql-interfaces
On Wed, 21 Feb 2001, Bruce Momjian wrote:
> This change will not be made. The source install is
> /usr/local/pgsql/include. RPM's may install in /usr/include/postgresql,
> but we don't make such changes on our end of that.
I stand corrected. In my case it was a Debian package, but otherwise much the
same conflict of filesystem standards.
Jeroen
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Patches for libpq++
@ 2001-02-21 19:34 Bruce Momjian <pgman@candle.pha.pa.us>
parent: J. T. Vermeulen <jtv@cistron-office.nl>
0 siblings, 0 replies; 5+ messages in thread
From: Bruce Momjian @ 2001-02-21 19:34 UTC (permalink / raw)
To: J. T. Vermeulen <jtv@cistron-office.nl>; +Cc: pgsql-interfaces
> On Wed, 21 Feb 2001, Bruce Momjian wrote:
>
> > This change will not be made. The source install is
> > /usr/local/pgsql/include. RPM's may install in /usr/include/postgresql,
> > but we don't make such changes on our end of that.
>
> I stand corrected. In my case it was a Debian package, but otherwise much the
> same conflict of filesystem standards.
It would be nice to say I could get it into 7.1, but we are already in
beta. Sorry. If you have other changes, feel free to send them to the
lists and I will keep them for 7.2.
--
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] 5+ messages in thread
end of thread, other threads:[~2001-02-21 19:34 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-02-21 17:55 Patches for libpq++ J. T. Vermeulen <jtv@cistron-office.nl>
2001-02-21 18:33 ` Bruce Momjian <pgman@candle.pha.pa.us>
2001-02-21 18:53 ` Bruce Momjian <pgman@candle.pha.pa.us>
2001-02-21 19:27 ` J. T. Vermeulen <jtv@cistron-office.nl>
2001-02-21 19:34 ` 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