diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog
index 39dec37c88..aa2a5a89c6 100644
--- a/pandora_server/ChangeLog
+++ b/pandora_server/ChangeLog
@@ -1,3 +1,9 @@
+2010-09-23  Sergio Martin <sergio.martin@artica.es>
+
+	* lib/PandoraFMS/DB.pm: Added a function db_process_insert
+	to insert a generic query receiving a hash reference with
+	the parameters (columns in index and value in values)
+
 2010-09-22  Sancho Lerena <slerena@artica.es>
 
 	* pandora_server/pandora_server.spec: Updated spec with some 
diff --git a/pandora_server/lib/PandoraFMS/DB.pm b/pandora_server/lib/PandoraFMS/DB.pm
index 6f742d3e8b..78b6524482 100644
--- a/pandora_server/lib/PandoraFMS/DB.pm
+++ b/pandora_server/lib/PandoraFMS/DB.pm
@@ -30,6 +30,7 @@ our @EXPORT = qw(
 		db_connect
 		db_disconnect
 		db_do
+		db_process_insert
 		db_insert
 		get_action_id
 		get_agent_id
@@ -305,6 +306,29 @@ sub db_insert ($$;@) {
 	return $dbh->{'mysql_insertid'};
 }
 
+##########################################################################
+## SQL insert. Returns the ID of the inserted row.
+##########################################################################
+sub db_process_insert($$$;@) {
+	my ($dbh, $table, $parameters, @values) = @_;
+		
+	my @columns_array = keys %$parameters;
+	my @values_array = values %$parameters;
+	
+	if(!defined($table) || $#columns_array == -1) {
+		return -1;
+		exit;
+	}
+	
+	my $columns_string = join(',',@columns_array);
+	my $values_string = "'".join("','",@values_array)."'";
+	
+	my $query = "INSERT INTO $table ($columns_string) VALUES ($values_string)";
+	
+	$dbh->do($query, undef, @values);
+	return $dbh->{'mysql_insertid'};
+}
+
 ##########################################################################
 ## Generic SQL sentence. 
 ##########################################################################