Ticket #3615: set-foreign-key-checks-on-managed-trans.diff
File set-foreign-key-checks-on-managed-trans.diff, 5.3 KB (added by , 17 years ago) |
---|
-
django/db/backends/ado_mssql/base.py
84 84 if self.connection is not None: 85 85 return self.connection.rollback() 86 86 87 def _disable_broken_foreign_key_checks(self): 88 pass 89 90 def _enable_broken_foreign_key_checks(self): 91 pass 92 87 93 def close(self): 88 94 if self.connection is not None: 89 95 self.connection.close() -
django/db/backends/mysql_old/base.py
120 120 except Database.NotSupportedError: 121 121 pass 122 122 123 def _disable_broken_foreign_key_checks(self): 124 pass 125 126 def _enable_broken_foreign_key_checks(self): 127 pass 128 123 129 def close(self): 124 130 if self.connection is not None: 125 131 self.connection.close() -
django/db/backends/postgresql/base.py
100 100 if self.connection is not None: 101 101 return self.connection.rollback() 102 102 103 def _disable_broken_foreign_key_checks(self): 104 pass 105 106 def _enable_broken_foreign_key_checks(self): 107 pass 108 103 109 def close(self): 104 110 if self.connection is not None: 105 111 self.connection.close() -
django/db/backends/sqlite3/base.py
82 82 if self.connection is not None: 83 83 self.connection.rollback() 84 84 85 def _disable_broken_foreign_key_checks(self): 86 pass 87 88 def _enable_broken_foreign_key_checks(self): 89 pass 90 85 91 def close(self): 86 92 from django.conf import settings 87 93 # If database is in memory, closing the connection destroys the database. -
django/db/backends/mysql/base.py
118 118 self.connection.rollback() 119 119 except Database.NotSupportedError: 120 120 pass 121 122 def _disable_broken_foreign_key_checks(self): 123 if self.connection is not None: 124 self.connection.cursor().execute('SET FOREIGN_KEY_CHECKS = 0;') 125 126 def _enable_broken_foreign_key_checks(self): 127 if self.connection is not None: 128 self.connection.cursor().execute('SET FOREIGN_KEY_CHECKS = 1;') 121 129 122 130 def close(self): 123 131 if self.connection is not None: -
django/db/backends/oracle/base.py
54 54 except Database.NotSupportedError: 55 55 pass 56 56 57 def _disable_broken_foreign_key_checks(self): 58 pass 59 60 def _enable_broken_foreign_key_checks(self): 61 pass 62 57 63 def close(self): 58 64 if self.connection is not None: 59 65 self.connection.close() -
django/db/backends/postgresql_psycopg2/base.py
68 68 if self.connection is not None: 69 69 return self.connection.rollback() 70 70 71 def _disable_broken_foreign_key_checks(self): 72 pass 73 74 def _enable_broken_foreign_key_checks(self): 75 pass 76 71 77 def close(self): 72 78 if self.connection is not None: 73 79 self.connection.close() -
django/db/backends/dummy/base.py
25 25 cursor = complain 26 26 _commit = complain 27 27 _rollback = ignore 28 _disable_broken_foreign_key_checks = ignore 29 _enable_broken_foreign_key_checks = ignore 28 30 29 31 def __init__(self, **kwargs): 30 32 pass -
django/db/transaction.py
53 53 state[thread_ident].append(settings.TRANSACTIONS_MANAGED) 54 54 if thread_ident not in dirty: 55 55 dirty[thread_ident] = False 56 connection._disable_broken_foreign_key_checks() 56 57 57 58 def leave_transaction_management(): 58 59 """ … … 68 69 if dirty.get(thread_ident, False): 69 70 rollback() 70 71 raise TransactionManagementError("Transaction managed block ended with pending COMMIT/ROLLBACK") 72 connection._enable_broken_foreign_key_checks() 71 73 dirty[thread_ident] = False 72 74 73 75 def is_dirty():