blib/lib/DB/Introspector/SQLGen/Oracle/TypeMapper.pm untested

filter: Statementstmt 0.0% 0 / 26 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 44 CC 3 SCAR 12.8
CC
3
Cov
0%
stringify_integer
6.0
stringify_string
6.0
stringify_date
2.0
CRAP 3.6
1 package DB::Introspector::SQLGen::Oracle::TypeMapper;
2  
3 use strict;
4 use base qw( DB::Introspector::SQLGen::TypeMapper );
5  
6  
7 sub stringify_integer {
8 my $self = shift;
9 my $column = shift;
10  
11  
12 # oracle integers can be limited by the number of characters in its decimal
13 # representation.
14 my $max_length = $column->max;
15  
16 # TODO: add support for providing further limitations on the acceptable
17 # integers
18  
19 return 'NUMBER'. (defined($max_length) ? '('.length($max_length).')' : '');
20 }
21  
22 sub stringify_string {
23 my $self = shift;
24 my $column = shift;
25  
26 my $max_length = $column->max_length;
27  
28 # TODO: add support for providing further limitations on the acceptable
29 # integers
30  
31 return 'VARCHAR2'. (defined($max_length) ? "($max_length)" : '');
32 }
33  
34 sub stringify_date {
35 my $self = shift;
36 my $column = shift;
37  
38 return 'DATE';
39 }
40  
41 sub stringify_clob {
42 my $self = shift;
43 my $column = shift;
44  
45 return 'CLOB';
46 }
47  
48  
49 sub stringify_char {
50 my $self = shift;
51 my $column = shift;
52  
53 # TODO: add support for a specific set of characters
54 return 'CHAR';
55 }
56  
57 sub stringify_boolean {
58 my $self = shift;
59 my $column = shift;
60  
61 # TODO: add support for better boolean simulation
62 return 'CHAR';
63 }
64  
65  
66 1;