Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 335 → Rev 334

/trunk/scripts/modules/bdtfx/Bdtfx.php
44,9 → 44,6
case 'genererNomSciHtml' :
$this->genererNomSciHtml();
break;
case 'genererChpFamille' :
$this->genererChpFamille();
break;
case 'genererDonneesTestMultiVersion' :
$this->genererDonneesTestMultiVersion();
break;
79,11 → 76,10
}
 
private function genererNomSciHtml() {
$this->initialiserGenerationChamps();
$this->preparerTablePrChpNomSciHtml();
$this->initialiserGenerationNomsSciHtml();
$this->preparerTable();
$generateur = new GenerateurNomSciHtml();
$nbreTotal = $this->recupererNbTotalTuples();
$this->departInsertion = 0;
while ($this->departInsertion < $nbreTotal) {
$resultat = $this->recupererTuples();
$nomsSciEnHtml = $generateur->generer($resultat);
95,17 → 91,17
echo "\n";
}
 
private function initialiserGenerationChamps() {
private function initialiserGenerationNomsSciHtml() {
$this->table = Config::get('tables.bdtfx');
}
 
private function preparerTablePrChpNomSciHtml() {
private function preparerTable() {
$requete = "SHOW COLUMNS FROM {$this->table} LIKE 'nom_sci_html' ";
$resultat = $this->getBdd()->recuperer($requete);
if ($resultat === false) {
$requete = "ALTER TABLE {$this->table} ".
'ADD nom_sci_html VARCHAR( 500 ) '.
'CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ';
'ADD nom_sci_html VARCHAR( 500 ) '.
'CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ';
$this->getBdd()->requeter($requete);
}
}
118,10 → 114,10
 
private function recupererTuples() {
$requete = 'SELECT num_nom, rang, nom_supra_generique, genre, epithete_infra_generique, '.
' epithete_sp, type_epithete, epithete_infra_sp,cultivar_groupe, '.
' nom_commercial, cultivar '.
"FROM {$this->table} ".
"LIMIT {$this->departInsertion},{$this->pasInsertion} ";
' epithete_sp, type_epithete, epithete_infra_sp,cultivar_groupe, '.
' nom_commercial, cultivar '.
"FROM {$this->table} ".
"LIMIT {$this->departInsertion},{$this->pasInsertion} ";
$resultat = $this->getBdd()->recupererTous($requete);
return $resultat;
}
138,39 → 134,6
}
}
}
private function genererChpFamille() {
$this->initialiserGenerationChamps();
$this->preparerTablePrChpFamille();
$generateur = new GenerateurNomSciHtml();
$resultats = $this->recupererTuples();
$classif = array();
foreach ($resultats as $nom) {
if ($nom['rang'])
$this->afficherAvancement("Insertion des noms de famille dans la base par paquet de {$this->pasInsertion} en cours");
if ($this->stopperLaBoucle($this->getParametre('t'))) break;
}
}
private function preparerTablePrChpFamille() {
$requete = "SHOW COLUMNS FROM {$this->table} LIKE 'famille' ";
$resultat = $this->getBdd()->recuperer($requete);
if ($resultat === false) {
$requete = "ALTER TABLE {$this->table} ".
'ADD famille VARCHAR(255) '.
'CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ';
$this->getBdd()->requeter($requete);
}
}
private function recupererTuplesPrChpFamille() {
$requete = 'SELECT num_nom, num_tax_sup, rang, nom_sci '.
"FROM {$this->table} ".
"WHERE rang >= 180 ".
"ORDER BY rang ASC,num_tax_sup ASC ";
$resultat = $this->getBdd()->recupererTous($requete);
return $resultat;
}
 
private function genererDonneesTestMultiVersion() {
$contenuSql = $this->recupererContenu(Config::get('chemins.structureSqlTest'));