Commit 5148ea93 authored by Laurent Joly's avatar Laurent Joly
Browse files

Update maintenance_gestion_sql.php

parent 932bec77
......@@ -150,7 +150,8 @@ function maintenance_sql_info_applications_profile($config)
mysqli_stmt_close($query);
deconnexion_db_wpkg($wpkg_link);
return $tab;
}function maintenance_sql_info_applications($config)
}
function maintenance_sql_info_applications($config)
{
$wpkg_link = connexion_db_wpkg($config);
$query = mysqli_prepare($wpkg_link, "SELECT count(*) as nb, count(distinct MD5(id_nom_app)) as nb_appli FROM `applications`");
......@@ -163,8 +164,35 @@ function maintenance_sql_info_applications_profile($config)
deconnexion_db_wpkg($wpkg_link);
return $tab;
}
function maintenance_sql_orphelin_poste_app($config)
{
$wpkg_link = connexion_db_wpkg($config);
$query = mysqli_prepare($wpkg_link, "SELECT count(*) as nb
FROM (`poste_app` pa)
LEFT JOIN (`postes` p) ON p.id_poste=pa.id_poste
LEFT JOIN (`applications` a) ON a.id_app=pa.id_app
WHERE p.id_poste is NULL or a.id_app is NULL");
mysqli_stmt_execute($query);
mysqli_stmt_bind_result($query, $res_nb);
mysqli_stmt_store_result($query);
mysqli_stmt_fetch($query);
$tab = array("nb"=>$res_nb);
mysqli_stmt_close($query);
deconnexion_db_wpkg($wpkg_link);
return $tab;
}
function maintenance_sql_doublon_poste_app($config)
{
$wpkg_link = connexion_db_wpkg($config);
$query = mysqli_prepare($wpkg_link, "SELECT count(*) as nb, id_poste, min(id_poste_rapport) FROM `poste_app` group by id_app, id_poste HAVING nb!=1");
mysqli_stmt_execute($query);
mysqli_stmt_bind_result($query, $res_nb);
mysqli_stmt_store_result($query);
$tab = array("nb"=>mysqli_stmt_num_rows($query));
mysqli_stmt_close($query);
deconnexion_db_wpkg($wpkg_link);
return $tab;
}
echo "Table postes : <br />";
$stat_sql_postes=maintenance_sql_info_postes($config);
......@@ -172,9 +200,13 @@ echo "Nombre total d'entrées : ".number_format($stat_sql_postes["nb"], 0, ',',
echo "<br />";
echo "Table poste_app : <br />";
$stat_sql_poste_app=maintenance_sql_info_poste_app($config);
$stat_sql_poste_app_orphelin=maintenance_sql_orphelin_poste_app($config);
$stat_sql_poste_app_doublon=maintenance_sql_doublon_poste_app($config);
echo "Nombre total d'entrées : ".number_format($stat_sql_poste_app["nb"], 0, ',', ' ')."<br />";
echo "Nombre total de postes : ".number_format($stat_sql_poste_app["nb_postes"], 0, ',', ' ')."<br />";
echo "Nombre total d'applications : ".number_format($stat_sql_poste_app["nb_appli"], 0, ',', ' ')."<br />";
echo "Nombre total d'entrées orphelines: ".number_format($stat_sql_poste_app_orphelin["nb"], 0, ',', ' ')."<br />";
echo "Nombre total d'entrées en double: ".number_format($stat_sql_poste_app_doublon["nb"], 0, ',', ' ')."<br />";
echo "<br />";
echo "Table parc_profile : <br />";
$stat_sql_parc_profile=maintenance_sql_info_parc_profile($config);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment