2011-06-20 Sergio Martin <sergio.martin@artica.es>

* lib/PandoraFMS/DB.pm: Added quotes to process
	database functions to avoid errors when the tables
	will have key words names

	* lib/PandoraFMS/Core.pm: Fixed a bug change the position
	of two conditions to avoid a notice



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4471 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2011-06-20 16:18:18 +00:00
parent 918340e8d9
commit 1087de701f
3 changed files with 13 additions and 4 deletions

View File

@ -1,3 +1,12 @@
2011-06-20 Sergio Martin <sergio.martin@artica.es>
* lib/PandoraFMS/DB.pm: Added quotes to process
database functions to avoid errors when the tables
will have key words names
* lib/PandoraFMS/Core.pm: Fixed a bug change the position
of two conditions to avoid a notice
2011-06-16 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Core.pm: Fixed a typo.

View File

@ -1297,7 +1297,7 @@ sub pandora_delete_module ($$;$) {
my $agent_name = get_agent_name($dbh, $agent_id);
my $module_name = get_module_name($dbh, $module_id);
if ((-e $conf->{incomingdir}.'/conf/'.md5($agent_name).'.conf') && (defined($conf))) {
if ((defined($conf)) && (-e $conf->{incomingdir}.'/conf/'.md5($agent_name).'.conf')) {
enterprise_hook('pandora_delete_module_from_conf', [$conf,$agent_name,$module_name]);
}
}

View File

@ -473,9 +473,9 @@ sub db_process_insert($$$$;@) {
}
$wildcards = '('.$wildcards.')';
my $columns_string = join(',',@columns_array);
my $columns_string = join('`,`',@columns_array);
my $res = db_insert ($dbh, $index, "INSERT INTO $table (".$columns_string.") VALUES ".$wildcards, @values_array);
my $res = db_insert ($dbh, $index, "INSERT INTO $table (`".$columns_string."`) VALUES ".$wildcards, @values_array);
return $res;
}
@ -502,7 +502,7 @@ sub db_process_update($$$$$;@) {
if($i > 0 && $i <= $#values_array) {
$fields = $fields.',';
}
$fields = $fields." $columns_array[$i] = ?";
$fields = $fields." `$columns_array[$i]` = ?";
}
push(@values_array, $where_value);