DB2/SQLMaker.pm

filter: Statementstmt 71.4% 10 / 14 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 66.6% 14 / 21 CC 2 SCAR 11.0
CC
2
Cov
62%
apply_limit
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« DB2/Type.pm ↑ Summary DB2/Introspect.pm »
1 package DBIO::DB2::SQLMaker;
2 # ABSTRACT: SQL dialect for IBM DB2
3  
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use base 'DBIO::SQLMaker';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9  
10 0 ▶sub apply_limit {
Subroutine apply_limit: not called CC=2 SCAR=17.9
Pod documented
11 0 my ($self, $sql, $rs_attrs, $rows, $offset) = @_;
12  
13 # DB2 5.4+ uses ROW_NUMBER() OVER() for offset support
14 # Older DB2 uses FETCH FIRST n ROWS ONLY (no offset support, requires subquery)
15 0 ▶ if ($offset) {
Branch: 1 branch
BranchTrueFalseTotal
if ($offset) 0 0 0
16 0 return $self->_RowNumberOver($sql, $rs_attrs, $rows, $offset);
17 }
18 0 return $self->_FetchFirst($sql, $rs_attrs, $rows, $offset);
19 }
20  
21 1 1;
22  
23 __END__
24  
25 =pod
26  
27 =encoding UTF-8
28  
29 =head1 NAME
30  
31 DBIO::DB2::SQLMaker - SQL dialect for IBM DB2
32  
33 =head1 VERSION
34  
35 version 0.900001
36  
37 =head1 DESCRIPTION
38  
39 DB2-specific SQL dialect. Its C<apply_limit> branches on whether the query has
40 an offset: C<ROW_NUMBER() OVER()> when an offset is present (the only DB2 form
41 that can skip a prefix), C<FETCH FIRST n ROWS ONLY> otherwise. This is an
42 offset-based branch, not server-version detection. See ADR 0003.
43  
44 =head1 AUTHOR
45  
46 DBIO & DBIx::Class Authors
47  
48 =head1 COPYRIGHT AND LICENSE
49  
50 Copyright (C) 2026 DBIO Authors
51 Portions Copyright (C) 2005-2025 DBIx::Class Authors
52 Based on DBIx::Class, heavily modified.
53  
54 This is free software; you can redistribute it and/or modify it under
55 the same terms as the Perl 5 programming language system itself.
56  
57 =cut
« DB2/Type.pm ↑ Summary DB2/Introspect.pm »