mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-14 16:20:33 +03:00
Favour the PG9 implementation of the hstore adapter.
This commit is contained in:
parent
ed623776f3
commit
bb41acd1da
|
@ -482,9 +482,9 @@ class HstoreAdapter(object):
|
||||||
def prepare(self, conn):
|
def prepare(self, conn):
|
||||||
self.conn = conn
|
self.conn = conn
|
||||||
|
|
||||||
# select the most efficient getquoted implementation
|
# use an old-style getquoted implementation if required
|
||||||
if conn.server_version >= 90000:
|
if conn.server_version < 90000:
|
||||||
self.getquoted = self._getquoted_9
|
self.getquoted = self._getquoted_8
|
||||||
|
|
||||||
def _getquoted_8(self):
|
def _getquoted_8(self):
|
||||||
"""Use the operators available in PG pre-9.0."""
|
"""Use the operators available in PG pre-9.0."""
|
||||||
|
@ -509,8 +509,6 @@ class HstoreAdapter(object):
|
||||||
|
|
||||||
return "(" + '||'.join(rv) + ")"
|
return "(" + '||'.join(rv) + ")"
|
||||||
|
|
||||||
getquoted = _getquoted_8
|
|
||||||
|
|
||||||
def _getquoted_9(self):
|
def _getquoted_9(self):
|
||||||
"""Use the hstore(text[], text[]) function."""
|
"""Use the hstore(text[], text[]) function."""
|
||||||
if not self.wrapped:
|
if not self.wrapped:
|
||||||
|
@ -522,6 +520,8 @@ class HstoreAdapter(object):
|
||||||
v.prepare(self.conn)
|
v.prepare(self.conn)
|
||||||
return "hstore(%s, %s)" % (k.getquoted(), v.getquoted())
|
return "hstore(%s, %s)" % (k.getquoted(), v.getquoted())
|
||||||
|
|
||||||
|
getquoted = _getquoted_9
|
||||||
|
|
||||||
_re_hstore = regex.compile(r"""
|
_re_hstore = regex.compile(r"""
|
||||||
# hstore key:
|
# hstore key:
|
||||||
# a string of normal or escaped chars
|
# a string of normal or escaped chars
|
||||||
|
|
Loading…
Reference in New Issue
Block a user