mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 09:24:07 +03:00
Exposed protocol_version and server_version
This commit is contained in:
parent
e3a5ae8e20
commit
39d6d8ad11
|
@ -1,5 +1,8 @@
|
||||||
2009-04-19 Federico Di Gregorio <fog@initd.org>
|
2009-04-19 Federico Di Gregorio <fog@initd.org>
|
||||||
|
|
||||||
|
* psycopg/connection.*: exposed protocol_version and
|
||||||
|
server_version attributes on the connection object.
|
||||||
|
|
||||||
* lib/extras.py: patch from Marko Kreen to implement missing dict
|
* lib/extras.py: patch from Marko Kreen to implement missing dict
|
||||||
methods in DictRow.
|
methods in DictRow.
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ typedef struct {
|
||||||
long int mark; /* number of commits/rollbacks done so far */
|
long int mark; /* number of commits/rollbacks done so far */
|
||||||
int status; /* status of the connection */
|
int status; /* status of the connection */
|
||||||
int protocol; /* protocol version */
|
int protocol; /* protocol version */
|
||||||
|
int server_version; /* server version */
|
||||||
|
|
||||||
PGconn *pgconn; /* the postgresql connection */
|
PGconn *pgconn; /* the postgresql connection */
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ conn_notice_clean(connectionObject *self)
|
||||||
while (notice != NULL) {
|
while (notice != NULL) {
|
||||||
tmp = notice;
|
tmp = notice;
|
||||||
notice = notice->next;
|
notice = notice->next;
|
||||||
free(tmp->message);
|
free((void*)tmp->message);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,6 +250,8 @@ conn_connect(connectionObject *self)
|
||||||
#endif
|
#endif
|
||||||
Dprintf("conn_connect: using protocol %d", self->protocol);
|
Dprintf("conn_connect: using protocol %d", self->protocol);
|
||||||
|
|
||||||
|
self->server_version = (int)PQserverVersion(pgconn);
|
||||||
|
|
||||||
self->pgconn = pgconn;
|
self->pgconn = pgconn;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -383,6 +383,12 @@ static struct PyMemberDef connectionObject_members[] = {
|
||||||
"A set of typecasters to convert textual values."},
|
"A set of typecasters to convert textual values."},
|
||||||
{"binary_types", T_OBJECT, offsetof(connectionObject, binary_types), RO,
|
{"binary_types", T_OBJECT, offsetof(connectionObject, binary_types), RO,
|
||||||
"A set of typecasters to convert binary values."},
|
"A set of typecasters to convert binary values."},
|
||||||
|
{"protocol_version", T_INT,
|
||||||
|
offsetof(connectionObject, protocol), RO,
|
||||||
|
"Protocol version (2 or 3) used for this connection."},
|
||||||
|
{"server_version", T_INT,
|
||||||
|
offsetof(connectionObject, server_version), RO,
|
||||||
|
"Server version."},
|
||||||
#endif
|
#endif
|
||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user