2010-11-08 Sergio Martin <srgio.martin@artica.es>

* util/pandora_sync_db.pl: Added two special 
	synchronization cases



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3558 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2010-11-08 16:14:12 +00:00
parent 242c07f0a6
commit ce5aeffd30
2 changed files with 21 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2010-11-08 Sergio Martin <srgio.martin@artica.es>
* util/pandora_sync_db.pl: Added two special
synchronization cases
2010-11-08 Sergio Martin <sergio.martin@artica.es> 2010-11-08 Sergio Martin <sergio.martin@artica.es>
* util/pandora_sync_db.pl: Fixed array pass * util/pandora_sync_db.pl: Fixed array pass

View File

@ -159,6 +159,14 @@ sub pandora_sync_main ($$$) {
print "\n[*] Cleaning destination database.\n"; print "\n[*] Cleaning destination database.\n";
# Mixed and special cases deletion
empty_table($dbh_dest, 'tlayout_data');
if($sync_data == 1) {
empty_table($dbh_dest, 'tevento');
}
empty_table($dbh_dest, 'treport_content');
empty_table($dbh_dest, 'treport_content_sla_combined');
for(my $i = 0; $i <= $#{$tables_data[0]}; $i++) { for(my $i = 0; $i <= $#{$tables_data[0]}; $i++) {
empty_table($dbh_dest, $tables_data[0]->[$i]) unless !defined $tables_data[0]->[$i]; empty_table($dbh_dest, $tables_data[0]->[$i]) unless !defined $tables_data[0]->[$i];
@ -176,12 +184,6 @@ sub pandora_sync_main ($$$) {
print "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b[*] $percent % Completed" unless $percent > 100; print "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b[*] $percent % Completed" unless $percent > 100;
} }
# Mixed cases
empty_table($dbh_dest, 'tlayout_data');
if($sync_data == 1) {
empty_table($dbh_dest, 'tevento');
}
print "\n\n"; print "\n\n";
for(my $i = 0; $i <= $#{$tables_data[0]}; $i++) { for(my $i = 0; $i <= $#{$tables_data[0]}; $i++) {
@ -199,6 +201,14 @@ sub pandora_sync_main ($$$) {
enterprise_hook('sync_clone_table', [$dbh_source, $dbh_dest, 'tevento', \@columns, \@types, \@id_agent_comparation, \@id_agentmodule_comparation, \@id_server_export_comparation, \@id_server_comparation]); enterprise_hook('sync_clone_table', [$dbh_source, $dbh_dest, 'tevento', \@columns, \@types, \@id_agent_comparation, \@id_agentmodule_comparation, \@id_server_export_comparation, \@id_server_comparation]);
} }
@columns = ('id_agent_module', 'id_agent');
@types = ('module', 'agent');
enterprise_hook('sync_clone_table', [$dbh_source, $dbh_dest, 'treport_content', \@columns, \@types, \@id_agent_comparation, \@id_agentmodule_comparation, \@id_server_export_comparation, \@id_server_comparation]);
#Special
#This case is not mixed but is here to respect the foreing key
enterprise_hook('sync_clone_table', [$dbh_source, $dbh_dest, 'treport_content_sla_combined', 'id_agent_module', 'module', \@id_agent_comparation, \@id_agentmodule_comparation, \@id_server_export_comparation, \@id_server_comparation]);
my $errors = $errors_agents + $errors_modules + $errors_servers + $errors_exportservers; my $errors = $errors_agents + $errors_modules + $errors_servers + $errors_exportservers;
if($errors == 0) { if($errors == 0) {