Revision cafc615b
Von Sven Schöling vor mehr als 8 Jahren hinzugefügt
SL/RC.pm | ||
---|---|---|
35 | 35 |
package RC; |
36 | 36 |
|
37 | 37 |
use SL::DBUtils; |
38 |
use SL::DB; |
|
38 | 39 |
|
39 | 40 |
use strict; |
40 | 41 |
|
... | ... | |
43 | 44 |
|
44 | 45 |
my ($self, $myconfig, $form) = @_; |
45 | 46 |
|
46 |
# connect to database |
|
47 |
my $dbh = $form->dbconnect($myconfig); |
|
47 |
my $dbh = SL::DB->client->dbh; |
|
48 | 48 |
|
49 | 49 |
my $query = |
50 | 50 |
qq|SELECT accno, description | . |
... | ... | |
53 | 53 |
qq|ORDER BY accno|; |
54 | 54 |
|
55 | 55 |
$form->{PR} = selectall_hashref_query($form, $dbh, $query); |
56 |
$dbh->disconnect; |
|
57 | 56 |
|
58 | 57 |
$main::lxdebug->leave_sub(); |
59 | 58 |
} |
... | ... | |
223 | 222 |
|
224 | 223 |
my ($self, $myconfig, $form) = @_; |
225 | 224 |
|
226 |
# connect to database |
|
227 |
my $dbh = $form->dbconnect($myconfig); |
|
228 |
|
|
229 |
my ($query, $i); |
|
225 |
SL::DB->client->with_transaction(sub { |
|
226 |
my $dbh = SL::DB->client->dbh; |
|
230 | 227 |
|
231 |
# clear flags |
|
232 |
for $i (1 .. $form->{rowcount}) { |
|
233 |
if ($form->{"cleared_$i"}) { |
|
234 |
$query = |
|
235 |
qq|UPDATE acc_trans SET cleared = '1' | . |
|
236 |
qq|WHERE acc_trans_id = ?|; |
|
237 |
do_query($form, $dbh, $query, $form->{"oid_$i"}); |
|
228 |
my ($query, $i); |
|
238 | 229 |
|
239 |
# clear fx_transaction |
|
240 |
if ($form->{"fxoid_$i"}) { |
|
230 |
# clear flags |
|
231 |
for $i (1 .. $form->{rowcount}) { |
|
232 |
if ($form->{"cleared_$i"}) { |
|
241 | 233 |
$query = |
242 | 234 |
qq|UPDATE acc_trans SET cleared = '1' | . |
243 | 235 |
qq|WHERE acc_trans_id = ?|; |
244 |
do_query($form, $dbh, $query, $form->{"fxoid_$i"}); |
|
236 |
do_query($form, $dbh, $query, $form->{"oid_$i"}); |
|
237 |
|
|
238 |
# clear fx_transaction |
|
239 |
if ($form->{"fxoid_$i"}) { |
|
240 |
$query = |
|
241 |
qq|UPDATE acc_trans SET cleared = '1' | . |
|
242 |
qq|WHERE acc_trans_id = ?|; |
|
243 |
do_query($form, $dbh, $query, $form->{"fxoid_$i"}); |
|
244 |
} |
|
245 | 245 |
} |
246 | 246 |
} |
247 |
} |
|
248 |
|
|
249 |
$dbh->disconnect; |
|
247 |
1; |
|
248 |
}) or do { die SL::DB->client->error }; |
|
250 | 249 |
|
251 | 250 |
$main::lxdebug->leave_sub(); |
252 | 251 |
} |
Auch abrufbar als: Unified diff
RC: single-dbh disconnects