[Dbix-class] schema deploy() method runs successfully yet
returnsfalse
Hermida, Leandro
Leandro.Hermida at fmi.ch
Sun May 31 15:47:10 GMT 2009
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:Leandro.Hermida at fmi.ch]
Sent: Sunday, May 24, 2009 17:03
To: dbix-class at lists.scsys.co.uk
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20090531/99c4149a/attachment.htm
More information about the DBIx-Class
mailing list