return $table->resultset;
}
+sub result_source {
+ my $class = shift;
+ my $table = $class->table_instance->new($class->table_instance);
+ $table->storage($class->storage_instance);
+ $table->result_class($class);
+ return $table;
+}
+
=head1 NAME
DBIx::Class::DB - Simple DBIx::Class Database connection by class inheritance
my ($self) = @_;
return $self if $self->in_storage;
#use Data::Dumper; warn Dumper($self);
- $self->storage->insert($self->_table_name, { $self->get_columns });
+ $self->result_source->storage->insert(
+ $self->_table_name, { $self->get_columns });
$self->in_storage(1);
$self->{_dirty_columns} = {};
return $self;
$self->throw( "Not in database" ) unless $self->in_storage;
my %to_update = $self->get_dirty_columns;
return -1 unless keys %to_update;
- my $rows = $self->storage->update($self->result_source->from, \%to_update,
- $self->ident_condition);
+ my $rows = $self->result_source->storage->update(
+ $self->result_source->from, \%to_update, $self->ident_condition);
if ($rows == 0) {
$self->throw( "Can't update ${self}: row not found" );
} elsif ($rows > 1) {
if (ref $self) {
$self->throw( "Not in database" ) unless $self->in_storage;
#warn $self->_ident_cond.' '.join(', ', $self->_ident_values);
- $self->storage->delete($self->result_source->from, $self->ident_condition);
+ $self->result_source->storage->delete(
+ $self->result_source->from, $self->ident_condition);
$self->in_storage(undef);
#$self->store_column($_ => undef) for $self->primary_columns;
# Should probably also arrange to trash PK if auto