Ticket #1261: boulder-oracle-sprint-firebird-rev4309.patch
File boulder-oracle-sprint-firebird-rev4309.patch, 3.9 KB (added by , 18 years ago) |
---|
-
django/db/models/fields/__init__.py
417 417 raise validators.ValidationError, gettext_lazy("This field cannot be null.") 418 418 return str(value) 419 419 420 def get_db_prep_save(self, value): 421 return Field.get_db_prep_save(self, str(value)) 422 420 423 def formfield(self, initial=None): 421 424 return forms.CharField(max_length=self.maxlength, required=not self.blank, label=capfirst(self.verbose_name), initial=initial) 422 425 … … 481 484 def get_db_prep_save(self, value): 482 485 # Casts dates into string format for entry into database. 483 486 if isinstance(value, datetime.datetime): 484 if settings.DATABASE_ENGINE != 'oracle':485 # Oracle does not need a string conversion487 if settings.DATABASE_ENGINE not in ('oracle', 'firebird'): 488 # Oracle and Firebird does not need a string conversion 486 489 value = value.date().strftime('%Y-%m-%d') 487 490 elif isinstance(value, datetime.date): 488 if settings.DATABASE_ENGINE != 'oracle':489 # Oracle does not need a string conversion491 if settings.DATABASE_ENGINE not in ('oracle', 'firebird'): 492 # Oracle and Firebird does not need a string conversion 490 493 value = value.strftime('%Y-%m-%d') 491 494 return Field.get_db_prep_save(self, value) 492 495 … … 524 527 # neither database supports microseconds. 525 528 if settings.DATABASE_ENGINE in ('mysql', 'oracle') and hasattr(value, 'microsecond'): 526 529 value = value.replace(microsecond=0) 527 # cx_Oracle wants the raw datetime instead of a string.528 if settings.DATABASE_ENGINE != 'oracle':530 # cx_Oracle and Firebird wants the raw datetime instead of a string. 531 if settings.DATABASE_ENGINE not in ('oracle', 'firebird'): 529 532 value = str(value) 530 533 return Field.get_db_prep_save(self, value) 531 534 -
django/db/models/query.py
657 657 else: 658 658 cast_sql = '%s' 659 659 try: 660 return '%s%s %s' % (table_prefix, field_name, 660 lookup_sql = '%s%s %s' 661 if (settings.DATABASE_ENGINE == 'firebird' and lookup_type[0] == 'i'): 662 lookup_sql = 'UPPER(%s%s) %s' 663 return lookup_sql % (table_prefix, field_name, 661 664 backend.OPERATOR_MAPPING[lookup_type] % cast_sql) 662 665 except KeyError: 663 666 pass -
django/core/management.py
163 163 # Make the definition (e.g. 'foo VARCHAR(30)') for this field. 164 164 field_output = [style.SQL_FIELD(backend.quote_name(f.column)), 165 165 style.SQL_COLTYPE(col_type % rel_field.__dict__)] 166 field_output.append(style.SQL_KEYWORD('%sNULL' % (not f.null and 'NOT ' or ' ')))166 field_output.append(style.SQL_KEYWORD('%sNULL' % (not f.null and 'NOT ' or 'DEFAULT '))) 167 167 if f.unique and (not f.primary_key or backend.allows_unique_and_pk): 168 168 field_output.append(style.SQL_KEYWORD('UNIQUE')) 169 169 if f.primary_key: … … 1177 1177 index_output = [] 1178 1178 for f in fields: 1179 1179 field_output = [backend.quote_name(f.name), data_types[f.get_internal_type()] % f.__dict__] 1180 field_output.append("%sNULL" % (not f.null and "NOT " or " "))1180 field_output.append("%sNULL" % (not f.null and "NOT " or "DEFAULT ")) 1181 1181 if f.unique: 1182 1182 field_output.append("UNIQUE") 1183 1183 if f.primary_key: