server/sources/native.py
branchstable
changeset 4682 4994901b7379
parent 4517 0f3c10fc42b2
child 4692 11a040e2601c
equal deleted inserted replaced
4681:5f72584ab1d7 4682:4994901b7379
   419             print 'exec', query, args, getattr(cnx, '_cnx', cnx)
   419             print 'exec', query, args, getattr(cnx, '_cnx', cnx)
   420         try:
   420         try:
   421             # str(query) to avoid error if it's an unicode string
   421             # str(query) to avoid error if it's an unicode string
   422             cursor.execute(str(query), args)
   422             cursor.execute(str(query), args)
   423         except Exception, ex:
   423         except Exception, ex:
   424             self.critical("sql: %r\n args: %s\ndbms message: %r",
   424             if self.repo.config.mode != 'test':
   425                           query, args, ex.args[0])
   425                 # during test we get those message when trying to alter sqlite
       
   426                 # db schema
       
   427                 self.critical("sql: %r\n args: %s\ndbms message: %r",
       
   428                               query, args, ex.args[0])
   426             if rollback:
   429             if rollback:
   427                 try:
   430                 try:
   428                     session.pool.connection(self.uri).rollback()
   431                     session.pool.connection(self.uri).rollback()
   429                     self.critical('transaction has been rollbacked')
   432                     self.critical('transaction has been rollbacked')
   430                 except:
   433                 except:
   441         cursor = session.pool[self.uri]
   444         cursor = session.pool[self.uri]
   442         try:
   445         try:
   443             # str(query) to avoid error if it's an unicode string
   446             # str(query) to avoid error if it's an unicode string
   444             cursor.executemany(str(query), args)
   447             cursor.executemany(str(query), args)
   445         except Exception, ex:
   448         except Exception, ex:
   446             self.critical("sql many: %r\n args: %s\ndbms message: %r",
   449             if self.repo.config.mode != 'test':
   447                           query, args, ex.args[0])
   450                 # during test we get those message when trying to alter sqlite
       
   451                 # db schema
       
   452                 self.critical("sql many: %r\n args: %s\ndbms message: %r",
       
   453                               query, args, ex.args[0])
   448             try:
   454             try:
   449                 session.pool.connection(self.uri).rollback()
   455                 session.pool.connection(self.uri).rollback()
   450                 self.critical('transaction has been rollbacked')
   456                 self.critical('transaction has been rollbacked')
   451             except:
   457             except:
   452                 pass
   458                 pass