2011-12-01 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* lib/PandoraFMS/DB.pm lib/PandoraFMS/Core.pm: Added new function db_concat and added compatibility with postgreSQL and Oracle in function pandora_get_module_tags. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5225 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
bf182a63f8
commit
fa8570c8db
|
@ -1,3 +1,10 @@
|
|||
2011-12-01 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||
|
||||
* lib/PandoraFMS/DB.pm
|
||||
lib/PandoraFMS/Core.pm: Added new function db_concat and added
|
||||
compatibility with postgreSQL and Oracle in function
|
||||
pandora_get_module_tags.
|
||||
|
||||
2011-11-29 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||
|
||||
* util/pandora_manage.pl: Added some checks that I forget in my
|
||||
|
|
|
@ -2557,8 +2557,7 @@ Get a list of module tags in the format: |tag|tag| ... |tag|
|
|||
sub pandora_get_module_tags ($$$) {
|
||||
my ($pa_config, $dbh, $id_agentmodule) = @_;
|
||||
|
||||
#TODO: Fix for Oracle and PostgreSQL
|
||||
my @tags = get_db_rows ($dbh, 'SELECT concat(ttag.name, " ", ttag.url) name_url FROM ttag, ttag_module
|
||||
my @tags = get_db_rows ($dbh, 'SELECT ' . db_concat('ttag.name', 'ttag.url') . ' name_url FROM ttag, ttag_module
|
||||
WHERE ttag.id_tag = ttag_module.id_tag
|
||||
AND ttag_module.id_agente_modulo = ?', $id_agentmodule);
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
|
|||
our @EXPORT = qw(
|
||||
add_address
|
||||
add_new_address_agent
|
||||
db_concat
|
||||
db_connect
|
||||
db_disconnect
|
||||
db_do
|
||||
|
@ -628,6 +629,17 @@ sub get_alert_template_name ($$) {
|
|||
return get_db_value ($dbh, "SELECT name FROM talert_templates, talert_template_modules WHERE talert_templates.id = talert_template_modules.id_alert_template AND talert_template_modules.id = ?", $alert_id);
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
## Concat two strings
|
||||
##########################################################################
|
||||
sub db_concat ($$) {
|
||||
my ($element1, $element2) = @_;
|
||||
|
||||
return " concat(" . $element1 . ", ' '," . $element2 . ") " if ($RDBMS eq 'mysql');
|
||||
return " " . $element1 . " || ' ' || " . $element2 . " " if ($RDBMS eq 'oracle' or $RDBMS eq 'postgresql');
|
||||
|
||||
}
|
||||
|
||||
# End of function declaration
|
||||
# End of defined Code
|
||||
|
||||
|
|
Loading…
Reference in New Issue