Django

Code

Changeset 2985

Show
Ignore:
Timestamp:
05/26/06 00:20:21 (2 years ago)
Author:
adrian
Message:

Fixed #1935 -- Initial SQL data now works in SQLite if there are multiple statements. Thanks, jpellerin@gmail.com

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/AUTHORS

    r2982 r2985  
    6666    Jason Huggins <http://www.jrandolph.com/blog/> 
    6767    Michael Josephson <http://www.sdjournal.com/> 
     68    jpellerin@gmail.com 
    6869    junzhang.jn@gmail.com 
    6970    Russell Keith-Magee <freakboy@iinet.net.au> 
  • django/trunk/django/core/management.py

    r2946 r2985  
    329329    output = [] 
    330330 
     331    # Some backends can't execute more than one SQL statement at a time, 
     332    # so split into separate statements. 
     333    sql_expr = re.compile( 
     334        r"""(           # each statement is... 
     335        (?:             # one or more chunks of ... 
     336            (?:[^;'"]+) # not the end of a statement or start of a quote 
     337          | (?:'[^']+') # something in single quotes 
     338          | (?:"[^"]+") # something in double quotes 
     339        )+)""", re.VERBOSE) 
     340 
    331341    # Find custom SQL, if it's available. 
    332342    sql_files = [os.path.join(app_dir, "%s.%s.sql" % (opts.object_name.lower(), settings.DATABASE_ENGINE)), 
     
    335345        if os.path.exists(sql_file): 
    336346            fp = open(sql_file) 
    337             output.append(fp.read()) 
     347            output.extend(sql_expr.findall(fp.read())) 
    338348            fp.close() 
    339349