line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Class::Schema::SQLA2Support; |
2
|
5
|
|
|
5
|
|
1128399
|
use strict; |
|
5
|
|
|
|
|
40
|
|
|
5
|
|
|
|
|
147
|
|
3
|
5
|
|
|
5
|
|
27
|
use warnings; |
|
5
|
|
|
|
|
19
|
|
|
5
|
|
|
|
|
128
|
|
4
|
5
|
|
|
5
|
|
26
|
use parent 'DBIx::Class::Schema'; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
32
|
|
5
|
|
|
|
|
|
|
__PACKAGE__->mk_classdata('sqla2_subclass'); |
6
|
|
|
|
|
|
|
__PACKAGE__->mk_classdata('sqla2_rebase_immediately'); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub connection { |
9
|
10
|
|
|
10
|
1
|
80607
|
my ($self, @info) = @_; |
10
|
10
|
|
|
|
|
76
|
$self->next::method(@info); |
11
|
|
|
|
|
|
|
my $connect = sub { |
12
|
11
|
|
50
|
11
|
|
217803
|
shift->connect_call_rebase_sqlmaker($self->sqla2_subclass || 'DBIx::Class::SQLA2'); |
13
|
10
|
|
|
|
|
401470
|
}; |
14
|
|
|
|
|
|
|
my $details = sub { |
15
|
9
|
|
|
9
|
|
4100
|
my $storage = shift; |
16
|
9
|
50
|
|
|
|
277
|
if ($storage->sql_maker->can('_connection_info')) { |
17
|
9
|
|
|
|
|
298
|
$storage->sql_maker->_connection_info($storage->_describe_connection); |
18
|
|
|
|
|
|
|
} |
19
|
10
|
|
|
|
|
80
|
}; |
20
|
10
|
50
|
|
|
|
230
|
if (my $calls = $self->storage->on_connect_call) { |
21
|
0
|
|
|
|
|
0
|
$self->storage->on_connect_call([ $connect, $calls, $details ]); |
22
|
|
|
|
|
|
|
} else { |
23
|
10
|
|
|
|
|
1489
|
$self->storage->on_connect_call([ $connect, $details ]); |
24
|
|
|
|
|
|
|
} |
25
|
10
|
100
|
|
|
|
407
|
$connect->($self->storage) if $self->sqla2_rebase_immediately; |
26
|
10
|
|
|
|
|
1798
|
return $self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
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 |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |