X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema.pm;h=a1571bc259c241b998e9c0646ff995bb5cd2587c;hb=6d2e7a96f2b9f1e9f5718a421831344dcdb400a3;hp=e53d115f871d97a5f37b53899e0388d133e515ae;hpb=4981dc70e16bbd2036d351c1130b55f2d673a5f9;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index e53d115..a1571bc 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -16,7 +16,7 @@ __PACKAGE__->mk_classdata('source_registrations' => {}); __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 @@ -679,7 +679,6 @@ sub connection { my $storage = $storage_class->new($self); $storage->connect_info(\@info); $self->storage($storage); - $self->on_connect() if($self->can('on_connect')); return $self; } @@ -852,7 +851,15 @@ sub populate { } 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 @@ -896,7 +903,8 @@ Example: =back Whether L 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 @@ -908,8 +916,8 @@ Defaults to false. Throws an exception. Defaults to using L to report errors from user's perspective. See L for details on overriding -this method's behavior. If L is turned on, C -will provide a detailed stack trace. +this method's behavior. If L is turned on, C's +default behavior will provide a detailed stack trace. =cut @@ -920,7 +928,7 @@ sub throw_exception { if !$self->exception_action || !$self->exception_action->(@_); } -=head2 deploy (EXPERIMENTAL) +=head2 deploy =over 4 @@ -930,10 +938,6 @@ sub throw_exception { Attempts to deploy the schema to the current storage using L. -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 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.