DBIx/Class/Storage/DBI/DB2.pm

filter: Statementstmt 67.5% 25 / 37 Branchbran 12.5% 1 / 8 Conditioncond 10.0% 1 / 10 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 77.7% 7 / 9 Podpod 50.0% 1 / 2 totaltotal 48.6% 35 / 72 CC 9 SCAR 24.2
CC
9
Cov
49%
sql_limit_dialect
30.0
sql_name_sep
6.0
_dbh_last_insert_id
6.0
CRAP 11.3
« DBIx/Class/ResultSourceProxy/Table.pm ↑ Summary DBIx/Class/Carp.pm »
1 package DBIx::Class::Storage::DBI::DB2;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use base qw/DBIx::Class::Storage::DBI/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use mro 'c3';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 __PACKAGE__->datetime_parser_type('DateTime::Format::DB2');
12 2 __PACKAGE__->sql_quote_char ('"');
13  
14 # lazy-default kind of thing
15 sub sql_name_sep {
16 1 ▶ my $self = shift;
Subroutine sql_name_sep: called CC=4 SCAR=17.9
Pod undocumented
17  
18 1 my $v = $self->next::method(@_);
19  
20 1 ▶ if (! defined $v and ! @_) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $v or @_) 0 1 1
Condition33%1/3
defined $v or @_
l!l&&r!l&&!r
100
MC/DC0%0/2
defined $v or @_
defined $v @_
Truth table33%1/3
A or B
A= defined $vB= @_
ABresult
1X1
011
000
21 0 ▶ $v = $self->next::method($self->_dbh_get_info('SQL_QUALIFIER_NAME_SEPARATOR') || '.');
Condition0%0/2
$self->_dbh_get_info('SQL_QUALIFIER_NAME_SEPARATOR') || '.'
l!l
00
MC/DC0%0/1
$self->_dbh_get_info('SQL_QUALIFIER_NAME_SEPARATOR') || '.'
$self->_dbh_get_info('SQL_QUALIFIER_NAME_SEPARATOR')
Truth table0%0/2
A
A= $self->_dbh_get_info('SQL_QUALIFIER_NAME_SEPARATOR')
Aresult
11
00
22 }
23  
24 1 return $v;
25 }
26  
27 sub sql_limit_dialect {
28 0 ▶ my $self = shift;
Subroutine sql_limit_dialect: not called CC=5 SCAR=34.0
Pod documented
29  
30 0 my $v = $self->next::method(@_);
31  
32 0 ▶ if (! defined $v and ! @_) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $v or @_) 0 0 0
Condition0%0/3
defined $v or @_
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $v or @_
defined $v @_
Truth table0%0/3
A or B
A= defined $vB= @_
ABresult
1X1
011
000
33 $v = $self->next::method(
34 0 ▶ ($self->_server_info->{normalized_dbms_version}||0) >= 5.004
Branch: 1 branch
BranchTrueFalseTotal
($self->_server_info->{'normalized_dbms_version'} || 0) >= 5.004 ? : 0 0 0
Condition0%0/2
$self->_server_info->{'normalized_dbms_version'} || 0
l!l
00
MC/DC0%0/1
$self->_server_info->{'normalized_dbms_version'} || 0
$self->_server_info->{'normalized_dbms_version'}
Truth table0%0/2
A
A= $self->_server_info->{'normalized_dbms_version'}
Aresult
11
00
35 ? 'RowNumberOver'
36 : 'FetchFirst'
37 );
38 }
39  
40 0 return $v;
41 }
42  
43 sub _dbh_last_insert_id {
44 0 ▶ my ($self, $dbh, $source, $col) = @_;
Subroutine _dbh_last_insert_id: not called CC=2 SCAR=17.9
45  
46 0 my $name_sep = $self->sql_name_sep;
47  
48 0 my $sth = $dbh->prepare_cached(
49 # An older equivalent of 'VALUES(IDENTITY_VAL_LOCAL())', for compat
50 # with ancient DB2 versions. Should work on modern DB2's as well:
51 # http://publib.boulder.ibm.com/infocenter/db2luw/v8/topic/com.ibm.db2.udb.doc/admin/r0002369.htm?resultof=%22%73%79%73%64%75%6d%6d%79%31%22%20
52 "SELECT IDENTITY_VAL_LOCAL() FROM sysibm${name_sep}sysdummy1",
53 {},
54 3
55 );
56 0 $sth->execute();
57  
58 0 my @res = $sth->fetchrow_array();
59  
60 0 ▶ return @res ? $res[0] : undef;
Branch: 1 branch
BranchTrueFalseTotal
@res ? : 0 0 0
61 }
62  
63 2 1;
64  
65 =head1 NAME
66  
67 DBIx::Class::Storage::DBI::DB2 - IBM DB2 support for DBIx::Class
68  
69 =head1 DESCRIPTION
70  
71 This class implements autoincrements for DB2, sets the limit dialect to
72 RowNumberOver over FetchFirst depending on the availability of support for
73 RowNumberOver, queries the server name_sep from L<DBI> and sets the L<DateTime>
74 parser to L<DateTime::Format::DB2>.
75  
76 =head1 AUTHOR
77  
78 See L<DBIx::Class/AUTHOR> and L<DBIx::Class/CONTRIBUTORS>.
79  
80 =head1 LICENSE
81  
82 You may distribute this code under the same terms as Perl itself.
83  
84 =cut
85 # vim:sts=2 sw=2:
« DBIx/Class/ResultSourceProxy/Table.pm ↑ Summary DBIx/Class/Carp.pm »