Ticket #94 (closed defect: Fixed)

Opened 4 months ago

Last modified 4 months ago

Bad SQL query in genExtendedInfos.php since 5809

Reported by: polymorf Owned by: jmathis
Priority: major Milestone: Centreon-2.0
Component: CentWeb Version: beta5
Keywords: genExtendedInfos Cc:

Description

"centreon/www/include/configuration/configGenerate/genExtendedInfos.php"

5808 : $DBRESULT =& $pearDB->query("SELECT host_id, host_name FROM host WHERE host_register = '1' AND host_activate = '1' ORDER BY host_name");

5809 : $DBRESULT =& $pearDB->query("SELECT host_id, host_name FROM host, extended_host_information WHERE host_activate = '1' AND ehi_notes IS NOT NULL AND ehi_notes_url IS NOT NULL AND ehi_action_url IS NOT NULL AND ehi_icon_image IS NOT NULL AND ehi_icon_image_alt IS NOT NULL AND ehi_vrml_image IS NOT NULL AND ehi_statusmap_image IS NOT NULL AND ehi_2d_coords IS NOT NULL AND ehi_3d_coords IS NOT NULL AND host_register = '1' AND host_activate = '1' ORDER BY host_name");

in 5809, it's missing the table link like "AND host_host_id = host_id".

With all the "IS NOT NULL" if a null field exist then the hostext info for this host is not generated.

Sory for my bad english.

Change History

Changed 4 months ago by jmathis

I see no problem.

If you show table schema, if field is empty, automaticaly field is null.

Service works like this too.

Changed 4 months ago by polymorf

if field is empty, automaticaly field is null, so if only one field is null (eq : how have set only the nagios status map image) query returne no result for the host who have only one field null, because of that

Example :

VRML : not set
Status map : set
so :
ehi_vrml_image IS NOT NULL=0
ehi_statusmap_image IS NOT NULL=1
AND ehi_vrml_image IS NOT NULL AND ehi_statusmap_image IS NOT NULL = 0 (0 AND 1 = 0)

And the query don't have a link between 'host' and 'extended_host_information' table, I think it's missing something like 'WHERE host_host_id = host_id'

For me before my fix, the script generated nothing because I set only the nagios status map image

Changed 4 months ago by jmathis

  • owner set to jmathis
  • status changed from new to assigned

ha ok I see where is the problem... I will fixe it sooner...

Changed 4 months ago by jmathis

  • status changed from assigned to closed
  • resolution set to fixed

ok now since r5922

Note: See TracTickets for help on using tickets.