« blib/lib/blx/xsdsql/generator/sql/mysql/handle/create_extra_tables.pm
↑ Summary
blib/lib/blx/xsdsql/generator/sql/mysql/handle/create_table.pm »
| 1 | package blx::xsdsql::generator::sql::mysql::handle::create_sequence; | ||
| 2 | use strict; # use strict is for PBP | ||
| 3 | use Filter::Include; | ||
| 4 | include blx::xsdsql::include; | ||
| 5 | #line 6 | ||
| 6 | use base qw(blx::xsdsql::generator::sql::generic::handle::create_sequence); | ||
| 7 | |||
| 8 | sub _sql_create_sequence { | ||
| 9 | my ($self,$table,%params)=@_; | ||
| 10 | affirm { ref($table) =~/::extra_tables/ } ref($table).": 1^ param must be extra_tables class"; | ||
| 11 | my $name=$table->get_sequence_name(%params); | ||
| 12 | my $list={}; | ||
| 13 | my $t=$table->get_attrs_value(qw(TABLE_CLASS))->new(NAME => $name); | ||
| 14 | $t->set_sql_name(TABLENAME_LIST => $list); | ||
| 15 | my @cols=( | ||
| 16 | $table->factory_column(qw(ID),COMMENT => 'last sequence used') | ||
| 17 | ); | ||
| 18 | $t->add_columns(@cols); | ||
| 19 | my $sql='create table %n ( '.join(',',map { $_->get_sql_name.' '.$_->get_sql_type } @cols).')'; | ||
| 20 | return $sql; | ||
| 21 | } | ||
| 22 | |||
| 23 | 1; | ||
| 24 | |||
| 25 | |||
| 26 | __END__ |