File Coverage

blib/lib/DBIx/Class/Schema/SQLA2Support.pm
Criterion Covered Total %
statement 17 18 94.4
branch 3 4 75.0
condition 1 2 50.0
subroutine 5 5 100.0
pod 1 1 100.0
total 27 30 90.0


line stmt bran cond sub pod time code
1             package DBIx::Class::Schema::SQLA2Support;
2 4     4   770248 use strict;
  4         27  
  4         112  
3 4     4   27 use warnings;
  4         10  
  4         102  
4 4     4   34 use parent 'DBIx::Class::Schema';
  4         8  
  4         46  
5             __PACKAGE__->mk_classdata('sqla2_subclass');
6             __PACKAGE__->mk_classdata('sqla2_rebase_immediately');
7              
8             sub connection {
9 9     9 1 59007 my ($self, @info) = @_;
10 9         75 $self->next::method(@info);
11             my $connect = sub {
12 10   50 10   171484 shift->connect_call_rebase_sqlmaker($self->sqla2_subclass || 'DBIx::Class::SQLA2');
13 9         315393 };
14 9 50       196 if (my $calls = $self->storage->on_connect_call) {
15 0         0 $self->storage->on_connect_call([ $connect, $calls ]);
16             } else {
17 9         1092 $self->storage->on_connect_call([$connect]);
18             }
19 9 100       360 $connect->($self->storage) if ($self->sqla2_rebase_immediately);
20 9         1537 return $self;
21             }
22              
23             1;
24              
25             =encoding utf8
26              
27             =head1 NAME
28              
29             DBIx::Class::Schema::SQLA2Support - SQL::Abstract v2 support in DBIx::Class::Schema
30              
31             =head1 SYNOPSIS
32              
33             # schema code
34             package MyApp::Schema;
35             use strict;
36             use warnings;
37             use base qw/DBIx::Class::Schema/;
38             __PACKAGE__->load_components('Schema::SQLA2Support');
39             1;
40            
41             # client code
42             my $schema = MyApp::Schema->connect( ... );
43             $schema->sqla2_subclass('DBIx::Class::SQLA2');
44             $schema->sqla2_rebase_immediately(1);
45             my $rs = $schema->resultset('Album')->search(undef, {'!with' => [ ... ]});
46              
47             =head1 DESCRIPTION
48              
49             This is a work in progress for simplifying using SQLA2 with DBIC. This is for using w/ the
50             most recent version of DBIC.
51              
52             B
53              
54             =cut