Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 87ef5e00

Von Sven Schöling vor mehr als 8 Jahren hinzugefügt

  • ID 87ef5e00189e7ac23af2c3d949e4a6d3550aa7d6
  • Vorgänger 462287ad
  • Nachfolger 62041123

CsvReport: single-dbh

Unterschiede anzeigen:

SL/DB/CsvImportReport.pm
4 4
package SL::DB::CsvImportReport;
5 5

  
6 6
use strict;
7
use SL::DB;
7 8
use SL::DBUtils;
8 9

  
9 10
use SL::DB::MetaSetup::CsvImportReport;
......
56 57
sub destroy {
57 58
  my ($self) = @_;
58 59

  
59
  my $dbh = $self->db->dbh;
60
  SL::DB->client->with_transaction(sub {
61
    my $dbh = SL::DB->client->dbh;
60 62

  
61
  $dbh->begin_work;
63
    do_query($::form, $dbh, 'DELETE FROM csv_import_report_status WHERE csv_import_report_id = ?', $self->id);
64
    do_query($::form, $dbh, 'DELETE FROM csv_import_report_rows WHERE csv_import_report_id = ?', $self->id);
65
    do_query($::form, $dbh, 'DELETE FROM csv_import_reports WHERE id = ?', $self->id);
62 66

  
63
  do_query($::form, $dbh, 'DELETE FROM csv_import_report_status WHERE csv_import_report_id = ?', $self->id);
64
  do_query($::form, $dbh, 'DELETE FROM csv_import_report_rows WHERE csv_import_report_id = ?', $self->id);
65
  do_query($::form, $dbh, 'DELETE FROM csv_import_reports WHERE id = ?', $self->id);
66

  
67
  if ($self->profile_id) {
68
    do_query($::form, $dbh, 'DELETE FROM csv_import_profile_settings WHERE csv_import_profile_id = ?', $self->profile_id);
69
    do_query($::form, $dbh, 'DELETE FROM csv_import_profiles WHERE id = ?', $self->profile_id);
70
  }
71

  
72
  $dbh->commit;
67
    if ($self->profile_id) {
68
      do_query($::form, $dbh, 'DELETE FROM csv_import_profile_settings WHERE csv_import_profile_id = ?', $self->profile_id);
69
      do_query($::form, $dbh, 'DELETE FROM csv_import_profiles WHERE id = ?', $self->profile_id);
70
    }
71
    1;
72
  }) or do { die SL::DB->client->error };
73 73
}
74 74

  
75 75
1;

Auch abrufbar als: Unified diff