From: Lidio P. <li...@ic...> - 2006-07-11 19:08:10
|
Greetings, doing another complete clean install I noticed I was getting a whole bunch entries in my apache log file like: DBD::mysql::st execute failed: Duplicate entry 'default_user_name' for key 1 at /opt/local/nagios/monarch-1.0/lib/MonarchStorProc.pm line 499. DBD::mysql::st execute failed: Duplicate entry 'show_context_help' for key 1 at /opt/local/nagios/monarch-1.0/lib/MonarchStorProc.pm line 499. DBD::mysql::st execute failed: Duplicate entry 'nagios_check_command' for key 1 at /opt/local/nagios/monarch-1.0/lib/MonarchStorProc.pm line 499. ... looking closely at MonarchStorProc.pm near that line number I see routines with this kind of construct: $sth->execute()}; if ($@) { return "Error: $sqlstmt $@"; } else { return 1; } $sth->finish; The last line "$sth->finish" never gets executed due to the "return" in the if-else structures. Although it is not absolutely needed to do the "finish" however it's always best to have "clean" code. The fix is obvious. The same applies to these other subs: sub fetch_list_hash_array(@) { sub fetch_all($) { sub insert_obj(@) { sub insert_obj_id(@) { sub update_obj(@) { sub update_obj_where(@) { sub delete_all(@) { sub delete_one_where(@) { sub insert_dependency() { there maybe others in other modules. Lidio. |