From 873a9a839d7c51f1dfbfb3a36bd4d7b152a1e818 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 4 Feb 2014 10:32:58 +0100 Subject: [PATCH] =?utf8?q?Benutzerdefinierte=20Variablen:=20weniger=20kost?= =?utf8?q?ende=20Queries=20zur=20G=C3=BCltigkeitsabfrage=20verwenden?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Die Anzahl der Einträge in custom_variables_validity ist irrelevant, die Existenz mindestens eines Eintrags hingegen gefragt. --- SL/CVar.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SL/CVar.pm b/SL/CVar.pm index 315fb3b6d..b15f82be2 100644 --- a/SL/CVar.pm +++ b/SL/CVar.pm @@ -589,7 +589,7 @@ sub get_custom_variables_validity { my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig); - my $query = qq|SELECT COUNT(*) FROM custom_variables_validity WHERE config_id = ? AND trans_id = ?|; + my $query = qq|SELECT id FROM custom_variables_validity WHERE config_id = ? AND trans_id = ? LIMIT 1|; my ($invalid) = selectfirst_array_query($form, $dbh, $query, conv_i($params{config_id}), conv_i($params{trans_id})); @@ -611,9 +611,9 @@ sub custom_variables_validity_by_trans_id { my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig); - my $query = qq|SELECT config_id, COUNT(*) FROM custom_variables_validity WHERE trans_id = ? GROUP BY config_id|; + my $query = qq|SELECT DISTINCT config_id FROM custom_variables_validity WHERE trans_id = ?|; - my %invalids = selectall_as_map($form, $dbh, $query, 'config_id', 'count', $params{trans_id}); + my %invalids = map { +($_->{config_id} => 1) } selectall_hashref_query($form, $dbh, $query, $params{trans_id}); $main::lxdebug->leave_sub(2); -- 2.20.1