mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-03-03 15:45:46 +03:00
Dropped PG_VERSION_HEX constant
At PostgreSQL 10.0 it would have become awkward.
This commit is contained in:
parent
ffd98a82c0
commit
73d17e3c5e
|
@ -39,7 +39,7 @@ static unsigned char *
|
||||||
binary_escape(unsigned char *from, size_t from_length,
|
binary_escape(unsigned char *from, size_t from_length,
|
||||||
size_t *to_length, PGconn *conn)
|
size_t *to_length, PGconn *conn)
|
||||||
{
|
{
|
||||||
#if PG_VERSION_HEX >= 0x080104
|
#if PG_VERSION_NUM >= 80104
|
||||||
if (conn)
|
if (conn)
|
||||||
return PQescapeByteaConn(conn, from, from_length, to_length);
|
return PQescapeByteaConn(conn, from, from_length, to_length);
|
||||||
else
|
else
|
||||||
|
|
|
@ -474,7 +474,7 @@ lobject_export(lobjectObject *self, const char *filename)
|
||||||
return retvalue;
|
return retvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PG_VERSION_HEX >= 0x080300
|
#if PG_VERSION_NUM >= 80300
|
||||||
|
|
||||||
RAISES_NEG int
|
RAISES_NEG int
|
||||||
lobject_truncate(lobjectObject *self, size_t len)
|
lobject_truncate(lobjectObject *self, size_t len)
|
||||||
|
@ -511,4 +511,4 @@ lobject_truncate(lobjectObject *self, size_t len)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* PG_VERSION_HEX >= 0x080300 */
|
#endif /* PG_VERSION_NUM >= 80300 */
|
||||||
|
|
|
@ -266,7 +266,7 @@ psyco_lobj_get_closed(lobjectObject *self, void *closure)
|
||||||
return closed;
|
return closed;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PG_VERSION_HEX >= 0x080300
|
#if PG_VERSION_NUM >= 80300
|
||||||
|
|
||||||
#define psyco_lobj_truncate_doc \
|
#define psyco_lobj_truncate_doc \
|
||||||
"truncate(len=0) -- Truncate large object to given size."
|
"truncate(len=0) -- Truncate large object to given size."
|
||||||
|
@ -327,10 +327,10 @@ static struct PyMethodDef lobjectObject_methods[] = {
|
||||||
METH_NOARGS, psyco_lobj_unlink_doc},
|
METH_NOARGS, psyco_lobj_unlink_doc},
|
||||||
{"export",(PyCFunction)psyco_lobj_export,
|
{"export",(PyCFunction)psyco_lobj_export,
|
||||||
METH_VARARGS, psyco_lobj_export_doc},
|
METH_VARARGS, psyco_lobj_export_doc},
|
||||||
#if PG_VERSION_HEX >= 0x080300
|
#if PG_VERSION_NUM >= 80300
|
||||||
{"truncate",(PyCFunction)psyco_lobj_truncate,
|
{"truncate",(PyCFunction)psyco_lobj_truncate,
|
||||||
METH_VARARGS, psyco_lobj_truncate_doc},
|
METH_VARARGS, psyco_lobj_truncate_doc},
|
||||||
#endif /* PG_VERSION_HEX >= 0x080300 */
|
#endif /* PG_VERSION_NUM >= 80300 */
|
||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,7 @@ psyco_libcrypto_threads_init(void)
|
||||||
if (PyImport_ImportModule("ssl") != NULL) {
|
if (PyImport_ImportModule("ssl") != NULL) {
|
||||||
/* disable libcrypto setup in libpq, so it won't stomp on the callbacks
|
/* disable libcrypto setup in libpq, so it won't stomp on the callbacks
|
||||||
that have already been set up */
|
that have already been set up */
|
||||||
#if PG_VERSION_HEX >= 0x080400
|
#if PG_VERSION_NUM >= 80400
|
||||||
PQinitOpenSSL(1, 0);
|
PQinitOpenSSL(1, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ exit:
|
||||||
static PyObject*
|
static PyObject*
|
||||||
psyco_libpq_version(PyObject *self)
|
psyco_libpq_version(PyObject *self)
|
||||||
{
|
{
|
||||||
#if PG_VERSION_HEX >= 0x090100
|
#if PG_VERSION_NUM >= 90100
|
||||||
return PyInt_FromLong(PQlibVersion());
|
return PyInt_FromLong(PQlibVersion());
|
||||||
#else
|
#else
|
||||||
PyErr_SetString(NotSupportedError, "version discovery is not supported in libpq < 9.1");
|
PyErr_SetString(NotSupportedError, "version discovery is not supported in libpq < 9.1");
|
||||||
|
|
|
@ -62,7 +62,7 @@ psycopg_escape_string(connectionObject *conn, const char *from, Py_ssize_t len,
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
#if PG_VERSION_HEX >= 0x080104
|
#if PG_VERSION_NUM >= 80104
|
||||||
int err;
|
int err;
|
||||||
if (conn && conn->pgconn)
|
if (conn && conn->pgconn)
|
||||||
ql = PQescapeStringConn(conn->pgconn, to+eq+1, from, len, &err);
|
ql = PQescapeStringConn(conn->pgconn, to+eq+1, from, len, &err);
|
||||||
|
|
3
setup.py
3
setup.py
|
@ -419,9 +419,6 @@ class psycopg_build_ext(build_ext):
|
||||||
define_macros.append(("PG_VERSION_NUM", "%d%02d%02d" %
|
define_macros.append(("PG_VERSION_NUM", "%d%02d%02d" %
|
||||||
(pgmajor, pgminor, pgpatch)))
|
(pgmajor, pgminor, pgpatch)))
|
||||||
|
|
||||||
define_macros.append(("PG_VERSION_HEX", "0x%02X%02X%02X" %
|
|
||||||
(pgmajor, pgminor, pgpatch)))
|
|
||||||
|
|
||||||
# enable lo64 if libpq >= 9.3 and Python 64 bits
|
# enable lo64 if libpq >= 9.3 and Python 64 bits
|
||||||
if (pgmajor, pgminor) >= (9, 3) and is_py_64():
|
if (pgmajor, pgminor) >= (9, 3) and is_py_64():
|
||||||
define_macros.append(("HAVE_LO64", "1"))
|
define_macros.append(("HAVE_LO64", "1"))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user