From 9fdd2fb1bd3eea5233499866267362753b1cdcf3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Mon, 1 Aug 2016 16:02:39 +0200 Subject: [PATCH] GenericTranslations: single-dbh --- SL/GenericTranslations.pm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/SL/GenericTranslations.pm b/SL/GenericTranslations.pm index a509212a3..4f33ab412 100644 --- a/SL/GenericTranslations.pm +++ b/SL/GenericTranslations.pm @@ -1,6 +1,7 @@ package GenericTranslations; use SL::DBUtils; +use SL::DB; use strict; @@ -90,8 +91,16 @@ sub list { } sub save { + my ($self, %params) = @_; $main::lxdebug->enter_sub(); + my $rc = SL::DB->client->with_transaction(\&_save, %params); + + $::lxdebug->leave_sub; + return $rc; +} + +sub _save { my $self = shift; my %params = @_; @@ -100,7 +109,7 @@ sub save { my $myconfig = \%main::myconfig; my $form = $main::form; - my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig); + my $dbh = $params{dbh} || SL::DB->client->dbh; $params{translation} =~ s/^\s+//; $params{translation} =~ s/\s+$//; @@ -139,9 +148,7 @@ sub save { do_query($form, $dbh, $q_insert, @v_insert); } - $dbh->commit() unless ($params{dbh}); - - $main::lxdebug->leave_sub(); + return 1; } -- 2.20.1