Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 334 → Rev 335

/trunk/scripts/modules/bdtfx/Bdtfx.php
44,6 → 44,9
case 'genererNomSciHtml' :
$this->genererNomSciHtml();
break;
case 'genererChpFamille' :
$this->genererChpFamille();
break;
case 'genererDonneesTestMultiVersion' :
$this->genererDonneesTestMultiVersion();
break;
76,10 → 79,11
}
 
private function genererNomSciHtml() {
$this->initialiserGenerationNomsSciHtml();
$this->preparerTable();
$this->initialiserGenerationChamps();
$this->preparerTablePrChpNomSciHtml();
$generateur = new GenerateurNomSciHtml();
$nbreTotal = $this->recupererNbTotalTuples();
$this->departInsertion = 0;
while ($this->departInsertion < $nbreTotal) {
$resultat = $this->recupererTuples();
$nomsSciEnHtml = $generateur->generer($resultat);
91,17 → 95,17
echo "\n";
}
 
private function initialiserGenerationNomsSciHtml() {
private function initialiserGenerationChamps() {
$this->table = Config::get('tables.bdtfx');
}
 
private function preparerTable() {
private function preparerTablePrChpNomSciHtml() {
$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);
}
}
114,10 → 118,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;
}
134,6 → 138,39
}
}
}
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'));