__PACKAGE__->mk_classdata('storage_type' => '::DBI');
__PACKAGE__->mk_classdata('storage');
__PACKAGE__->mk_classdata('exception_action');
-__PACKAGE__->mk_classdata('stacktrace' => 0);
+__PACKAGE__->mk_classdata('stacktrace' => $ENV{DBIC_TRACE} || 0);
=head1 NAME
my $storage = $storage_class->new($self);
$storage->connect_info(\@info);
$self->storage($storage);
- $self->on_connect() if($self->can('on_connect'));
return $self;
}
}
return @created;
}
- $self->storage->insert_bulk($self->source($name), \@names, $data);
+ my @results_to_create;
+ foreach my $datum (@$data) {
+ my %result_to_create;
+ foreach my $index (0..$#names) {
+ $result_to_create{$names[$index]} = $$datum[$index];
+ }
+ push @results_to_create, \%result_to_create;
+ }
+ $rs->populate(\@results_to_create);
}
=head2 exception_action
=back
Whether L</throw_exception> should include stack trace information.
-Defaults to false.
+Defaults to false normally, but defaults to true if C<$ENV{DBIC_TRACE}>
+is true.
=head2 throw_exception
Throws an exception. Defaults to using L<Carp::Clan> to report errors from
user's perspective. See L</exception_action> for details on overriding
-this method's behavior. If L</stacktrace> is turned on, C<throw_exception>
-will provide a detailed stack trace.
+this method's behavior. If L</stacktrace> is turned on, C<throw_exception>'s
+default behavior will provide a detailed stack trace.
=cut
if !$self->exception_action || !$self->exception_action->(@_);
}
-=head2 deploy (EXPERIMENTAL)
+=head2 deploy
=over 4
Attempts to deploy the schema to the current storage using L<SQL::Translator>.
-Note that this feature is currently EXPERIMENTAL and may not work correctly
-across all databases, or fully handle complex relationships. Saying that, it
-has been used successfully by many people, including the core dev team.
-
See L<SQL::Translator/METHODS> for a list of values for C<$sqlt_args>. The most
common value for this would be C<< { add_drop_table => 1, } >> to have the SQL
produced include a DROP TABLE statement for each table created.