Revision 6e7e76c8
Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt
SL/AM.pm | ||
---|---|---|
1120 | 1120 |
my ($self, $myconfig, $form, $table) = @_; |
1121 | 1121 |
|
1122 | 1122 |
# connect to database |
1123 |
my $dbh = $form->dbconnect_noauto($myconfig);
|
|
1123 |
my $dbh = $form->get_standard_dbh($myconfig);
|
|
1124 | 1124 |
|
1125 | 1125 |
my $query = |
1126 | 1126 |
qq|SELECT |
1127 | 1127 |
(SELECT sortkey FROM $table WHERE id = ?) AS sortkey1, |
1128 | 1128 |
(SELECT sortkey FROM $table WHERE id = ?) AS sortkey2|; |
1129 |
my @values = ($form->{"id1"}, $form->{"id2"}); |
|
1129 |
my @values = ($form->{"id1"}, $form->{"id2"});
|
|
1130 | 1130 |
my @sortkeys = selectrow_query($form, $dbh, $query, @values); |
1131 | 1131 |
|
1132 |
$query = qq|UPDATE $table SET sortkey = ? WHERE id = ?|; |
|
1133 |
my $sth = $dbh->prepare($query);
|
|
1134 |
$sth->execute($sortkeys[1], $form->{"id1"}) || |
|
1135 |
$form->dberror($query . " ($sortkeys[1], $form->{id1})");
|
|
1136 |
$sth->execute($sortkeys[0], $form->{"id2"}) ||
|
|
1137 |
$form->dberror($query . " ($sortkeys[0], $form->{id2})"); |
|
1132 |
$query = qq|UPDATE $table SET sortkey = ? WHERE id = ?|;
|
|
1133 |
my $sth = prepare_query($form, $dbh, $query);
|
|
1134 |
|
|
1135 |
do_statement($form, $sth, $query, $sortkeys[1], $form->{"id1"});
|
|
1136 |
do_statement($form, $sth, $query, $sortkeys[0], $form->{"id2"});
|
|
1137 |
|
|
1138 | 1138 |
$sth->finish(); |
1139 | 1139 |
|
1140 | 1140 |
$dbh->commit(); |
1141 |
$dbh->disconnect; |
|
1142 | 1141 |
|
1143 | 1142 |
$main::lxdebug->leave_sub(); |
1144 | 1143 |
} |
Auch abrufbar als: Unified diff
Kosmetik.