line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DataWarehouse::Dimension; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1873
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
70
|
|
7
|
1
|
|
|
1
|
|
6
|
use Data::Dumper; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
8
|
1
|
|
|
1
|
|
579
|
use DBI; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
|
|
|
|
|
|
my ( $class, %params ) = @_; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
croak "Error: One of 'dbh' or 'dsn' parameters is required" if !($params{dbh} xor $params{dsn}); |
16
|
|
|
|
|
|
|
croak "Error: missing dimension name" if !$params{name}; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
if ( $params{dsn} ) { |
19
|
|
|
|
|
|
|
$params{dbh} = DBI->connect( $params{dsn}, $params{db_user}, $params{db_password} ),; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
bless {%params}, $class; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub column_names { |
26
|
|
|
|
|
|
|
my ($self) = @_; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $table = $self->{name}; |
29
|
|
|
|
|
|
|
warn $table; |
30
|
|
|
|
|
|
|
my $columns = $self->{dbh}->column_info( undef, undef, $table, '%' )->fetchall_arrayref(); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my @column_names = map { $_->[3] } @{$columns}; |
33
|
|
|
|
|
|
|
return wantarray ? @column_names : \@column_names; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |