8 |
8 |
use SL::DB::CsvImportReport;
|
9 |
9 |
use SL::DB::Unit;
|
10 |
10 |
use SL::DB::Helper::Paginated ();
|
|
11 |
use SL::DBUtils qw(do_statement);
|
11 |
12 |
use SL::Helper::Flash;
|
12 |
13 |
use SL::Locale::String;
|
13 |
14 |
use SL::SessionFile;
|
... | ... | |
544 |
545 |
push @raw_methods, $self->raw_data_headers->{headers}->[$i];
|
545 |
546 |
}
|
546 |
547 |
|
547 |
|
$sth->execute($report->id, $_, 0, $headers[$_]) for 0 .. $#headers;
|
|
548 |
do_statement($::form, $sth, $query, $report->id, $_, 0, $headers[$_]) for 0 .. $#headers;
|
548 |
549 |
|
549 |
550 |
# col offsets
|
550 |
551 |
my $o1 = @info_methods;
|
... | ... | |
554 |
555 |
$self->track_progress(progress => $row / @{ $self->data } * 100) if $row % 1000 == 0;
|
555 |
556 |
my $data_row = $self->{data}[$row];
|
556 |
557 |
|
557 |
|
$sth->execute($report->id, $_, $row + 1, $data_row->{info_data}{ $info_methods[$_] }) for 0 .. $#info_methods;
|
558 |
|
$sth->execute($report->id, $o1 + $_, $row + 1, $data_row->{object}->${ \ $methods[$_] }) for 0 .. $#methods;
|
559 |
|
$sth->execute($report->id, $o2 + $_, $row + 1, $data_row->{raw_data}{ $raw_methods[$_] }) for 0 .. $#raw_methods;
|
|
558 |
do_statement($::form, $sth, $query, $report->id, $_, $row + 1, $data_row->{info_data}{ $info_methods[$_] }) for 0 .. $#info_methods;
|
|
559 |
do_statement($::form, $sth, $query, $report->id, $o1 + $_, $row + 1, $data_row->{object}->${ \ $methods[$_] }) for 0 .. $#methods;
|
|
560 |
do_statement($::form, $sth, $query, $report->id, $o2 + $_, $row + 1, $data_row->{raw_data}{ $raw_methods[$_] }) for 0 .. $#raw_methods;
|
560 |
561 |
|
561 |
|
$sth2->execute($report->id, $row + 1, 'information', $_) for @{ $data_row->{information} || [] };
|
562 |
|
$sth2->execute($report->id, $row + 1, 'errors', $_) for @{ $data_row->{errors} || [] };
|
|
562 |
do_statement($::form, $sth2, $query2, $report->id, $row + 1, 'information', $_) for @{ $data_row->{information} || [] };
|
|
563 |
do_statement($::form, $sth2, $query2, $report->id, $row + 1, 'errors', $_) for @{ $data_row->{errors} || [] };
|
563 |
564 |
}
|
564 |
565 |
1;
|
565 |
566 |
}) or do { die SL::DB->client->error };
|
... | ... | |
623 |
624 |
|
624 |
625 |
for my $i (0 .. $#{ $self->worker->profile }) {
|
625 |
626 |
my $row_ident = $self->worker->profile->[$i]->{row_ident};
|
626 |
|
$sth->execute($report->id, $_, $i, $headers->{$row_ident}->[$_]) for 0 .. $#{ $headers->{$row_ident} };
|
|
627 |
do_statement($::form, $sth, $query, $report->id, $_, $i, $headers->{$row_ident}->[$_]) for 0 .. $#{ $headers->{$row_ident} };
|
627 |
628 |
}
|
628 |
629 |
|
629 |
630 |
# col offsets
|
... | ... | |
647 |
648 |
my $o1 = $off1->{$row_ident};
|
648 |
649 |
my $o2 = $off2->{$row_ident};
|
649 |
650 |
|
650 |
|
$sth->execute($report->id, $_, $row + $n_header_rows, $data_row->{info_data}{ $info_methods->{$row_ident}->[$_] }) for 0 .. $#{ $info_methods->{$row_ident} };
|
651 |
|
$sth->execute($report->id, $o1 + $_, $row + $n_header_rows, $data_row->{object}->${ \ $methods->{$row_ident}->[$_] }) for 0 .. $#{ $methods->{$row_ident} };
|
652 |
|
$sth->execute($report->id, $o2 + $_, $row + $n_header_rows, $data_row->{raw_data}{ $raw_methods->{$row_ident}->[$_] }) for 0 .. $#{ $raw_methods->{$row_ident} };
|
|
651 |
do_statement($::form, $sth, $query, $report->id, $_, $row + $n_header_rows, $data_row->{info_data}{ $info_methods->{$row_ident}->[$_] }) for 0 .. $#{ $info_methods->{$row_ident} };
|
|
652 |
do_statement($::form, $sth, $query, $report->id, $o1 + $_, $row + $n_header_rows, $data_row->{object}->${ \ $methods->{$row_ident}->[$_] }) for 0 .. $#{ $methods->{$row_ident} };
|
|
653 |
do_statement($::form, $sth, $query, $report->id, $o2 + $_, $row + $n_header_rows, $data_row->{raw_data}{ $raw_methods->{$row_ident}->[$_] }) for 0 .. $#{ $raw_methods->{$row_ident} };
|
653 |
654 |
|
654 |
|
$sth2->execute($report->id, $row + $n_header_rows, 'information', $_) for @{ $data_row->{information} || [] };
|
655 |
|
$sth2->execute($report->id, $row + $n_header_rows, 'errors', $_) for @{ $data_row->{errors} || [] };
|
|
655 |
do_statement($::form, $sth2, $query2, $report->id, $row + $n_header_rows, 'information', $_) for @{ $data_row->{information} || [] };
|
|
656 |
do_statement($::form, $sth2, $query2, $report->id, $row + $n_header_rows, 'errors', $_) for @{ $data_row->{errors} || [] };
|
656 |
657 |
}
|
657 |
658 |
1;
|
658 |
659 |
}) or do { die SL::DB->client->error };
|
DB Handling: Einige executes mit Fehlerbehandlung versehen