|
60 |
raise PGError, msg |
60 |
raise PGError, msg |
61 |
self.closed = 0 |
61 |
self.closed = 0 |
62 |
try : |
62 |
try : |
63 |
self.quote = self.database._quote |
|
|
64 |
except AttributeError : # pg <v4.x |
65 |
self.quote = pg._quote |
66 |
try : |
67 |
self.database.query("SET CLIENT_ENCODING TO 'UTF-8';") |
63 |
self.database.query("SET CLIENT_ENCODING TO 'UTF-8';") |
68 |
except PGError, msg : |
64 |
except PGError, msg : |
69 |
self.tool.logdebug("Impossible to set database client encoding to UTF-8 : %s" % msg) |
65 |
self.tool.logdebug("Impossible to set database client encoding to UTF-8 : %s" % msg) |
|
137 |
|
133 |
|
138 |
def doQuote(self, field) : |
134 |
def doQuote(self, field) : |
139 |
"""Quotes a field for use as a string in SQL queries.""" |
135 |
"""Quotes a field for use as a string in SQL queries.""" |
140 |
if type(field) == type(0.0) : |
136 |
return self.database.adapter.adapt_inline(field) |
141 |
typ = "decimal" |
|
|
142 |
elif type(field) == type(0) : |
143 |
typ = "int" |
144 |
elif type(field) == type(0L) : |
145 |
typ = "int" |
146 |
else : |
147 |
typ = "text" |
148 |
return self.quote(field, typ) |
149 |
|
137 |
|
150 |
def prepareRawResult(self, result) : |
138 |
def prepareRawResult(self, result) : |
151 |
"""Prepares a raw result by including the headers.""" |
139 |
"""Prepares a raw result by including the headers.""" |