mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-07 12:50:32 +03:00
get_backend_pid() patch and fixes
This commit is contained in:
parent
a5e01ef0df
commit
e95a4d9d2e
|
@ -1,3 +1,8 @@
|
|||
2008-07-26 Federico Di Gregorio <fog@initd.org>
|
||||
|
||||
* psycopg/connection_type.c: merged get_backend_pid() method
|
||||
by Casey Duncan.
|
||||
|
||||
2008-06-28 Federico Di Gregorio <fog@initd.org>
|
||||
|
||||
* setup.py: fixed problem with spaces in pg_config path.
|
||||
|
|
6
NEWS
6
NEWS
|
@ -1,3 +1,9 @@
|
|||
What's new in psycopg 2.0.8
|
||||
---------------------------
|
||||
|
||||
* The connection object now has a get_backend_pid() method that
|
||||
returns the current PostgreSQL connection backend process PID.
|
||||
|
||||
What's new in psycopg 2.0.7
|
||||
---------------------------
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
/** the quoting code */
|
||||
|
||||
#ifndef PSYCOPG_OWN_QUOTING
|
||||
static size_t
|
||||
size_t
|
||||
qstring_escape(char *to, char *from, size_t len, PGconn *conn)
|
||||
{
|
||||
#if PG_MAJOR_VERSION > 8 || \
|
||||
|
@ -53,7 +53,7 @@ qstring_escape(char *to, char *from, size_t len, PGconn *conn)
|
|||
return PQescapeString(to, from, len);
|
||||
}
|
||||
#else
|
||||
static size_t
|
||||
size_t
|
||||
qstring_escape(char *to, char *from, size_t len, PGconn *conn)
|
||||
{
|
||||
int i, j;
|
||||
|
@ -100,9 +100,6 @@ qstring_quote(qstringObject *self)
|
|||
self->encoding but if the encoding is not specified we don't know what
|
||||
to do and we raise an exception */
|
||||
|
||||
/* TODO: we need a real translation table from postgres encoding names to
|
||||
python ones here */
|
||||
|
||||
Dprintf("qstring_quote: encoding to %s", self->encoding);
|
||||
|
||||
if (PyUnicode_Check(self->wrapped) && self->encoding) {
|
||||
|
|
|
@ -307,6 +307,19 @@ psyco_conn_lobject(connectionObject *self, PyObject *args, PyObject *keywds)
|
|||
return obj;
|
||||
}
|
||||
|
||||
/* get the current backend pid */
|
||||
|
||||
#define psyco_conn_get_backend_pid_doc \
|
||||
"get_backend_pid() -- Get backend process id."
|
||||
|
||||
static PyObject *
|
||||
psyco_conn_get_backend_pid(connectionObject *self)
|
||||
{
|
||||
EXC_IF_CONN_CLOSED(self);
|
||||
|
||||
return PyInt_FromLong((long)PQbackendPID(self->pgconn));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static PyObject *
|
||||
|
@ -339,6 +352,8 @@ static struct PyMethodDef connectionObject_methods[] = {
|
|||
METH_VARARGS, psyco_conn_set_client_encoding_doc},
|
||||
{"get_transaction_status", (PyCFunction)psyco_conn_get_transaction_status,
|
||||
METH_VARARGS, psyco_conn_get_transaction_status_doc},
|
||||
{"get_backend_pid", (PyCFunction)psyco_conn_get_backend_pid,
|
||||
METH_NOARGS, psyco_conn_get_backend_pid_doc},
|
||||
{"lobject", (PyCFunction)psyco_conn_lobject,
|
||||
METH_VARARGS|METH_KEYWORDS, psyco_conn_lobject_doc},
|
||||
#endif
|
||||
|
|
|
@ -142,6 +142,8 @@ HIDDEN PyObject *psyco_GetDecimalType(void);
|
|||
HIDDEN void psyco_set_error(PyObject *exc, PyObject *curs, const char *msg,
|
||||
const char *pgerror, const char *pgcode);
|
||||
|
||||
HIDDEN size_t qstring_escape(char *to, char *from, size_t len, PGconn *conn);
|
||||
|
||||
/* Exceptions docstrings */
|
||||
#define Error_doc \
|
||||
"Base class for error exceptions."
|
||||
|
|
Loading…
Reference in New Issue
Block a user