X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FCDBICompat%2FLazyLoading.pm;h=add9390af0d0a5ce66d55f14bc1c7b7c536be87e;hb=1c779eb2212fac3c44e615418c2b516e18cbc5e2;hp=3c629abca639ac2f474e2d91c7ce33e96736ac63;hpb=5e8b1b2adbc7b67dc7948a41354e36ce0c7998c6;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/CDBICompat/LazyLoading.pm b/lib/DBIx/Class/CDBICompat/LazyLoading.pm index 3c629ab..add9390 100644 --- a/lib/DBIx/Class/CDBICompat/LazyLoading.pm +++ b/lib/DBIx/Class/CDBICompat/LazyLoading.pm @@ -1,4 +1,5 @@ -package DBIx::Class::CDBICompat::LazyLoading; +package # hide from PAUSE + DBIx::Class::CDBICompat::LazyLoading; use strict; use warnings; @@ -21,6 +22,33 @@ sub get_column { $self->next::method(@_[1..$#_]); } +# CDBI does not explicitly declare auto increment columns, so +# we just clear out our primary columns before copying. +sub copy { + my($self, $changes) = @_; + + for my $col ($self->primary_columns) { + $changes->{$col} = undef unless exists $changes->{$col}; + } + + return $self->next::method($changes); +} + +sub discard_changes { + my($self) = shift; + + delete $self->{_column_data}{$_} for $self->is_changed; + delete $self->{_dirty_columns}; + delete $self->{_relationship_data}; + + return $self; +} + +sub _ident_cond { + my ($class) = @_; + return join(" AND ", map { "$_ = ?" } $class->primary_columns); +} + sub _flesh { my ($self, @groups) = @_; @groups = ('All') unless @groups;