Revision 2797
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
218 | 218 |
# None turns off the mogrifier |
219 | 219 |
|
220 | 220 |
self._is_insert = query.startswith('INSERT') |
221 |
self.query_lookup = _query_lookup(query, params)
|
|
221 |
self.query_lookup = query
|
|
222 | 222 |
try: |
223 | 223 |
try: |
224 | 224 |
cur = self.inner.execute(query, params) |
... | ... | |
313 | 313 |
try: |
314 | 314 |
# Get cursor |
315 | 315 |
if cacheable: |
316 |
query_lookup = _query_lookup(query, []) |
|
317 | 316 |
try: |
318 |
cur = self.query_results[query_lookup]
|
|
317 |
cur = self.query_results[query] |
|
319 | 318 |
used_cache = True |
320 | 319 |
except KeyError: cur = self.DbCursor(self) |
321 | 320 |
else: cur = self.db.cursor() |
... | ... | |
333 | 332 |
|
334 | 333 |
return cur |
335 | 334 |
|
336 |
def is_cached(self, query): |
|
337 |
return _query_lookup(query, []) in self.query_results |
|
335 |
def is_cached(self, query): return query in self.query_results |
|
338 | 336 |
|
339 | 337 |
def with_autocommit(self, func, autocommit=True): |
340 | 338 |
prev_autocommit = self.db.autocommit |
Also available in: Unified diff
sql.py: DbConn: Cache queries without params, as params are no longer used