Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 6b23fb21

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

  • ID 6b23fb212fb1cee6e1034601d3ceb22a182e50f0
  • Vorgänger 63cbca66
  • Nachfolger 2dda5e9d

single-dbh: Fehler in Transaktionen immer weiterwerfen

Unterschiede anzeigen:

SL/AM.pm
498 498
  SL::DB->client->with_transaction(sub {
499 499
    $query = qq|DELETE FROM leads WHERE id = ?|;
500 500
    do_query($form, SL::DB->client->dbh, $query, $form->{id});
501
  });
501
    1;
502
  }) or do { die SL::DB->client->error };
502 503

  
503 504
  $main::lxdebug->leave_sub();
504 505
}
......
606 607
        ") VALUES (?, ?, ?, ?, ?, ?)";
607 608
    }
608 609
    do_query($form, $dbh, $query, @values);
609
  });
610
    1;
611
  }) or do { die SL::DB->client->error };
610 612

  
611 613
  $main::lxdebug->leave_sub();
612 614
}
......
627 629

  
628 630
    $query = "DELETE FROM language WHERE id = ?";
629 631
    do_query($form, $dbh, $query, $form->{"id"});
630
  });
632
    1;
633
  }) or do { die SL::DB->client->error };
631 634

  
632 635
  $main::lxdebug->leave_sub();
633 636
}
......
796 799

  
797 800
    # set close in defaults
798 801
    do_query($form, $dbh, $query, @values);
799
  });
802
    1;
803
  }) or do { die SL::DB->client->error };
800 804

  
801 805
  $main::lxdebug->leave_sub();
802 806
}
......
1097 1101
      }
1098 1102
      $sth->finish();
1099 1103
    }
1100
  });
1104
    1;
1105
  }) or do { die SL::DB->client->error };
1101 1106

  
1102 1107
  $main::lxdebug->leave_sub();
1103 1108
}
......
1375 1380
  SL::DB->client->with_transaction(sub {
1376 1381
    $query = qq|DELETE FROM tax WHERE id = ?|;
1377 1382
    do_query($form, SL::DB->client->dbh, $query, $form->{id});
1378
  });
1383
    1;
1384
  }) or do { die SL::DB->client->error };
1379 1385

  
1380 1386
  $main::lxdebug->leave_sub();
1381 1387
}
......
1400 1406
    }
1401 1407

  
1402 1408
    do_query($form, $dbh, $query, @values);
1403
  });
1409
    1;
1410
  }) or do { die SL::DB->client->error };
1404 1411

  
1405 1412
  $main::lxdebug->leave_sub();
1406 1413
}
......
1443 1450

  
1444 1451
  SL::DB->client->with_transaction(sub {
1445 1452
    do_query($form, SL::DB->client->dbh, qq|DELETE FROM price_factors WHERE id = ?|, conv_i($form->{id}));
1446
  });
1453
    1;
1454
  }) or do { die SL::DB->client->error };
1447 1455

  
1448 1456
  $main::lxdebug->leave_sub();
1449 1457
}
......
1480 1488

  
1481 1489
      $sth->finish();
1482 1490
    }
1483
  });
1491
    1;
1492
  }) or do { die SL::DB->client->error };
1484 1493

  
1485 1494
  $main::lxdebug->leave_sub();
1486 1495
}
......
1512 1521
    }
1513 1522

  
1514 1523
    $sth->finish();
1515
  });
1524
    1;
1525
  }) or do { die SL::DB->client->error };
1516 1526

  
1517 1527
  $main::lxdebug->leave_sub();
1518 1528
}
SL/AP.pm
403 403
  SL::DB->client->with_transaction(sub {
404 404
    my $query = qq|DELETE FROM ap WHERE id = ?|;
405 405
    do_query($form, SL::DB->client->dbh, $query, $form->{id});
406
  });
406
    1;
407
  }) or do { die SL::DB->client->error };
407 408

  
408 409
  $main::lxdebug->leave_sub();
409 410

  
SL/AR.pm
452 452
    # acc_trans entries are deleted by database triggers.
453 453
    my $query = qq|DELETE FROM ar WHERE id = ?|;
454 454
    do_query($form, SL::DB->client->dbh, $query, $form->{id});
455
  });
455
    1;
456
  }) or do { die SL::DB->client->error };
456 457

  
457 458
  $main::lxdebug->leave_sub();
458 459

  
SL/ARAP.pm
154 154
    SL::DB->client->with_transaction(sub {
155 155
      my $query = qq|UPDATE oe SET closed = TRUE WHERE id IN (| . join(', ', ('?') x scalar @close_oe_ids) . qq|)|;
156 156
      do_query($form, $dbh, $query, @close_oe_ids);
157
    });
157
      1;
158
    }) or do { die SL::DB->client->error };
158 159
  }
159 160

  
160 161
  $main::lxdebug->leave_sub();
SL/AccTransCorrections.pm
796 796

  
797 797
      $h_taxkey_only->finish();
798 798
      $h_taxkey_chart_id->finish();
799
    });
799
      1;
800
    }) or do { die SL::DB->client->error };
800 801
  }
801 802

  
802 803
  $main::lxdebug->leave_sub();
......
872 873
      }
873 874

  
874 875
      $sth->finish();
875
    });
876
      1;
877
    }) or do { die SL::DB->client->error };
876 878
  }
877 879

  
878 880
  $main::lxdebug->leave_sub();
......
922 924
    $h_taxkey_only->finish();
923 925
    $h_taxkey_chart->finish();
924 926
    $h_transdate->finish();
925
  });
927
    1;
928
  }) or do { die SL::DB->client->error };
926 929

  
927 930
  $main::lxdebug->leave_sub();
928 931
}
......
949 952
    do_query($form, $dbh, qq|DELETE FROM ap        WHERE id       = ?|, conv_i($params{trans_id}));
950 953
    do_query($form, $dbh, qq|DELETE FROM gl        WHERE id       = ?|, conv_i($params{trans_id}));
951 954
    do_query($form, $dbh, qq|DELETE FROM acc_trans WHERE trans_id = ?|, conv_i($params{trans_id}));
952
  });
955
    1;
956
  }) or do { die SL::DB->client->error };
953 957

  
954 958
  $main::lxdebug->leave_sub();
955 959
}
SL/BP.pm
261 261
        unlink(qq|$spool/$form->{"spoolfile_$i"}|);
262 262
      }
263 263
    }
264
  });
264
    1;
265
  }) or do { die SL::DB->client->error };
265 266

  
266 267
  $main::lxdebug->leave_sub();
267 268
  return 1;
SL/Common.pm
434 434
    do_query($form, $dbh, qq|UPDATE $table SET intnotes = ? WHERE id = ?|, $intnotes, $form->{id});
435 435

  
436 436
    $form->save_status($dbh);
437
  });
437
    1;
438
  }) or do { die SL::DB->client->error };
438 439

  
439 440
  $main::lxdebug->leave_sub();
440 441
}
SL/DATEV.pm
293 293

  
294 294
    my $query = "INSERT INTO datev (" . join(', ', @columns) . ") VALUES (" . join(', ', ('?') x @columns) . ")";
295 295
    do_query($::form, $self->dbh, $query, map { $data->{$_} } @columns);
296
  });
296
    1;
297
  }) or do { die SL::DB->client->error };
297 298
}
298 299

  
299 300
sub export {
SL/DO.pm
578 578
    foreach my $oe_id (keys %ship) {
579 579
        do_query($form, $dbh,"UPDATE oe SET delivered = ".($ship{$oe_id}->{delivered}?"TRUE":"FALSE")." WHERE id = ?", $oe_id);
580 580
    }
581
  });
581
    1;
582
  }) or do { die SL::DB->client->error };
582 583

  
583 584
  $main::lxdebug->leave_sub();
584 585
}
......
605 606
    my $query    = qq|UPDATE delivery_orders SET closed = TRUE WHERE id IN (| . join(', ', ('?') x scalar(@{ $params{ids} })) . qq|)|;
606 607

  
607 608
    do_query($form, $dbh, $query, map { conv_i($_) } @{ $params{ids} });
608
  });
609
    1;
610
  }) or die { SL::DB->client->error };
609 611

  
610 612
  $form->new_lastmtime('delivery_orders');
611 613

  
SL/FU.pm
81 81

  
82 82
  SL::DB->client->with_transaction(sub {
83 83
    do_query($form, SL::DB->client->dbh, qq|UPDATE follow_ups SET done = TRUE WHERE id = ?|, conv_i($params{id}));
84
  });
84
    1;
85
  }) or do { die SL::DB->client->error };
85 86

  
86 87
  $main::lxdebug->leave_sub();
87 88
}
......
105 106
    do_query($form, $dbh, qq|DELETE FROM follow_up_links WHERE follow_up_id = ?|,                         $id);
106 107
    do_query($form, $dbh, qq|DELETE FROM follow_ups      WHERE id = ?|,                                   $id);
107 108
    do_query($form, $dbh, qq|DELETE FROM notes           WHERE (trans_id = ?) AND (trans_module = 'fu')|, $id);
108
  });
109
    1;
110
  }) or do { die SL::DB->client->error };
109 111

  
110 112
  $main::lxdebug->leave_sub();
111 113
}
......
444 446
    }
445 447

  
446 448
    $sth->finish();
447
  });
449
    1;
450
  }) or do { die SL::DB->client->error };
448 451

  
449 452
  $main::lxdebug->leave_sub();
450 453
}
SL/GL.pm
52 52

  
53 53
  SL::DB->with_transaction(sub {
54 54
    do_query($form, SL::DB->client->dbh, qq|DELETE FROM gl WHERE id = ?|, conv_i($form->{id}));
55
  });
55
    1;
56
  }) or do { die SL::DB->client->error };
56 57

  
57 58
  $main::lxdebug->leave_sub();
58 59
}
SL/IR.pm
933 933
    );
934 934

  
935 935
    map { do_query($form, $dbh, $_, @values) } @queries;
936
  });
936
    1;
937
  }) or do { die SL::DB->client->error };
937 938

  
938 939
  return 1;
939 940
}
SL/Notes.pm
34 34
    push @values, $params{subject}, $params{body}, conv_i($params{id});
35 35

  
36 36
    do_query($form, $dbh, $query, @values);
37
  });
37
    1;
38
  }) or do { die SL::DB->client->error };
38 39

  
39 40
  $main::lxdebug->leave_sub();
40 41

  
......
79 80
    do_query($form, $dbh, qq|DELETE FROM follow_up_links WHERE follow_up_id IN (SELECT DISTINCT id FROM follow_ups WHERE note_id = ?)|, $id);
80 81
    do_query($form, $dbh, qq|DELETE FROM follow_ups      WHERE note_id = ?|, $id);
81 82
    do_query($form, $dbh, qq|DELETE FROM notes           WHERE id = ?|, $id);
82
  });
83
    1;
84
  }) or do { die SL::DB->client->error };
83 85

  
84 86
  $main::lxdebug->leave_sub();
85 87
}
SL/OE.pm
885 885
      $query = qq|UPDATE oe SET closed = TRUE WHERE id IN (| . join(', ', ('?') x scalar @close_ids) . qq|)|;
886 886
      do_query($form, $dbh, $query, @close_ids);
887 887
    }
888

  
889
  });
888
    1;
889
  }) or do { die SL::DB->client->error };
890 890

  
891 891
  $main::lxdebug->leave_sub();
892 892
}
......
905 905
    unlink map { "$spool/$_" } @spoolfiles if $spool;
906 906

  
907 907
    1;
908
  });
908
  }) or do { die SL::DB->client->error };
909 909

  
910 910
  $main::lxdebug->leave_sub();
911 911

  
SL/SEPA.pm
280 280
    my $query        = qq|UPDATE sepa_export SET closed = TRUE WHERE id IN ($placeholders)|;
281 281

  
282 282
    do_query($form, $dbh, $query, map { conv_i($_) } @ids);
283
  });
283
    1;
284
  }) or do { die SL::DB->client->error };
284 285

  
285 286
  $main::lxdebug->leave_sub();
286 287
}
SL/TODO.pm
95 95
    push @values, $id;
96 96

  
97 97
    do_query($form, $dbh, $query, @values);
98
  });
98
    1;
99
  }) or do { die SL::DB->client->error };
99 100

  
100 101
  $main::lxdebug->leave_sub();
101 102
}

Auch abrufbar als: Unified diff