From: Ash Berlin Date: Tue, 31 Oct 2006 11:24:43 +0000 (+0000) Subject: Deploy fix that will hopefully sort out problems with HTML::Widget::DBIxClass X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e7058416b112233eaf252e4114a84a8f524b5cf7;p=dbsrgits%2FDBIx-Class-Historic.git Deploy fix that will hopefully sort out problems with HTML::Widget::DBIxClass --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index cb61070..f739aff 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -1099,18 +1099,23 @@ L. sub deploy { my ($self, $schema, $type, $sqltargs, $dir) = @_; - foreach my $statement ( $self->deployment_statements($schema, $type, undef, $dir, { no_comments => 1, %{ $sqltargs || {} } } ) ) { - for ( split(";\n", $statement)) { - next if($_ =~ /^--/); - next if(!$_); -# next if($_ =~ /^DROP/m); + my @statements = $self->deployment_statements($schema, $type, undef, $dir, { no_comments => 1, %{ $sqltargs || {} } } ); + + if (scalar @statements == 1) { + @statements = split(";\n", $statements[0]); + $type ||= $self->sqlt_type; + # If we got more stmts out from splitting, display a warning + carp "SQL::Translator::Producer:${type}->produce only returned a single scalar for multiple statements.\n" + if (scalar @statements != 1); + } + + foreach (@statements) { + next if($_ =~ /^\s*$/s); next if($_ =~ /^BEGIN TRANSACTION/m); next if($_ =~ /^COMMIT/m); - next if $_ =~ /^\s+$/; # skip whitespace only $self->debugobj->query_start($_) if $self->debug; $self->dbh->do($_) or warn "SQL was:\n $_"; $self->debugobj->query_end($_) if $self->debug; - } } }