Project

General

Profile

« Previous | Next » 

Revision 3004

sql.py: DbConn.DbCursor.execute(): Always cache structural changes, not just if they throw an exception

View differences:

lib/sql.py
234 234
                self.result = e # cache the exception as the result
235 235
                self._cache_result()
236 236
                raise
237
            if self.rowcount == 0 and query.startswith('SELECT'): # empty SELECT
237
            
238
            # Always cache certain queries
239
            if query.startswith('CREATE') or query.startswith('ALTER'):
240
                self._cache_result() # structural changes
241
            elif self.rowcount == 0 and query.startswith('SELECT'): # empty
238 242
                consume_rows(self) # fetch all rows so result will be cached
243
            
239 244
            return cur
240 245
        
241 246
        def fetchone(self):

Also available in: Unified diff