| 1 | package Daje::Workflow::GenerateSQL::Script::Index; | ||||||||||
| 2 | 1 | ▶ | use Mojo::Base 'Daje::Workflow::GenerateSQL::Base::Common', -base, -signatures; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | 1 | has 'tablename' => ""; | |||||||||
| 5 | |||||||||||
| 6 | 0 | ▶ | sub create_index($self) { | ||||||||
|
Subroutine
create_index: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 7 | 0 | my $sql = ""; | |||||||||
| 8 | 0 | my $json = $self->json->{index}; | |||||||||
| 9 | 0 | my $length = scalar @{$json}; | |||||||||
| 10 | 0 | ▶ | for (my $i = 0; $i < $length; $i++) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 11 | 0 | my $template = $self->templates->get_data_section('index'); | |||||||||
| 12 | 0 | my $table_name = $self->tablename; | |||||||||
| 13 | 0 | $template =~ s/<<table>>/$table_name/ig; | |||||||||
| 14 | 0 | $template =~ s/<<type>>/@{$json}[$i]->{type}/ig; | |||||||||
| 15 | 0 | $template =~ s/<<fields>>/@{$json}[$i]->{fields}/ig; | |||||||||
| 16 | 0 | @{$json}[$i]->{fields} =~ s/,/_/ig; | |||||||||
| 17 | 0 | $template =~ s/<<field_names>>/@{$json}[$i]->{fields}/ig; | |||||||||
| 18 | 0 | $sql .= $template . ""; | |||||||||
| 19 | } | ||||||||||
| 20 | 0 | $self->set_sql($sql); | |||||||||
| 21 | 0 | return; | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | 1 | 1; | |||||||||
| 25 | |||||||||||
| 26 | |||||||||||
| 27 | |||||||||||
| 28 | |||||||||||
| 29 | |||||||||||
| 30 | #################### pod generated by Pod::Autopod - keep this line to make pod updates possible #################### | ||||||||||
| 31 | |||||||||||
| 32 | =head1 NAME | ||||||||||
| 33 | |||||||||||
| 34 | Daje::Workflow::GenerateSQL::Script::Index | ||||||||||
| 35 | |||||||||||
| 36 | |||||||||||
| 37 | =head1 DESCRIPTION | ||||||||||
| 38 | |||||||||||
| 39 | pod generated by Pod::Autopod - keep this line to make pod updates possible #################### | ||||||||||
| 40 | |||||||||||
| 41 | |||||||||||
| 42 | =head1 REQUIRES | ||||||||||
| 43 | |||||||||||
| 44 | L<Mojo::Base> | ||||||||||
| 45 | |||||||||||
| 46 | |||||||||||
| 47 | =head1 METHODS | ||||||||||
| 48 | |||||||||||
| 49 | =head2 create_index($self) | ||||||||||
| 50 | |||||||||||
| 51 | create_index($self)(); | ||||||||||
| 52 | |||||||||||
| 53 | |||||||||||
| 54 | =cut | ||||||||||
| 55 | |||||||||||