651,6 → 651,8 |
} |
|
static function getNomCommun_v4($obs) { |
// Attention la fonction suppose que l'on ait fait appel à getNomCommun_preload avant |
// d'être appelée |
if(! $obs['nt']) return NULL; |
if(! self::referenceTableExiste()) return NULL; |
|
658,24 → 660,16 |
list($referentiel) = explode(':', strtolower($obs['nom_referentiel'])); |
$cache_id = $referentiel . '-' . $obs['nt'] . '-' . $langue; |
|
$nom = null; |
// cache: |
if(isset($cache['getNomCommun'])) { |
if(isset(self::$cache['getNomCommun'])) { |
if(isset(self::$cache['getNomCommun'][$cache_id])) return self::$cache['getNomCommun'][$cache_id]; |
// XXX: problème de valeurs NULL ? |
if(array_key_exists($cache_id, self::$cache['getNomCommun'])) return self::$cache['getNomCommun'][$cache_id]; |
if(array_key_exists($cache_id, self::$cache['getNomCommun'])) { |
$nom = self::$cache['getNomCommun'][$cache_id]; |
} |
} |
|
// pas de cache: |
$nom = Cel::db()->requeterLigne(sprintf("SELECT nom_commun FROM cel_references " . |
"WHERE referentiel = '%s' AND num_taxon = %d LIMIT 1", |
$referentiel, |
$obs['nt'])); |
|
if(! $nom) return NULL; |
$nom = $nom["nom_commun"]; |
|
// cache |
self::$cache['getNomCommun'][$cache_id] = $nom; |
return $nom; |
} |
|