Django

Code

Changeset 5136

Show
Ignore:
Timestamp:
05/02/07 11:30:00 (1 year ago)
Author:
bouldersprinters
Message:

boulder-oracle-sprint: Fixed sqlclear trying to drop sequences for
tables without AutoFields?. Fixed output of sql, sqlall, sqlreset, and
sqlflush for piping to SQL*Plus.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/boulder-oracle-sprint/django/core/management.py

    r5135 r5136  
    372372                        style.SQL_FIELD(truncate_name(r_name, backend.get_max_name_length())))) 
    373373                del references_to_delete[model] 
    374             if hasattr(backend, 'get_drop_sequence'): 
     374            if model._meta.has_auto_field and hasattr(backend, 'get_drop_sequence'): 
    375375                output.append(backend.get_drop_sequence(model._meta.db_table)) 
    376376 
  • django/branches/boulder-oracle-sprint/django/db/backends/oracle/base.py

    r5079 r5136  
    9696        args = [(':arg%d' % i) for i in range(len(params))] 
    9797        query = query % tuple(args) 
    98         # cx_Oracle cannot execute a query with the closing ';' 
    99         if query.endswith(';'): 
     98        # cx_Oracle wants no trailing ';' for SQL statements.  For PL/SQL, it 
     99        # it does want a trailing ';' but not a trailing '/'.  However, these 
     100        # characters must be included in the original query in case the query 
     101        # is being passed to SQL*Plus. 
     102        if query.endswith(';') or query.endswith('/'): 
    100103            query = query[:-1] 
    101104        return query, params 
     
    186189    BEGIN 
    187190      SELECT %s.nextval INTO :new.id FROM dual; 
    188     END;\n""" % (tr_name, quote_name(table), sq_name) 
     191    END; 
     192    /""" % (tr_name, quote_name(table), sq_name) 
    189193    return sequence_sql, trigger_sql 
    190194 
     
    209213            END IF; 
    210214            COMMIT; 
    211         END;\n""" 
     215        END; 
     216        /""" 
    212217 
    213218def get_sql_flush(style, tables, sequences):