From: David Kamholz Date: Thu, 9 Mar 2006 15:25:49 +0000 (+0000) Subject: more small cleanup, rename insert_or_update to update_or_insert X-Git-Tag: v0.06000~60^2~42 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9b465d002d544e25ae5756304c4ea59577aca363;p=dbsrgits%2FDBIx-Class.git more small cleanup, rename insert_or_update to update_or_insert --- diff --git a/Changes b/Changes index 012721f..dccc6e4 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,6 @@ Revision history for DBIx::Class + - renamed insert_or_update to update_or_insert (with compat alias) - renamed cols attribute to columns (cols still supported) - added has_column_loaded to Row - Storage::DBI connect_info supports coderef returning dbh as 1st arg diff --git a/lib/DBIx/Class/Row.pm b/lib/DBIx/Class/Row.pm index 0837ba8..fd3ad13 100644 --- a/lib/DBIx/Class/Row.pm +++ b/lib/DBIx/Class/Row.pm @@ -341,15 +341,16 @@ sub inflate_result { return $new; } -=head2 insert_or_update +=head2 update_or_insert - $obj->insert_or_update + $obj->update_or_insert Updates the object if it's already in the db, else inserts it. =cut -sub insert_or_update { +*insert_or_update = \&update_or_insert; +sub update_or_insert { my $self = shift; return ($self->in_storage ? $self->update : $self->insert); } diff --git a/t/run/16joins.tl b/t/run/16joins.tl index 091cf74..49ecbcf 100644 --- a/t/run/16joins.tl +++ b/t/run/16joins.tl @@ -144,10 +144,10 @@ $trace->close; unlink 't/var/dbic.trace'; is($selects, 1, 'prefetch ran only 1 select statement'); -# test for partial prefetch via cols attr +# test for partial prefetch via columns attr my $cd = $schema->resultset('CD')->find(1, { - cols => [qw/title artist.name/], + columns => [qw/title artist.name/], join => { 'artist' => {} } } );