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

Commitf79fbb2

Browse files
committed
Add PQserverVersion() to libpq to provide more-convenient access to
the server version number. This commit also removes bogus DOS lineendings from libpqddll.def.Greg Sabino Mullane
1 parentb2d9fbe commitf79fbb2

File tree

6 files changed

+154
-118
lines changed

6 files changed

+154
-118
lines changed

‎doc/src/sgml/libpq.sgml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.157 2004/06/08 13:49:22 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.158 2004/08/11 18:06:00 tgl Exp $
33
-->
44

55
<chapter id="libpq">
@@ -892,6 +892,24 @@ The 3.0 protocol will normally be used when communicating with
892892
only protocol 2.0. (Protocol 1.0 is obsolete and not supported by <application>libpq</application>.)
893893
</para>
894894
</listitem>
895+
</varlistentry>
896+
897+
<varlistentry>
898+
<term><function>PQserverVersion</function><indexterm><primary>PQserverVersion</></></term>
899+
<listitem>
900+
<para>
901+
Returns an integer representing the backend version.
902+
<synopsis>
903+
int PQserverVersion(const PGconn *conn);
904+
</synopsis>
905+
Applications may use this to determine the version of the database server they
906+
are connected to. The number is formed by converting the major, minor, and
907+
revision numbers into two digit numbers and appending them together. For
908+
example, version 7.4.2 will be returned as 70402, and version 8.1 will be
909+
returned as 80100 (leading zeroes are not shown). Zero is returned if the
910+
connection is bad.
911+
</para>
912+
</listitem>
895913
</varlistentry>
896914

897915
<varlistentry>

‎src/interfaces/libpq/blibpqdll.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ EXPORTS
113113
_PQfformat @ 109
114114
_PQexecPrepared @ 110
115115
_PQsendQueryPrepared @ 111
116+
_PQdsplen @ 112
117+
_PQserverVersion @ 113
116118

117119
; Aliases for MS compatible names
118120
PQconnectdb = _PQconnectdb
@@ -226,3 +228,5 @@ EXPORTS
226228
PQfformat = _PQfformat
227229
PQexecPrepared = _PQexecPrepared
228230
PQsendQueryPrepared = _PQsendQueryPrepared
231+
PQdsplen = _PQdsplen
232+
PQserverVersion = _PQserverVersion

‎src/interfaces/libpq/fe-connect.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.278 2004/07/12 14:23:28 momjian Exp $
11+
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.279 2004/08/11 18:06:01 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -2872,6 +2872,16 @@ PQprotocolVersion(const PGconn *conn)
28722872
returnPG_PROTOCOL_MAJOR(conn->pversion);
28732873
}
28742874

2875+
int
2876+
PQserverVersion(constPGconn*conn)
2877+
{
2878+
if (!conn)
2879+
return0;
2880+
if (conn->status==CONNECTION_BAD)
2881+
return0;
2882+
returnconn->sversion;
2883+
}
2884+
28752885
char*
28762886
PQerrorMessage(constPGconn*conn)
28772887
{

‎src/interfaces/libpq/libpq-fe.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.104 2004/03/24 03:44:59 momjian Exp $
10+
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.105 2004/08/11 18:06:01 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -248,6 +248,7 @@ extern PGTransactionStatusType PQtransactionStatus(const PGconn *conn);
248248
externconstchar*PQparameterStatus(constPGconn*conn,
249249
constchar*paramName);
250250
externintPQprotocolVersion(constPGconn*conn);
251+
externintPQserverVersion(constPGconn*conn);
251252
externchar*PQerrorMessage(constPGconn*conn);
252253
externintPQsocket(constPGconn*conn);
253254
externintPQbackendPID(constPGconn*conn);

‎src/interfaces/libpq/libpqddll.def

Lines changed: 117 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,117 @@
1-
; DEF file for MS VC++
2-
LIBRARY LIBPQD
3-
DESCRIPTION "PostgreSQL Client Library"
4-
EXPORTS
5-
PQconnectdb @ 1
6-
PQsetdbLogin @ 2
7-
PQconndefaults @ 3
8-
PQfinish @ 4
9-
PQreset @ 5
10-
PQrequestCancel @ 6
11-
PQdb @ 7
12-
PQuser @ 8
13-
PQpass @ 9
14-
PQhost @ 10
15-
PQport @ 11
16-
PQtty @ 12
17-
PQoptions @ 13
18-
PQstatus @ 14
19-
PQerrorMessage @ 15
20-
PQsocket @ 16
21-
PQbackendPID @ 17
22-
PQtrace @ 18
23-
PQuntrace @ 19
24-
PQsetNoticeProcessor @ 20
25-
PQexec @ 21
26-
PQnotifies @ 22
27-
PQsendQuery @ 23
28-
PQgetResult @ 24
29-
PQisBusy @ 25
30-
PQconsumeInput @ 26
31-
PQgetline @ 27
32-
PQputline @ 28
33-
PQgetlineAsync @ 29
34-
PQputnbytes @ 30
35-
PQendcopy @ 31
36-
PQfn @ 32
37-
PQresultStatus @ 33
38-
PQntuples @ 34
39-
PQnfields @ 35
40-
PQbinaryTuples @ 36
41-
PQfname @ 37
42-
PQfnumber @ 38
43-
PQftype @ 39
44-
PQfsize @ 40
45-
PQfmod @ 41
46-
PQcmdStatus @ 42
47-
PQoidStatus @ 43
48-
PQcmdTuples @ 44
49-
PQgetvalue @ 45
50-
PQgetlength @ 46
51-
PQgetisnull @ 47
52-
PQclear @ 48
53-
PQmakeEmptyPGresult @ 49
54-
PQprint @ 50
55-
PQdisplayTuples @ 51
56-
PQprintTuples @ 52
57-
lo_open @ 53
58-
lo_close @ 54
59-
lo_read @ 55
60-
lo_write @ 56
61-
lo_lseek @ 57
62-
lo_creat @ 58
63-
lo_tell @ 59
64-
lo_unlink @ 60
65-
lo_import @ 61
66-
lo_export @ 62
67-
pgresStatus @ 63
68-
PQmblen @ 64
69-
PQresultErrorMessage @ 65
70-
PQresStatus @ 66
71-
termPQExpBuffer @ 67
72-
appendPQExpBufferChar @ 68
73-
initPQExpBuffer @ 69
74-
resetPQExpBuffer @ 70
75-
PQoidValue @ 71
76-
PQclientEncoding @ 72
77-
PQenv2encoding @ 73
78-
appendBinaryPQExpBuffer @ 74
79-
appendPQExpBufferStr @ 75
80-
destroyPQExpBuffer @ 76
81-
createPQExpBuffer @ 77
82-
PQconninfoFree @ 78
83-
PQconnectPoll @ 79
84-
PQconnectStart @ 80
85-
PQflush @ 81
86-
PQisnonblocking @ 82
87-
PQresetPoll @ 83
88-
PQresetStart @ 84
89-
PQsetClientEncoding @ 85
90-
PQsetnonblocking @ 86
91-
PQfreeNotify @ 87
92-
PQescapeString @ 88
93-
PQescapeBytea @ 89
94-
printfPQExpBuffer @ 90
95-
appendPQExpBuffer @ 91
96-
pg_encoding_to_char @ 92
97-
pg_utf_mblen @ 93
98-
PQunescapeBytea @ 94
99-
PQfreemem @ 95
100-
PQtransactionStatus @ 96
101-
PQparameterStatus @ 97
102-
PQprotocolVersion @ 98
103-
PQsetErrorVerbosity @ 99
104-
PQsetNoticeReceiver @ 100
105-
PQexecParams @ 101
106-
PQsendQueryParams @ 102
107-
PQputCopyData @ 103
108-
PQputCopyEnd @ 104
109-
PQgetCopyData @ 105
110-
PQresultErrorField @ 106
111-
PQftable @ 107
112-
PQftablecol @ 108
113-
PQfformat @ 109
114-
PQexecPrepared @ 110
115-
PQsendQueryPrepared @ 111
1+
; DEF file for MS VC++
2+
LIBRARY LIBPQD
3+
DESCRIPTION "PostgreSQL Client Library"
4+
EXPORTS
5+
PQconnectdb @ 1
6+
PQsetdbLogin @ 2
7+
PQconndefaults @ 3
8+
PQfinish @ 4
9+
PQreset @ 5
10+
PQrequestCancel @ 6
11+
PQdb @ 7
12+
PQuser @ 8
13+
PQpass @ 9
14+
PQhost @ 10
15+
PQport @ 11
16+
PQtty @ 12
17+
PQoptions @ 13
18+
PQstatus @ 14
19+
PQerrorMessage @ 15
20+
PQsocket @ 16
21+
PQbackendPID @ 17
22+
PQtrace @ 18
23+
PQuntrace @ 19
24+
PQsetNoticeProcessor @ 20
25+
PQexec @ 21
26+
PQnotifies @ 22
27+
PQsendQuery @ 23
28+
PQgetResult @ 24
29+
PQisBusy @ 25
30+
PQconsumeInput @ 26
31+
PQgetline @ 27
32+
PQputline @ 28
33+
PQgetlineAsync @ 29
34+
PQputnbytes @ 30
35+
PQendcopy @ 31
36+
PQfn @ 32
37+
PQresultStatus @ 33
38+
PQntuples @ 34
39+
PQnfields @ 35
40+
PQbinaryTuples @ 36
41+
PQfname @ 37
42+
PQfnumber @ 38
43+
PQftype @ 39
44+
PQfsize @ 40
45+
PQfmod @ 41
46+
PQcmdStatus @ 42
47+
PQoidStatus @ 43
48+
PQcmdTuples @ 44
49+
PQgetvalue @ 45
50+
PQgetlength @ 46
51+
PQgetisnull @ 47
52+
PQclear @ 48
53+
PQmakeEmptyPGresult @ 49
54+
PQprint @ 50
55+
PQdisplayTuples @ 51
56+
PQprintTuples @ 52
57+
lo_open @ 53
58+
lo_close @ 54
59+
lo_read @ 55
60+
lo_write @ 56
61+
lo_lseek @ 57
62+
lo_creat @ 58
63+
lo_tell @ 59
64+
lo_unlink @ 60
65+
lo_import @ 61
66+
lo_export @ 62
67+
pgresStatus @ 63
68+
PQmblen @ 64
69+
PQresultErrorMessage @ 65
70+
PQresStatus @ 66
71+
termPQExpBuffer @ 67
72+
appendPQExpBufferChar @ 68
73+
initPQExpBuffer @ 69
74+
resetPQExpBuffer @ 70
75+
PQoidValue @ 71
76+
PQclientEncoding @ 72
77+
PQenv2encoding @ 73
78+
appendBinaryPQExpBuffer @ 74
79+
appendPQExpBufferStr @ 75
80+
destroyPQExpBuffer @ 76
81+
createPQExpBuffer @ 77
82+
PQconninfoFree @ 78
83+
PQconnectPoll @ 79
84+
PQconnectStart @ 80
85+
PQflush @ 81
86+
PQisnonblocking @ 82
87+
PQresetPoll @ 83
88+
PQresetStart @ 84
89+
PQsetClientEncoding @ 85
90+
PQsetnonblocking @ 86
91+
PQfreeNotify @ 87
92+
PQescapeString @ 88
93+
PQescapeBytea @ 89
94+
printfPQExpBuffer @ 90
95+
appendPQExpBuffer @ 91
96+
pg_encoding_to_char @ 92
97+
pg_utf_mblen @ 93
98+
PQunescapeBytea @ 94
99+
PQfreemem @ 95
100+
PQtransactionStatus @ 96
101+
PQparameterStatus @ 97
102+
PQprotocolVersion @ 98
103+
PQsetErrorVerbosity @ 99
104+
PQsetNoticeReceiver @ 100
105+
PQexecParams @ 101
106+
PQsendQueryParams @ 102
107+
PQputCopyData @ 103
108+
PQputCopyEnd @ 104
109+
PQgetCopyData @ 105
110+
PQresultErrorField @ 106
111+
PQftable @ 107
112+
PQftablecol @ 108
113+
PQfformat @ 109
114+
PQexecPrepared @ 110
115+
PQsendQueryPrepared @ 111
116+
PQdsplen @ 112
117+
PQserverVersion @ 113

‎src/interfaces/libpq/libpqdll.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,4 @@ EXPORTS
114114
PQexecPrepared @ 110
115115
PQsendQueryPrepared @ 111
116116
PQdsplen @ 112
117+
PQserverVersion @ 113

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp