Add PQserverVersion() to libpq to provide more-convenient access to
the server version number. This commit also removes bogus DOS line endings from libpqddll.def. Greg Sabino Mullane
This commit is contained in:
parent
b2d9fbeef2
commit
f79fbb2bec
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.157 2004/06/08 13:49:22 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.158 2004/08/11 18:06:00 tgl Exp $
|
||||
-->
|
||||
|
||||
<chapter id="libpq">
|
||||
@ -892,6 +892,24 @@ The 3.0 protocol will normally be used when communicating with
|
||||
only protocol 2.0. (Protocol 1.0 is obsolete and not supported by <application>libpq</application>.)
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><function>PQserverVersion</function><indexterm><primary>PQserverVersion</></></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Returns an integer representing the backend version.
|
||||
<synopsis>
|
||||
int PQserverVersion(const PGconn *conn);
|
||||
</synopsis>
|
||||
Applications may use this to determine the version of the database server they
|
||||
are connected to. The number is formed by converting the major, minor, and
|
||||
revision numbers into two digit numbers and appending them together. For
|
||||
example, version 7.4.2 will be returned as 70402, and version 8.1 will be
|
||||
returned as 80100 (leading zeroes are not shown). Zero is returned if the
|
||||
connection is bad.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
|
@ -113,6 +113,8 @@ EXPORTS
|
||||
_PQfformat @ 109
|
||||
_PQexecPrepared @ 110
|
||||
_PQsendQueryPrepared @ 111
|
||||
_PQdsplen @ 112
|
||||
_PQserverVersion @ 113
|
||||
|
||||
; Aliases for MS compatible names
|
||||
PQconnectdb = _PQconnectdb
|
||||
@ -226,3 +228,5 @@ EXPORTS
|
||||
PQfformat = _PQfformat
|
||||
PQexecPrepared = _PQexecPrepared
|
||||
PQsendQueryPrepared = _PQsendQueryPrepared
|
||||
PQdsplen = _PQdsplen
|
||||
PQserverVersion = _PQserverVersion
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.278 2004/07/12 14:23:28 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.279 2004/08/11 18:06:01 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -2872,6 +2872,16 @@ PQprotocolVersion(const PGconn *conn)
|
||||
return PG_PROTOCOL_MAJOR(conn->pversion);
|
||||
}
|
||||
|
||||
int
|
||||
PQserverVersion(const PGconn *conn)
|
||||
{
|
||||
if (!conn)
|
||||
return 0;
|
||||
if (conn->status == CONNECTION_BAD)
|
||||
return 0;
|
||||
return conn->sversion;
|
||||
}
|
||||
|
||||
char *
|
||||
PQerrorMessage(const PGconn *conn)
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.104 2004/03/24 03:44:59 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.105 2004/08/11 18:06:01 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -248,6 +248,7 @@ extern PGTransactionStatusType PQtransactionStatus(const PGconn *conn);
|
||||
extern const char *PQparameterStatus(const PGconn *conn,
|
||||
const char *paramName);
|
||||
extern int PQprotocolVersion(const PGconn *conn);
|
||||
extern int PQserverVersion(const PGconn *conn);
|
||||
extern char *PQerrorMessage(const PGconn *conn);
|
||||
extern int PQsocket(const PGconn *conn);
|
||||
extern int PQbackendPID(const PGconn *conn);
|
||||
|
@ -113,3 +113,5 @@ EXPORTS
|
||||
PQfformat @ 109
|
||||
PQexecPrepared @ 110
|
||||
PQsendQueryPrepared @ 111
|
||||
PQdsplen @ 112
|
||||
PQserverVersion @ 113
|
||||
|
@ -114,3 +114,4 @@ EXPORTS
|
||||
PQexecPrepared @ 110
|
||||
PQsendQueryPrepared @ 111
|
||||
PQdsplen @ 112
|
||||
PQserverVersion @ 113
|
||||
|
Loading…
x
Reference in New Issue
Block a user