line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Class::Storage::DBI::DB2; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
1655
|
use strict; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
78
|
|
4
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
78
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
13
|
use base qw/DBIx::Class::Storage::DBI/; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
311
|
|
7
|
3
|
|
|
3
|
|
18
|
use mro 'c3'; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
15
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
__PACKAGE__->datetime_parser_type('DateTime::Format::DB2'); |
10
|
|
|
|
|
|
|
__PACKAGE__->sql_quote_char ('"'); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# lazy-default kind of thing |
13
|
|
|
|
|
|
|
sub sql_name_sep { |
14
|
1
|
|
|
1
|
0
|
531
|
my $self = shift; |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
|
|
4
|
my $v = $self->next::method(@_); |
17
|
|
|
|
|
|
|
|
18
|
1
|
0
|
33
|
|
|
71
|
if (! defined $v and ! @_) { |
19
|
0
|
|
0
|
|
|
0
|
$v = $self->next::method($self->_dbh_get_info('SQL_QUALIFIER_NAME_SEPARATOR') || '.'); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
5
|
return $v; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub sql_limit_dialect { |
26
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $v = $self->next::method(@_); |
29
|
|
|
|
|
|
|
|
30
|
0
|
0
|
0
|
|
|
|
if (! defined $v and ! @_) { |
31
|
|
|
|
|
|
|
$v = $self->next::method( |
32
|
0
|
0
|
0
|
|
|
|
($self->_server_info->{normalized_dbms_version}||0) >= 5.004 |
33
|
|
|
|
|
|
|
? 'RowNumberOver' |
34
|
|
|
|
|
|
|
: 'FetchFirst' |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
return $v; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _dbh_last_insert_id { |
42
|
0
|
|
|
0
|
|
|
my ($self, $dbh, $source, $col) = @_; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
my $name_sep = $self->sql_name_sep; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my $sth = $dbh->prepare_cached( |
47
|
|
|
|
|
|
|
# An older equivalent of 'VALUES(IDENTITY_VAL_LOCAL())', for compat |
48
|
|
|
|
|
|
|
# with ancient DB2 versions. Should work on modern DB2's as well: |
49
|
|
|
|
|
|
|
# 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 |
50
|
|
|
|
|
|
|
"SELECT IDENTITY_VAL_LOCAL() FROM sysibm${name_sep}sysdummy1", |
51
|
|
|
|
|
|
|
{}, |
52
|
|
|
|
|
|
|
3 |
53
|
|
|
|
|
|
|
); |
54
|
0
|
|
|
|
|
|
$sth->execute(); |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my @res = $sth->fetchrow_array(); |
57
|
|
|
|
|
|
|
|
58
|
0
|
0
|
|
|
|
|
return @res ? $res[0] : undef; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 NAME |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
DBIx::Class::Storage::DBI::DB2 - IBM DB2 support for DBIx::Class |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 DESCRIPTION |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
This class implements autoincrements for DB2, sets the limit dialect to |
68
|
|
|
|
|
|
|
RowNumberOver over FetchFirst depending on the availability of support for |
69
|
|
|
|
|
|
|
RowNumberOver, queries the server name_sep from L and sets the L |
70
|
|
|
|
|
|
|
parser to L. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 FURTHER QUESTIONS? |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Check the list of L. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This module is free software L |
79
|
|
|
|
|
|
|
by the L. You can |
80
|
|
|
|
|
|
|
redistribute it and/or modify it under the same terms as the |
81
|
|
|
|
|
|
|
L. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# vim:sts=2 sw=2: |