Commit 1545de34 authored by Laurent Joly's avatar Laurent Joly
Browse files

Update maintenance_gestion_sql.php

parent 5148ea93
......@@ -167,7 +167,7 @@ function maintenance_sql_info_applications($config)
function maintenance_sql_orphelin_poste_app($config)
{
$wpkg_link = connexion_db_wpkg($config);
$query = mysqli_prepare($wpkg_link, "SELECT count(*) as nb
$query = mysqli_prepare($wpkg_link, "SELECT count(distinct id_poste_rapport) 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
......@@ -193,6 +193,24 @@ function maintenance_sql_doublon_poste_app($config)
deconnexion_db_wpkg($wpkg_link);
return $tab;
}
function maintenance_sql_orphelin_parc_profile($config)
{
$wpkg_link = connexion_db_wpkg($config);
$query = mysqli_prepare($wpkg_link, "SELECT count(distinct id_parc_profile) as nb
FROM (`parc_profile` pp)
LEFT JOIN (`postes` po) ON po.id_poste=pp.id_poste
LEFT JOIN (`parc` pa) ON pp.id_parc=pa.id_parc
WHERE po.id_poste is NULL or pa.id_parc is NULL");
mysqli_stmt_execute($query);
mysqli_stmt_bind_result($query, $res_nb,$res_nb_postes,$res_nb_parcs);
mysqli_stmt_store_result($query);
mysqli_stmt_fetch($query);
$tab = array("nb"=>$res_nb,"nb_postes"=>$res_nb_postes,"nb_parcs"=>$res_nb_parcs);
mysqli_stmt_close($query);
deconnexion_db_wpkg($wpkg_link);
return $tab;
}
echo "Table postes : <br />";
$stat_sql_postes=maintenance_sql_info_postes($config);
......@@ -210,9 +228,11 @@ echo "Nombre total d'entrées en double: ".number_format($stat_sql_poste_app_dou
echo "<br />";
echo "Table parc_profile : <br />";
$stat_sql_parc_profile=maintenance_sql_info_parc_profile($config);
$stat_sql_parc_profile_orphelin=maintenance_sql_orphelin_parc_profile($config);
echo "Nombre total d'entrées : ".number_format($stat_sql_parc_profile["nb"], 0, ',', ' ')."<br />";
echo "Nombre total de postes : ".number_format($stat_sql_parc_profile["nb_postes"], 0, ',', ' ')."<br />";
echo "Nombre total de parcs : ".number_format($stat_sql_parc_profile["nb_parcs"], 0, ',', ' ')."<br />";
echo "Nombre total d'entrées orphelines: ".number_format($stat_sql_parc_profile_orphelin["nb"], 0, ',', ' ')."<br />";
echo "<br />";
echo "Table parc : <br />";
$stat_sql_parc=maintenance_sql_info_parc($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