Hi again,
After looking at the DBIx::Class::Storage::deploy() subroutine looks
like there isn't any interrogation of the overall success of executing
all the schema DDL statements. The code is below... maybe there should
be some scalar variable that is initialized as true in the subroutine
yet is set to false inside the eval error catch if ($@) {} statement,
then at the end of the subroutine returning the value of this scalar?
Leandro
sub deploy {
my ($self, $schema, $type, $sqltargs, $dir) = @_;
my $deploy = sub {
my $line = shift;
return if($line =~ /^--/);
return if(!$line);
# next if($line =~ /^DROP/m);
return if($line =~ /^BEGIN TRANSACTION/m);
return if($line =~ /^COMMIT/m);
return if $line =~ /^\s+$/; # skip whitespace only
$self->_query_start($line);
eval {
$self->dbh->do($line); # shouldn't be using ->dbh ?
};
if ($@) {
carp qq{$@ (running "${line}")};
}
$self->_query_end($line);
};
my @statements = $self->deployment_statements($schema, $type, undef,
$dir, { no_comments => 1, %{ $sqltargs || {} } } );
if (@statements > 1) {
foreach my $statement (@statements) {
$deploy->( $statement );
}
}
elsif (@statements == 1) {
foreach my $line ( split(";\n", $statements[0])) {
$deploy->( $line );
}
}
}
From: Hermida, Leandro [mailto:[email protected]]
Sent: Sunday, May 24, 2009 17:03
To: [email protected]
Subject: [Dbix-class] schema deploy() method runs successfully yet
returnsfalse
Hello again,
The $schema->deploy() method seems to run correctly but returns a false
value so that if combined with "or die ..." it always dies.
Best,
Leandro
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]