DBIx/Class/Schema/SQLA2Support.pm

filter: Statementstmt 96.0% 24 / 25 Branchbran 66.6% 4 / 6 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 87.8% 36 / 41 CC 5 SCAR 7.2
CC
5
Cov
88%
connection
3.1
__ANON__
2.1
__ANON__
2.0
CRAP 2.1
« SQL/Abstract/Plugin/CaseExpr.pm ↑ Summary DBIx/Class/Row/SQLA2Support.pm »
1 package DBIx::Class::Schema::SQLA2Support;
2 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use parent 'DBIx::Class::Schema';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 __PACKAGE__->mk_classdata('sqla2_subclass');
6 5 __PACKAGE__->mk_classdata('sqla2_rebase_immediately');
7  
8 10 ▶sub connection {
Subroutine connection: called CC=3 SCAR=11.2
Pod documented
9 10 my ($self, @info) = @_;
10 10 $self->next::method(@info);
11 11 ▶ my $connect = sub {
Subroutine __ANON__: called CC=2 SCAR=7.6
12 11 ▶ shift->connect_call_rebase_sqlmaker($self->sqla2_subclass || 'DBIx::Class::SQLA2');
Condition50%1/2
$self->sqla2_subclass || 'DBIx::Class::SQLA2'
l!l
011
MC/DC0%0/1
$self->sqla2_subclass || 'DBIx::Class::SQLA2'
$self->sqla2_subclass
Truth table50%1/2
A
A= $self->sqla2_subclass
Aresult
11
00
13 10 };
14 9 ▶ my $details = sub {
Subroutine __ANON__: called CC=2 SCAR=7.1
15 9 my $storage = shift;
16 9 ▶ if ($storage->sql_maker->can('_connection_info')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($storage->sql_maker->can("_connection_info")) 9 0 9
17 9 $storage->sql_maker->_connection_info($storage->_describe_connection);
18 }
19 10 };
20 10 ▶ if (my $calls = $self->storage->on_connect_call) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $calls = $self->storage->on_connect_call) { } 0 10 10
21 0 $self->storage->on_connect_call([ $connect, $calls, $details ]);
22 } else {
23 10 $self->storage->on_connect_call([ $connect, $details ]);
24 }
25 10 ▶ $connect->($self->storage) if $self->sqla2_rebase_immediately;
Branch: 1 branch
BranchTrueFalseTotal
if $self->sqla2_rebase_immediately 2 8 10
26 10 return $self;
27 }
28  
29 5 1;
30  
31 =encoding utf8
32  
33 =head1 NAME
34  
35 DBIx::Class::Schema::SQLA2Support - SQL::Abstract v2 support in DBIx::Class::Schema
36  
37 =head1 SYNOPSIS
38  
39 # schema code
40 package MyApp::Schema;
41 use strict;
42 use warnings;
43 use base qw/DBIx::Class::Schema/;
44 __PACKAGE__->load_components('Schema::SQLA2Support');
45 1;
46
47 # client code
48 my $schema = MyApp::Schema->connect( ... );
49 $schema->sqla2_subclass('DBIx::Class::SQLA2');
50 $schema->sqla2_rebase_immediately(1);
51 my $rs = $schema->resultset('Album')->search(undef, {'!with' => [ ... ]});
52  
53 =head1 DESCRIPTION
54  
55 This is a work in progress for simplifying using SQLA2 with DBIC. This is for using w/ the
56 most recent version of DBIC.
57  
58 B<EXPERIMENTAL>
59  
60 =cut
« SQL/Abstract/Plugin/CaseExpr.pm ↑ Summary DBIx/Class/Row/SQLA2Support.pm »