blib/lib/AutoSQL/Schema.pm untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 41 CC 2 SCAR 11.0
CC
2
Cov
0%
get_table_model
6.0
_initialize
2.0
BEGIN
2.0
CRAP 3.0
1 package AutoSQL::Schema;
2 use strict;
3 use vars qw(@ISA);
4 use AutoCode::Schema;
5 our @ISA=qw(AutoCode::Schema);
6 use AutoSQL::TableModel;
7  
8 use AutoCode::AccessorMaker('$'=>[qw(tables module_table_map)]);
9  
10 sub _initialize {
11 my ($self, @args)=@_;
12 $self->SUPER::_initialize(@args);
13
14 my ($tables, $module_table_map)=
15 $self->_rearrange( [qw(TABLES MODULE_TABLE_MAP )], @args);
16
17 $self->tables($tables);
18 $self->module_table_map($module_table_map);
19 }
20  
21 # This method is to be replaced with $module_table map in schema.
22 our %TABLE_MODELS;
23 sub get_table_model {
24 my ($self, $type)=@_;
25 return $TABLE_MODELS{$type} if exists $TABLE_MODELS{$type};
26 my $model = AutoSQL::TableModel->new(
27 -schema => $self,
28 -type => $type
29 );
30 $TABLE_MODELS{$type}=$model;
31 return $model;
32 }
33  
34 1;