Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 14e6ba3a

Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt

  • ID 14e6ba3a190d322d2e6110e6d846c61f73787885
  • Vorgänger 03b22b34
  • Nachfolger 5fc67617

Kosmetik

Unterschiede anzeigen:

SL/Drafts.pm
47 47

  
48 48
  $query = "SELECT COUNT(*) FROM drafts WHERE id = ?";
49 49
  my ($res) = selectrow_query($form, $dbh, $query, $draft_id);
50

  
50 51
  if (!$res) {
51 52
    $draft_id = $module . "-" . $submodule . "-" . Common::unique_id();
52
    $query = "INSERT INTO drafts (id, module, submodule) VALUES (?, ?, ?)";
53
    $query    = "INSERT INTO drafts (id, module, submodule) VALUES (?, ?, ?)";
53 54
    do_query($form, $dbh, $query, $draft_id, $module, $submodule);
54 55
  }
55 56

  
56 57
  @dont_save = qw(login password action);
57 58
  map({ $saved{$_} = $form->{$_};
58 59
        delete($form->{$_}); } @dont_save);
60

  
59 61
  $dumped = YAML::Dump($form);
60 62
  map({ $form->{$_} = $saved{$_}; } @dont_save);
61 63

  
......
64 66
    qq|  (SELECT id FROM employee WHERE login = ?) | .
65 67
    qq|WHERE id = ?|;
66 68

  
67
  do_query($form, $dbh, $query, $draft_description, $dumped,
68
           $form->{login}, $draft_id);
69
  do_query($form, $dbh, $query, $draft_description, $dumped, $form->{login}, $draft_id);
69 70

  
70 71
  $dbh->commit();
71 72
  $dbh->disconnect();
72 73

  
73
  $form->{draft_id} = $draft_id;
74
  $form->{draft_id}          = $draft_id;
74 75
  $form->{draft_description} = $draft_description;
75 76

  
76 77
  $main::lxdebug->leave_sub();
......
87 88

  
88 89
  $query = qq|SELECT id, description, form FROM drafts WHERE id = ?|;
89 90

  
90
  $sth = $dbh->prepare($query);
91
  $sth->execute($draft_id) || $form->dberror("$query ($draft_id)");
91
  $sth = prepare_execute_query($form, $dbh, $query, $draft_id);
92 92

  
93 93
  my @values;
94 94
  if (my $ref = $sth->fetchrow_hashref()) {
......
96 96
  }
97 97
  $sth->finish();
98 98

  
99
#  do_query($form, $dbh, "DELETE FROM drafts WHERE id = ?", $draft_id);
100

  
101 99
  $dbh->disconnect();
102 100

  
103 101
  $main::lxdebug->leave_sub();
......
116 114

  
117 115
  $dbh = $form->dbconnect($myconfig);
118 116

  
119
  $query = qq|DELETE FROM drafts WHERE id IN (| .
120
    join(", ", map({ "?" } @draft_ids)) . qq|)|;
117
  $query = qq|DELETE FROM drafts WHERE id IN (| . join(", ", map { "?" } @draft_ids) . qq|)|;
121 118
  do_query($form, $dbh, $query, @draft_ids);
122 119

  
123 120
  $dbh->disconnect();
......
146 143
    qq|ORDER BY d.itime|;
147 144
  my @values = ($module, $submodule);
148 145

  
149
  $sth = $dbh->prepare($query);
150
  $sth->execute(@values) ||
151
    $form->dberror($query . " (" . join(", ", @values) . ")");
146
  $sth = prepare_execute_query($form, $dbh, $query, @values);
152 147

  
153 148
  while (my $ref = $sth->fetchrow_hashref()) {
154 149
    push(@list, $ref);

Auch abrufbar als: Unified diff