Revision 3040
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
238 | 238 |
# Always cache certain queries |
239 | 239 |
if query.startswith('CREATE') or query.startswith('ALTER'): |
240 | 240 |
# structural changes |
241 |
if query.find('ADD COLUMN') < 0: # rest of query must be unique |
|
241 |
# Rest of query must be unique in the face of name collisions, |
|
242 |
# so don't cache ADD COLUMN unless it has distinguishing comment |
|
243 |
if query.find('ADD COLUMN') < 0 or query.endswith('*/'): |
|
242 | 244 |
self._cache_result() |
243 | 245 |
elif self.rowcount == 0 and query.startswith('SELECT'): # empty |
244 | 246 |
consume_rows(self) # fetch all rows so result will be cached |
Also available in: Unified diff
sql.py: DbConn.DbCursor.execute(): Allow ADD COLUMN to be cached if it has a distinguishing comment, because then the rest of query will be unique in the face of name collisions