From: Amiri Barksdale at Home Date: Sat, 14 Aug 2010 05:12:03 +0000 (-0700) Subject: Adding 'RETURNING *' to each body_part. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=85c5d43ce43e352a8fe4440642b526fd3dc3feec;p=dbsrgits%2FDBIx-Class-ResultSource-MultipleTableInheritance.git Adding 'RETURNING *' to each body_part. --- diff --git a/lib/DBIx/Class/ResultSource/MultipleTableInheritance.pm b/lib/DBIx/Class/ResultSource/MultipleTableInheritance.pm index 9dceab6..d07c74a 100644 --- a/lib/DBIx/Class/ResultSource/MultipleTableInheritance.pm +++ b/lib/DBIx/Class/ResultSource/MultipleTableInheritance.pm @@ -278,6 +278,7 @@ BEGIN { *function_body = sub { my ($name,$args,$body_parts) = @_; + $body_parts = [ map {$_ .= ' RETURNING *'} @$body_parts ]; my $arglist = join( ', ', map "_${\$_->{name}} ${\uc($_->{data_type})}", diff --git a/t/01load.t b/t/01load.t index 97c839b..664c2c5 100644 --- a/t/01load.t +++ b/t/01load.t @@ -2,7 +2,6 @@ use strict; use warnings; use lib 't/lib'; use Test::More qw(no_plan); -#use Carp::Always; BEGIN { use_ok 'MTITest'; } diff --git a/t/02view_def.t b/t/02view_def.t index 35e0bd7..2829ff0 100644 --- a/t/02view_def.t +++ b/t/02view_def.t @@ -8,7 +8,7 @@ use Devel::Dwarn; BEGIN { use_ok 'MTITest'; - $ENV{DBIC_TRACE} = 1; + #$ENV{DBIC_TRACE} = 1; } dies_ok { MTITest->source('Foo')->view_definition } @@ -17,13 +17,8 @@ dies_ok { MTITest->source('Foo')->view_definition } #my $schema = MTITest->connect('dbi:SQLite::memory:'); my $schema = MTITest->connect( 'dbi:Pg:dbname=mti', 'postgres', '' ); -diag(DwarnS $schema); -#diag("MTITest view definition: ", $schema->resultset('Bar')->result_source->view_definition); my $dir = "t/sql"; # tempdir(CLEANUP => 0); $schema->create_ddl_dir( ['PostgreSQL'], 0.1, $dir ); $schema->deploy( { add_drop_table => 1, add_drop_view => 1 } ); - -#diag DwarnS $schema->source($_)->view_definition for qw(Foo Bar); -#diag DwarnS $schema->source($_) for qw(Foo Bar); diff --git a/t/03cafe.t b/t/03cafe.t index 6293ba2..3f9a218 100644 --- a/t/03cafe.t +++ b/t/03cafe.t @@ -1,47 +1,31 @@ use strict; use warnings; use lib 't/lib'; -use Test::More; +use Test::More qw(no_plan); use Test::Exception; use Devel::Dwarn; BEGIN { use_ok 'Cafe'; - $ENV{DBIC_TRACE} = 1; + #$ENV{DBIC_TRACE} = 1; } my $schema = Cafe->connect( 'dbi:Pg:dbname=cafe', 'postgres', '' ); -#diag( DwarnS $schema); - -#diag(Dwarn $schema->source('Sumatra')); -#diag(ref($schema->source('Sumatra'))); isa_ok($schema->source('Sumatra'), 'DBIx::Class::ResultSource::View', "My MTI class also"); - -my $dir = "t/sql"; # tempdir(CLEANUP => 0); -$schema->create_ddl_dir( ['PostgreSQL'], 0.1, $dir ); - - - - +#my $dir = "t/sql"; # tempdir(CLEANUP => 0); +#$schema->create_ddl_dir( ['PostgreSQL'], 0.1, $dir ); $schema->deploy( { add_drop_table => 1, add_drop_view => 1 } ); my $drink = $schema->resultset('Sumatra') ->create( { sweetness => 4, aroma => 'earthy', flavor => 'great' } ); -my $cup = $schema->resultset('Coffee'); - -diag(Dwarn $cup->result_source->columns); -diag(Dwarn $schema->resultset('Sumatra')->result_source->columns); -#my $drink = $schema->resultset('Sumatra')->new_result({sweetness => 6, aroma => 'chocolate'}); -ok($drink, "made new drink OK"); -$drink->insert; -diag(Dwarn $drink->result_source->columns); - -diag(Dwarn mro::get_linear_isa $drink); +#my $cup = $schema->resultset('Coffee'); -$drink->insert_or_update; +##my $drink = $schema->resultset('Sumatra')->new_result({sweetness => 6, aroma => 'chocolate'}); +#ok($drink, "made new drink OK"); +#$drink->insert; -done_testing; +#$drink->insert_or_update;