From 7a20ec8e8217a8d31ee62cced9840ea210e25fb0 Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Mon, 4 Nov 2019 16:04:26 +0100 Subject: [PATCH] Fixed CLI delete data --- pandora_server/util/pandora_manage.pl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 3b72f91063..cb60ebfaa2 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -639,9 +639,9 @@ sub pandora_delete_module_data ($$) { my $buffer = 1000; while(1) { - my $nd = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_string WHERE id_agente_modulo=?', $id_module); - my $ndinc = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_string WHERE id_agente_modulo=?', $id_module); - my $ndlog4x = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_string WHERE id_agente_modulo=?', $id_module); + my $nd = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos WHERE id_agente_modulo=?', $id_module); + my $ndinc = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_inc WHERE id_agente_modulo=?', $id_module); + my $ndlog4x = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_log4x WHERE id_agente_modulo=?', $id_module); my $ndstring = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_string WHERE id_agente_modulo=?', $id_module); my $ntot = $nd + $ndinc + $ndlog4x + $ndstring; @@ -651,19 +651,19 @@ sub pandora_delete_module_data ($$) { } if($nd > 0) { - db_do ($dbh, 'DELETE FROM tagente_datos WHERE id_agente_modulo=? LIMIT ?', $id_module, $buffer); + db_delete_limit($dbh, 'tagente_datos', 'id_agente_modulo='.$id_module, $buffer); } if($ndinc > 0) { - db_do ($dbh, 'DELETE FROM tagente_datos_inc WHERE id_agente_modulo=? LIMIT ?', $id_module, $buffer); + db_delete_limit($dbh, 'tagente_datos_inc', 'id_agente_modulo='.$id_module, $buffer); } if($ndlog4x > 0) { - db_do ($dbh, 'DELETE FROM tagente_datos_log4x WHERE id_agente_modulo=? LIMIT ?', $id_module, $buffer); + db_delete_limit($dbh, 'tagente_datos_log4x', 'id_agente_modulo='.$id_module, $buffer); } if($ndstring > 0) { - db_do ($dbh, 'DELETE FROM tagente_datos_string WHERE id_agente_modulo=? LIMIT ?', $id_module, $buffer); + db_delete_limit($dbh, 'tagente_datos_string', 'id_agente_modulo='.$id_module, $buffer); } } @@ -4421,7 +4421,7 @@ sub cli_delete_data($) { print_log "DELETING THE DATA OF THE AGENT $name\n\n"; - pandora_delete_data($dbh, 'module', $id_agent); + pandora_delete_data($dbh, 'agent', $id_agent); } } else { my $id_agent = get_agent_id($dbh,$name); @@ -4429,7 +4429,7 @@ sub cli_delete_data($) { print_log "DELETING THE DATA OF THE AGENT $name\n\n"; - pandora_delete_data($dbh, 'module', $id_agent); + pandora_delete_data($dbh, 'agent', $id_agent); } } elsif($opt eq '-g' || $opt eq '--g') {