my $schema = shift;
my $file = shift || $self->get_ddl_file($schema);
- open IN, $file;
+ open( my $fh, "<",$file ) or die "couldnt open $file, $!";
my $sql;
- { local $/ = undef; $sql = <IN>; }
- close IN;
- ($schema->storage->dbh->do($_) || print "Error on SQL: $_\n") for split(/;\n/, $sql);
+ { local $/ = undef; $sql = <$fh>; }
+
+ foreach my $line (split(/;\n/, $sql)) {
+ print "$line\n";
+ next if(!$line);
+ next if($line =~ /^--/);
+ next if($line =~ /^BEGIN TRANSACTION/m);
+ next if($line =~ /^COMMIT/m);
+ next if $line =~ /^\s+$/; # skip whitespace only
+
+ $schema->storage->dbh->do($line) || print "Error on SQL: $line\n";
+ }
}
[ 1, 'Caterwauler McCrae' ],
[ 2, 'Random Boy Band' ],
[ 3, 'We Are Goth' ],
+ [ 4, '' ], # Test overridden new will default name to "Test Name" using use_create => 1.
+ [ 32948, 'Big PK' ],
]);
$schema->populate('CD', [