Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2e58024

Browse files
committed
This patch fixes a few minor problems with libpq++: remove the deprecated
PQExec(" ") in the wrapper around PQnotifies(), fix the Makefile forthe examples so that they will actually compile properly (with theexception of#5, which depends on internal headers), make a minor changeto libpq++.h so that "make examples" now works on my machine, updatesome documentation, fix some grammatical problems, and remove some ofthe more hideous comments.Neil Conway
1 parent133df7c commit2e58024

File tree

8 files changed

+51
-53
lines changed

8 files changed

+51
-53
lines changed

‎src/interfaces/libpq++/README

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Based on the original work by William Wanders (wwanders@sci.kun.nl)
32
and Jolly Chen (jolly@cs.berkeley.edu), this is the first set of
43
changes to libpq++ since ~1997. Pgenv has been removed, deprecated
@@ -10,8 +9,9 @@ the function of libpq++.
109
The API provided herein is subject to change in later versions of
1110
PostgreSQL.
1211

13-
For details on how to to use libpq++, see the man page in the man/
14-
subdirectory and the test programs in the examples/ subdirectory.
12+
For details on how to to use libpq++, see Section 3 in Part 1 of
13+
the PostgreSQL Developer's Guide and the test programs in the
14+
examples/ subdirectory.
1515

1616
** PgConnection has been changed to accept either the environment
1717
variables or conninfo style strings. See the PQconnectdb in the

‎src/interfaces/libpq++/examples/Makefile

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1+
#-------------------------------------------------------------------------
12
#
2-
# Makefile forexample programs
3+
# Makefile forlibpq++ examples
34
#
5+
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
6+
# Portions Copyright (c) 1994, Regents of the University of California
7+
#
8+
# $Header: /cvsroot/pgsql/src/interfaces/libpq++/examples/Attic/Makefile,v 1.13 2002/06/15 18:49:29 momjian Exp $
9+
#
10+
#-------------------------------------------------------------------------
411

12+
subdir = src/interfaces/libpq++/examples
13+
top_builddir = ../../../..
14+
include$(top_builddir)/src/Makefile.global
515

616
LIBNAME= libpq++
7-
HEADERDIR= /usr/local/pgsql/include
8-
LIBPQDIR= /usr/local/pgsql/lib
9-
10-
11-
# We have to override -Werror, which makes warnings, fatal, because we
12-
# inevitably get the warning, "abstract declarator used as declaration"
13-
# because of our inclusion of c.h and we don't know how to stop that.
17+
HEADERDIR=$(includedir)
18+
LIBPQDIR=$(libdir)
1419

15-
#CXXFLAGS= $(CFLAGS) -Wno-error -Wno-unused -Wl,-Bdynamic
1620
CXXFLAGS=$(CFLAGS)
1721

1822
CXXFLAGS+= -I$(HEADERDIR)

‎src/interfaces/libpq++/libpq++.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,17 @@
1616
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
1717
* Portions Copyright (c) 1994, Regents of the University of California
1818
*
19-
* $Id: libpq++.h,v 1.10 2001/01/24 19:43:32 momjian Exp $
19+
* $Id: libpq++.h,v 1.11 2002/06/15 18:49:29 momjian Exp $
2020
*
2121
*-------------------------------------------------------------------------
2222
*/
2323

24+
2425
#ifndefLIBPQXX_H
2526
#defineLIBPQXX_H
2627

28+
#include<string.h>
29+
2730
#include"libpq++/pgconnection.h"
2831
#include"libpq++/pgdatabase.h"
2932
#include"libpq++/pglobject.h"

‎src/interfaces/libpq++/pgconnection.cc

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Copyright (c) 1994, Regents of the University of California
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgconnection.cc,v 1.13 2002/03/11 15:08:18 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgconnection.cc,v 1.14 2002/06/15 18:49:29 momjian Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -21,7 +21,6 @@
2121
usingnamespacestd;
2222
#endif
2323

24-
2524
// ****************************************************************
2625
//
2726
// PgConnection Implementation
@@ -38,9 +37,8 @@ PgConnection::PgConnection()
3837
PgConnection::PgConnection(constchar* conninfo)
3938
: pgConn(NULL), pgResult(NULL), pgCloseConnection(true)
4039
{
41-
4240
// Connect to the database
43-
Connect(conninfo);
41+
Connect(conninfo);
4442
}
4543

4644

@@ -59,12 +57,14 @@ PgConnection::~PgConnection()
5957
voidPgConnection::CloseConnection()
6058
{
6159
// if the connection is open, close it first
62-
if ( pgCloseConnection ) {
63-
if(pgResult)PQclear(pgResult);
64-
pgResult=NULL;
65-
if(pgConn)PQfinish(pgConn);
66-
pgConn=NULL;
67-
pgCloseConnection=false;
60+
if (pgCloseConnection) {
61+
if (pgResult)
62+
PQclear(pgResult);
63+
pgResult =NULL;
64+
if (pgConn)
65+
PQfinish(pgConn);
66+
pgConn =NULL;
67+
pgCloseConnection =false;
6868
}
6969
}
7070

@@ -95,7 +95,7 @@ ConnStatusType PgConnection::Status() const
9595
// PgConnection::exec -- send a query to the backend
9696
ExecStatusTypePgConnection::Exec(constchar* query)
9797
{
98-
// Clear theResult Stucture if needed
98+
// Clear theresult stucture if needed
9999
if (pgResult)
100100
PQclear(pgResult);
101101

@@ -113,25 +113,21 @@ ExecStatusType PgConnection::Exec(const char* query)
113113
intPgConnection::ExecCommandOk(constchar* query)
114114
{
115115
returnExec(query) == PGRES_COMMAND_OK;
116-
}// End ExecCommandOk()
116+
}
117117

118118
intPgConnection::ExecTuplesOk(constchar* query)
119119
{
120120
returnExec(query) == PGRES_TUPLES_OK;
121-
}// End ExecTuplesOk()
122-
123-
121+
}
124122

125123
// Don't know why these next two need to be part of Connection
126124

127125
// PgConnection::notifies() -- returns a notification from a list of unhandled notifications
128126
PGnotify*PgConnection::Notifies()
129127
{
130-
Exec("");
131128
returnPQnotifies(pgConn);
132129
}
133130

134-
135131
// From Integer To String Conversion Function
136132
stringPgConnection::IntToString(int n)
137133
{
@@ -140,27 +136,23 @@ string PgConnection::IntToString(int n)
140136
return buffer;
141137
}
142138

143-
144-
145139
boolPgConnection::ConnectionBad()const
146140
{
147-
returnStatus() == CONNECTION_BAD;
141+
returnStatus() == CONNECTION_BAD;
148142
}
149143

150-
151144
constchar*PgConnection::ErrorMessage()const
152145
{
153-
return (constchar *)PQerrorMessage(pgConn);
146+
return (constchar *)PQerrorMessage(pgConn);
154147
}
155148

156-
157149
constchar*PgConnection::DBName()const
158150
{
159-
return (constchar *)PQdb(pgConn);
151+
return (constchar *)PQdb(pgConn);
160152
}
161153

162154
PQnoticeProcessorPgConnection::SetNoticeProcessor(PQnoticeProcessor proc,void *arg)
163155
{
164-
returnPQsetNoticeProcessor(pgConn, proc, arg);
156+
returnPQsetNoticeProcessor(pgConn, proc, arg);
165157
}
166158

‎src/interfaces/libpq++/pgconnection.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
1414
* Portions Copyright (c) 1994, Regents of the University of California
1515
*
16-
* $Id: pgconnection.h,v 1.16 2002/03/11 15:08:18 momjian Exp $
16+
* $Id: pgconnection.h,v 1.17 2002/06/15 18:49:29 momjian Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -26,7 +26,7 @@ extern "C" {
2626
}
2727

2828
/* We assume that the C++ compiler will have these keywords, even though
29-
* pg_config.h may have #define'd them to empty because C compiler doesn't.
29+
* pg_config.h may have #define'd them to empty becausetheC compiler doesn't.
3030
*/
3131
#undef const
3232
#undef inline

‎src/interfaces/libpq++/pgcursordb.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Copyright (c) 1994, Regents of the University of California
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgcursordb.cc,v 1.6 2001/09/30 22:30:37 tgl Exp $
13+
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgcursordb.cc,v 1.7 2002/06/15 18:49:29 momjian Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -60,31 +60,31 @@ int PgCursor::Declare(string query, bool binary)
6060
cmd +=" BINARY";
6161
cmd +=" CURSOR FOR" + query;
6262
returnExecCommandOk( cmd.c_str() );
63-
}// End Declare()
63+
}
6464

6565
// Fetch ALL tuples in given direction
6666
intPgCursor::Fetch(constchar* dir)
6767
{
6868
returnFetch("ALL", dir);
69-
}// End Fetch()
69+
}
7070

7171
// Fetch specified amount of tuples in given direction
7272
intPgCursor::Fetch(unsigned num,constchar* dir)
7373
{
7474
returnFetch(IntToString(num), dir );
75-
}// End Fetch()
75+
}
7676

7777
// Create and execute the actual fetch command with the given arguments
7878
intPgCursor::Fetch(string num, string dir)
7979
{
8080
string cmd ="FETCH" + dir +"" + num +" IN" + pgCursor;
8181
returnExecTuplesOk( cmd.c_str() );
82-
}// End Fetch()
82+
}
8383

8484
// Close the cursor: no more queries using the cursor should be allowed
8585
// Actually, the backend should take care of it.
8686
intPgCursor::Close()
8787
{
8888
string cmd ="CLOSE" + pgCursor;
8989
returnExecCommandOk( cmd.c_str() );
90-
}// End CloseCursor()
90+
}

‎src/interfaces/libpq++/pgcursordb.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Portions Copyright (c) 1994, Regents of the University of California
1515
*
1616
*
17-
* $Id: pgcursordb.h,v 1.9 2001/09/30 22:30:37 tgl Exp $
17+
* $Id: pgcursordb.h,v 1.10 2002/06/15 18:49:29 momjian Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -32,7 +32,6 @@
3232
#definePGSTD
3333
#endif
3434

35-
3635
// ****************************************************************
3736
//
3837
// PgCursor - a class for querying databases using a cursor
@@ -50,7 +49,7 @@ class DLLIMPORT PgCursor : public PgTransaction {
5049
~PgCursor();// close connection and clean up
5150

5251
// Commands associated with cursor interface
53-
intDeclare(PGSTD string query,bool binary=false);// Declare a cursor with given name
52+
intDeclare(PGSTD string query,bool binary =false);// Declare a cursor with given name
5453
intFetch(constchar* dir ="FORWARD");// Fetch ALL tuples in given direction
5554
intFetch(unsigned num,constchar* dir ="FORWARD");// Fetch specified amount of tuples
5655
intClose();// Close the cursor

‎src/interfaces/libpq++/pglobject.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Copyright (c) 1994, Regents of the University of California
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pglobject.cc,v 1.8 2001/09/30 22:30:37 tgl Exp $
13+
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pglobject.cc,v 1.9 2002/06/15 18:49:29 momjian Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -104,7 +104,7 @@ void PgLargeObject::Open()
104104
}
105105

106106
// PgLargeObject::unlink
107-
//destruct large object and delete from it from the database
107+
//destroy large object and delete from it from the database
108108
intPgLargeObject::Unlink()
109109
{
110110
// Unlink the object
@@ -155,13 +155,13 @@ int PgLargeObject::Tell() const
155155

156156
OidPgLargeObject::Import(constchar* filename)
157157
{
158-
return pgObject =lo_import(pgConn,(char*)filename);
158+
return pgObject =lo_import(pgConn, filename);
159159
}
160160

161161

162162
intPgLargeObject::Export(constchar* filename)
163163
{
164-
returnlo_export(pgConn, pgObject,(char*)filename);
164+
returnlo_export(pgConn, pgObject, filename);
165165
}
166166

167167

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp