Ticket #7407: oracle_sequence_reset_quote_name.patch
File oracle_sequence_reset_quote_name.patch, 2.5 KB (added by , 16 years ago) |
---|
-
django/db/backends/oracle/base.py
145 145 # Since we've just deleted all the rows, running our sequence 146 146 # ALTER code will reset the sequence to 0. 147 147 for sequence_info in sequences: 148 table_name = sequence_info['table']149 seq_name = get_sequence_name(table_name)148 sequence_name = get_sequence_name(sequence_info['table']) 149 table_name = self.quote_name(sequence_info['table']) 150 150 column_name = self.quote_name(sequence_info['column'] or 'id') 151 query = _get_sequence_reset_sql() % {'sequence': seq _name,152 'table': self.quote_name(table_name),151 query = _get_sequence_reset_sql() % {'sequence': sequence_name, 152 'table': table_name, 153 153 'column': column_name} 154 154 sql.append(query) 155 155 return sql … … 164 164 for f in model._meta.fields: 165 165 if isinstance(f, models.AutoField): 166 166 sequence_name = get_sequence_name(model._meta.db_table) 167 table_name = self.quote_name(model._meta.db_table) 167 168 column_name = self.quote_name(f.db_column or f.name) 168 169 output.append(query % {'sequence': sequence_name, 169 'table': model._meta.db_table,170 'table': table_name, 170 171 'column': column_name}) 171 172 break # Only one AutoField is allowed per model, so don't bother continuing. 172 173 for f in model._meta.many_to_many: 173 174 sequence_name = get_sequence_name(f.m2m_db_table()) 175 table_name = self.quote_name(f.m2m_db_table()) 176 column_name = self.quote_name('id') 174 177 output.append(query % {'sequence': sequence_name, 175 'table': f.m2m_db_table(),176 'column': self.quote_name('id')})178 'table': table_name, 179 'column': column_name}) 177 180 return output 178 181 179 182 def start_transaction_sql(self):