« blib/lib/SQL/Abstract/Plugin/CaseExpr.pm
↑ Summary
blib/lib/DBIx/Class/ResultSet/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 | sub connection { | ||||||||||||
| 9 | 10 | ▶ | my ($self, @info) = @_; | ||||||||||
|
Subroutine
connection: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||||
| 10 | 10 | $self->next::method(@info); | |||||||||||
| 11 | my $connect = sub { | ||||||||||||
| 12 | 11 | ▶ | shift->connect_call_rebase_sqlmaker($self->sqla2_subclass || 'DBIx::Class::SQLA2'); | ||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Condition50%1/2
$self->sqla2_subclass || 'DBIx::Class::SQLA2'
MC/DC0%0/1
$self->sqla2_subclass || 'DBIx::Class::SQLA2'
$self->sqla2_subclass
Truth table50%1/2
A
A= $self->sqla2_subclass
| |||||||||||||
| 13 | 10 | }; | |||||||||||
| 14 | my $details = sub { | ||||||||||||
| 15 | 9 | ▶ | my $storage = shift; | ||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
| |||||||||||||
| 16 | 9 | ▶ | if ($storage->sql_maker->can('_connection_info')) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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
| |||||||||||||
| 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
| |||||||||||||
| 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 | ||||||||||||