PK
Row
TableInstance
- ResultSetInstance
Exception
AccessorGroup/);
use DBIx::Class::ClassResolver::PassThrough;
use DBI;
+__PACKAGE__->load_components(qw/ResultSetInstance/);
+
*dbi_commit = \&txn_commit;
*dbi_rollback = \&txn_rollback;
+sub storage { shift->storage_instance(@_); }
+
=head1 NAME
DBIx::Class::DB - Simple DBIx::Class Database connection by class inheritance
=cut
-__PACKAGE__->mk_classdata('storage');
__PACKAGE__->mk_classdata('class_resolver' =>
'DBIx::Class::ClassResolver::PassThrough');
my ($class, @info) = @_;
my $storage = DBIx::Class::Storage::DBI->new;
$storage->connect_info(\@info);
- $class->storage($storage);
+ $class->mk_classdata('storage_instance' => $storage);
}
=head2 txn_begin
sub count { shift->resultset_instance->count(@_); }
sub count_literal { shift->resultset_instance->count_literal(@_); }
-__PACKAGE__->mk_classdata('resultset_instance');
-
1;
sub resultset_instance {
my $class = shift;
my $table = $class->table_instance->new($class->table_instance);
- $table->storage($class->storage);
+ $table->storage($class->storage_instance);
$table->result_class($class);
return $table->resultset;
}
sub insert {
my ($self) = @_;
+ warn "Got here";
for my $column (@{$self->uuid_auto_columns}) {
$self->store_column( $column, $self->get_uuid )
unless defined $self->get_column( $column );
plan tests => 3;
-DBICTest::CD->inflate_column( 'year',
+DBICTest::Schema::CD->inflate_column( 'year',
{ inflate => sub { DateTime->new( year => shift ) },
deflate => sub { shift->year } }
);
+Class::C3->reinitialize;
# inflation test
my $cd = DBICTest::CD->find(3);
plan tests => 6;
-DBICTest::CD->load_components(qw/CDBICompat::HasA/);
+DBICTest::Schema::CD->load_components(qw/CDBICompat::HasA/);
-DBICTest::CD->has_a( 'year', 'DateTime',
+DBICTest::Schema::CD->has_a( 'year', 'DateTime',
inflate => sub { DateTime->new( year => shift ) },
deflate => sub { shift->year }
);
+Class::C3->reinitialize;
# inflation test
my $cd = DBICTest::CD->find(3);
or plan skip_all, 'Install Data::UUID run this test';
plan tests => 1;
-DBICTest::Artist->load_components('UUIDColumns');
-DBICTest::Artist->uuid_columns('name');
+DBICTest::Schema::Artist->load_components('UUIDColumns');
+DBICTest::Schema::Artist->uuid_columns('name');
+Class::C3->reinitialize();
my $artist = DBICTest::Artist->create( { artistid => 100 } );
like $artist->name, qr/[\w-]{36}/, 'got something like uuid';