Skip to content
Snippets Groups Projects
Commit 2ed13618 authored by Tomáš Plesník's avatar Tomáš Plesník
Browse files

zcucnuti selectu z vice radku na jeden kvuli unit testum

parent 5b8eb3e8
No related branches found
No related tags found
No related merge requests found
......@@ -123,15 +123,9 @@ sub authorizeClient
# obtain cidr based on rigth common name and alternate names, service and client_type
if($function_name eq 'saveNewEvent') {
$sth = $DBH->prepare("SELECT hostname, ip_net_client, receive_own_events
FROM clients
WHERE hostname IN ($alt_names) AND service = ? AND client_type = ?
ORDER BY SUBSTRING_INDEX(ip_net_client,'/', -1) DESC;");
$sth = $DBH->prepare("SELECT hostname, ip_net_client, receive_own_events FROM clients WHERE hostname IN ($alt_names) AND service = ? AND client_type = ? ORDER BY SUBSTRING_INDEX(ip_net_client,'/', -1) DESC;");
} elsif($function_name eq 'getNewEvents') {
$sth = $DBH->prepare("SELECT hostname, ip_net_client, receive_own_events
FROM clients
WHERE hostname IN ($alt_names) AND (type = ? OR type = '_any_') AND client_type = ?
ORDER BY SUBSTRING_INDEX(ip_net_client,'/', -1) DESC;");
$sth = $DBH->prepare("SELECT hostname, ip_net_client, receive_own_events FROM clients WHERE hostname IN ($alt_names) AND (type = ? OR type = '_any_') AND client_type = ? ORDER BY SUBSTRING_INDEX(ip_net_client,'/', -1) DESC;");
}
if (!defined $sth) {
......@@ -795,10 +789,7 @@ sub getStatus
# Statistics table of senders
if ($clients_sum != 0) {
$sth = $DBH->prepare("SELECT clients.client_id, clients.hostname, clients.service, count(*), max(received)
FROM events
LEFT JOIN clients ON (events.hostname=clients.hostname AND events.service=clients.service)
GROUP BY hostname, service;");
$sth = $DBH->prepare("SELECT clients.client_id, clients.hostname, clients.service, count(*), max(received) FROM events LEFT JOIN clients ON (events.hostname=clients.hostname AND events.service=clients.service) GROUP BY hostname, service;");
if (!defined $sth) {
sendMsg("err",
"Cannot prepare statement in function '$function_name': $DBH->errstr",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment