diff options
| author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2018-10-15 01:24:00 +0100 |
|---|---|---|
| committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2018-10-15 01:24:00 +0100 |
| commit | 0236c68da94c7ca884e3ced1b2c53ad84812678a (patch) | |
| tree | 089cb41912e1ef8776eae007565bb80907e22268 /lib | |
| parent | b205764fdde4549c48c27841aa17e6c7f499e808 (diff) | |
| parent | c567556d7194cb5bed71a2f8df5370c9854a4574 (diff) | |
| download | psycopg2-0236c68da94c7ca884e3ced1b2c53ad84812678a.tar.gz | |
Merge branch 'connection-info'
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/_json.py | 2 | ||||
| -rw-r--r-- | lib/_range.py | 4 | ||||
| -rw-r--r-- | lib/extensions.py | 2 | ||||
| -rw-r--r-- | lib/extras.py | 6 | ||||
| -rw-r--r-- | lib/pool.py | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/lib/_json.py b/lib/_json.py index 71c2b76..0438c25 100644 --- a/lib/_json.py +++ b/lib/_json.py @@ -185,7 +185,7 @@ def _get_json_oids(conn_or_curs, name='json'): conn_status = conn.status # column typarray not available before PG 8.3 - typarray = conn.server_version >= 80300 and "typarray" or "NULL" + typarray = conn.info.server_version >= 80300 and "typarray" or "NULL" # get the oid for the hstore curs.execute( diff --git a/lib/_range.py b/lib/_range.py index e72c878..1747b20 100644 --- a/lib/_range.py +++ b/lib/_range.py @@ -352,9 +352,9 @@ class RangeCaster(object): from psycopg2.extras import _solve_conn_curs conn, curs = _solve_conn_curs(conn_or_curs) - if conn.server_version < 90200: + if conn.info.server_version < 90200: raise ProgrammingError("range types not available in version %s" - % conn.server_version) + % conn.info.server_version) # Store the transaction status of the connection to revert it after use conn_status = conn.status diff --git a/lib/extensions.py b/lib/extensions.py index 3111d41..3e23906 100644 --- a/lib/extensions.py +++ b/lib/extensions.py @@ -61,7 +61,7 @@ from psycopg2._psycopg import ( # noqa adapt, adapters, encodings, connection, cursor, lobject, Xid, libpq_version, parse_dsn, quote_ident, string_types, binary_types, new_type, new_array_type, register_type, - ISQLQuote, Notify, Diagnostics, Column, + ISQLQuote, Notify, Diagnostics, Column, ConnectionInfo, QueryCanceledError, TransactionRollbackError, set_wait_callback, get_wait_callback, encrypt_password, ) diff --git a/lib/extras.py b/lib/extras.py index af59d2f..4dea3f9 100644 --- a/lib/extras.py +++ b/lib/extras.py @@ -806,7 +806,7 @@ class HstoreAdapter(object): self.conn = conn # use an old-style getquoted implementation if required - if conn.server_version < 90000: + if conn.info.server_version < 90000: self.getquoted = self._getquoted_8 def _getquoted_8(self): @@ -911,7 +911,7 @@ class HstoreAdapter(object): conn_status = conn.status # column typarray not available before PG 8.3 - typarray = conn.server_version >= 80300 and "typarray" or "NULL" + typarray = conn.info.server_version >= 80300 and "typarray" or "NULL" rv0, rv1 = [], [] @@ -1097,7 +1097,7 @@ class CompositeCaster(object): schema = 'public' # column typarray not available before PG 8.3 - typarray = conn.server_version >= 80300 and "typarray" or "NULL" + typarray = conn.info.server_version >= 80300 and "typarray" or "NULL" # get the type oid and attributes curs.execute("""\ diff --git a/lib/pool.py b/lib/pool.py index 6c26f7d..734c136 100644 --- a/lib/pool.py +++ b/lib/pool.py @@ -105,7 +105,7 @@ class AbstractConnectionPool(object): # Return the connection into a consistent state before putting # it back into the pool if not conn.closed: - status = conn.get_transaction_status() + status = conn.info.transaction_status if status == _ext.TRANSACTION_STATUS_UNKNOWN: # server connection lost conn.close() |
