| 1 | package blx::xsdsql::generator::sql::DBM::handle::create_table; | ||
| 2 | use strict; # use strict is for PBP | ||
| 3 | use Filter::Include; | ||
| 4 | include blx::xsdsql::include; | ||
| 5 | #line 6 | ||
| 6 | |||
| 7 | use blx::xsdsql::ut::ut qw(nvl); | ||
| 8 | |||
| 9 | use base qw(blx::xsdsql::generator::sql::generic::handle::create_table); | ||
| 10 | |||
| 11 | |||
| 12 | sub table_header { | ||
| 13 | my ($self,$table,%params)=@_; | ||
| 14 | unless (defined $table->get_attrs_value(qw(_PK_DUMMY))) { | ||
| 15 | my @pk_cols=$table->get_pk_columns; | ||
| 16 | if (scalar(@pk_cols) > 1) { | ||
| 17 | affirm { defined $params{EXTRA_TABLES} } "param EXTRA_TABLES not set"; | ||
| 18 | my $extra_tables=$params{EXTRA_TABLES}; | ||
| 19 | my @cols=$table->reset_columns; | ||
| 20 | my $pk_col=$extra_tables->factory_pk_col; | ||
| 21 | $table->add_columns($pk_col,@cols); | ||
| 22 | $table->set_attrs_value(_PK_DUMMY => 1); | ||
| 23 | } | ||
| 24 | else { | ||
| 25 | $table->set_attrs_value(_PK_DUMMY => 0); | ||
| 26 | } | ||
| 27 | } | ||
| 28 | return $self->SUPER::table_header($table,%params); | ||
| 29 | } | ||
| 30 | |||
| 31 | |||
| 32 | 1; | ||
| 33 | |||
| 34 | __END__ |