Fixed CLI delete data

This commit is contained in:
Luis Calvo 2019-11-04 16:04:26 +01:00
parent 6f3e42e732
commit 7a20ec8e82

View File

@ -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') {