1 package DBIx::Class::CDBICompat::Convenience;
8 my $hash = ref $_[0] eq "HASH" ? shift: {@_};
9 my ($exists) = $class->search($hash);
10 return defined($exists) ? $exists : $class->create($hash);
15 die "Can't call id() as a class method" unless ref $self;
16 my @pk = $self->_ident_values;
17 return (wantarray ? @pk : $pk[0]);
22 # $self->NEXT::insert(@_);
23 # my @pk = keys %{ $self->_primaries };
24 # if ((@pk == 1) && (!$self->{_column_data}{$pk[0]})) {
25 # $self->{_column_data}{$pk[0]} = $self->_get_dbh->last_insert_id;
32 return $class->retrieve_from_sql( '1' );