Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 945 → Rev 946

/trunk/services/modules/0.1/commun/Commun.php
102,19 → 102,13
* @param $table : Nom de la table dont on souhaite connaitre les champs
*/
public function recupererNomChamp($table) {
$requete = 'SHOW FIELDS FROM '.$table;
$resultat = $this->getBdd()->recupererTous($requete);
if ($resultat == '') {
$e = 'La requête SQL formée comporte une erreur!';
$this->renvoyerErreur(RestServeur::HTTP_CODE_RESSOURCE_INTROUVABLE, $e);
} elseif ($resultat) {
foreach ($resultat as $info) {
$this->champs_table[] = $info['Field'];
}
} else {
$resultat = @$this->getBdd()->recupererTous('SHOW FIELDS FROM '.$table);
if (!$resultat) {
$m = "La table recherchée n'existe pas";
$this->renvoyerErreur(RestServeur::HTTP_CODE_RESSOURCE_INTROUVABLE, $m);
}
}
 
foreach ($resultat as $info) $this->champs_table[] = $info['Field'];
}
 
/**