Project

General

Profile

« Previous | Next » 

Revision 3162

sql.py: DbConn: Fixed bug where Exceptions did not have the query appended if the query was not run in cacheable mode, by moving _add_cursor_info() from DbCursor.execute() to run_query() so it would also get called for non-cacheable queries that use a native cursor rather than a wrapper. Fixed bug where non-cacheable queries were not autocommitted, by moving self.do_autocommit() from DbCursor.execute() to run_query() so it would also get called for non-cacheable queries that use a native cursor rather than a wrapper.

View differences:

sql.py
247 247
            self._is_insert = query.startswith('INSERT')
248 248
            self.query_lookup = query
249 249
            try:
250
                try:
251
                    cur = self.inner.execute(query)
252
                    self.outer.do_autocommit()
250
                try: cur = self.inner.execute(query)
253 251
                finally: self.query = get_cur_query(self.inner, query)
254 252
            except Exception, e:
255
                _add_cursor_info(e, self, query)
256 253
                self.result = e # cache the exception as the result
257 254
                self._cache_result()
258 255
                raise
......
369 366
                self.log_debug(log_msg(query), log_level)
370 367
            
371 368
            # Run query
372
            cur.execute(query)
369
            try:
370
                cur.execute(query)
371
                self.do_autocommit()
372
            except Exception, e:
373
                _add_cursor_info(e, self, query)
374
                raise
373 375
        finally:
374 376
            self.print_notices()
375 377
            if self.debug and debug_msg_ref != None: # return after running

Also available in: Unified diff