717 cursor.execute(str(query), args) |
717 cursor.execute(str(query), args) |
718 except Exception as ex: |
718 except Exception as ex: |
719 if self.repo.config.mode != 'test': |
719 if self.repo.config.mode != 'test': |
720 # during test we get those message when trying to alter sqlite |
720 # during test we get those message when trying to alter sqlite |
721 # db schema |
721 # db schema |
722 self.critical("sql: %r\n args: %s\ndbms message: %r", |
722 self.info("sql: %r\n args: %s\ndbms message: %r", |
723 query, args, ex.args[0]) |
723 query, args, ex.args[0]) |
724 if rollback: |
724 if rollback: |
725 try: |
725 try: |
726 cnx.cnxset.rollback() |
726 cnx.cnxset.rollback() |
727 if self.repo.config.mode != 'test': |
727 if self.repo.config.mode != 'test': |
728 self.critical('transaction has been rolled back') |
728 self.debug('transaction has been rolled back') |
729 except Exception as ex: |
729 except Exception as ex: |
730 pass |
730 pass |
731 if ex.__class__.__name__ == 'IntegrityError': |
731 if ex.__class__.__name__ == 'IntegrityError': |
732 # need string comparison because of various backends |
732 # need string comparison because of various backends |
733 for arg in ex.args: |
733 for arg in ex.args: |
1240 self.repo.hm.call_hooks('before_delete_entity', cnx, entity=entity) |
1240 self.repo.hm.call_hooks('before_delete_entity', cnx, entity=entity) |
1241 # remove is / is_instance_of which are added using sql by hooks, hence |
1241 # remove is / is_instance_of which are added using sql by hooks, hence |
1242 # unvisible as transaction action |
1242 # unvisible as transaction action |
1243 self.doexec(cnx, 'DELETE FROM is_relation WHERE eid_from=%s' % eid) |
1243 self.doexec(cnx, 'DELETE FROM is_relation WHERE eid_from=%s' % eid) |
1244 self.doexec(cnx, 'DELETE FROM is_instance_of_relation WHERE eid_from=%s' % eid) |
1244 self.doexec(cnx, 'DELETE FROM is_instance_of_relation WHERE eid_from=%s' % eid) |
1245 self.doexec(cnx, 'DELETE FROM cw_source_relation WHERE eid_from=%s' % self.eid) |
1245 self.doexec(cnx, 'DELETE FROM cw_source_relation WHERE eid_from=%s' % eid) |
1246 # XXX check removal of inlined relation? |
1246 # XXX check removal of inlined relation? |
1247 # delete the entity |
1247 # delete the entity |
1248 attrs = {'cw_eid': eid} |
1248 attrs = {'cw_eid': eid} |
1249 sql = self.sqlgen.delete(SQL_PREFIX + entity.cw_etype, attrs) |
1249 sql = self.sqlgen.delete(SQL_PREFIX + entity.cw_etype, attrs) |
1250 self.doexec(cnx, sql, attrs) |
1250 self.doexec(cnx, sql, attrs) |