blib/lib/blx/xsdsql/schema_repository/sql/DBM/extra_tables.pm untested

filter: Statementstmt 0.0% 0 / 49 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 72 CC 5 SCAR 16.2
CC
5
Cov
0%
_factory_extra_table_columns
12.0
get_predefined_type
6.0
get_predefined_column_attrs
6.0
CRAP 5.1
1 package blx::xsdsql::schema_repository::sql::DBM::extra_tables;
2  
3 use strict; # use strict is for PBP
4 use Filter::Include;
5 include blx::xsdsql::include;
6 #line 7
7  
8 use blx::xsdsql::xsd_parser::type::simple;
9 use base qw(blx::xsdsql::schema_repository::sql::generic::extra_tables);
10  
11 use constant {
12 PK_AUTOSEQUENCE_TYPE => { XSD_TYPE => 'integer',LIMITS => { INT => 18} }
13 ,DUMMY_COL_TYPE => { XSD_TYPE => 'string',LIMITS => { SIZE => 1} }
14 };
15  
16 use constant {
17 PREDEF_TYPES => {
18 PK_AUTOSEQUENCE_TYPE => PK_AUTOSEQUENCE_TYPE
19 ,DUMMY_COL_TYPE => DUMMY_COL_TYPE
20 }
21
22 };
23
24 use constant {
25 PREDEF_COLUMNS => {
26 PK_AUTOSEQUENCE => {
27 NAME => '$PK'
28 ,MINOCCURS => 1
29 ,MAXOCCURS => 1
30 ,PK_SEQ => undef
31 ,TYPE => PK_AUTOSEQUENCE_TYPE
32 ,PK_AUTOSEQUENCE => 1
33 }
34 ,DUMMY_COL => {
35 NAME => '$DUMMY'
36 ,MINOCCURS => 1
37 ,MAXOCCURS => 1
38 ,TYPE => DUMMY_COL_TYPE
39 ,COMMENT => 'dummy column'
40 }
41 }
42 };
43
44 sub factory_pk_col {
45 my ($self,%params)=@_;
46 my $col=$self->factory_column(qw(PK_AUTOSEQUENCE));
47 return $col;
48 }
49  
50 sub get_predefined_type {
51 my ($self,$code,%params)=@_;
52 affirm { defined $code } "1^ param not set";
53 if ($code eq 'PK_AUTOSEQUENCE_TYPE') {
54 my $t=PREDEF_TYPES->{$code};
55 affirm { defined $t } "$code: 1^ param value not know";
56 return blx::xsdsql::xsd_parser::type::simple->new(%$t,COLUMN => $params{COLUMN});
57 }
58 return $self->SUPER::get_predefined_type($code,%params);
59 }
60  
61 sub get_predefined_column_attrs {
62 my ($self,$code,%params)=@_;
63 affirm { defined $code } "1^ param not set";
64 if (defined (my $t=PREDEF_COLUMNS->{$code})) {
65 return $t;
66 }
67 return $self->SUPER::get_predefined_column_attrs($code,%params);
68 }
69  
70 sub _factory_extra_table_columns {
71 my ($self,$table_type,%params)=@_;
72 my @cols=$self->SUPER::_factory_extra_table_columns($table_type);
73 return @cols if grep($table_type eq $_,qw(XML_CATALOG XML_ENCODING XML_ID));
74 @cols=(
75 $self->factory_pk_col(%params)
76 ,@cols
77 );
78 return @cols if $table_type ne 'COLUMN_DICTIONARY';
79 push @cols,$self->factory_column(undef,NAME => 'pk_autosequence',TYPE => $self->get_predefined_type(qw(BOOLEAN_TYPE)));
80 return @cols;
81 }
82  
83 1;
84  
85  
86 __END__