A few fixes in ax table creation (forces charset, increases text size, updates univer...
authorStéphane Jacob <sj@m4x.org>
Mon, 1 Nov 2010 20:40:52 +0000 (21:40 +0100)
committerStéphane Jacob <sj@m4x.org>
Mon, 1 Nov 2010 21:19:40 +0000 (22:19 +0100)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
modules/fusionax/Activites.sql
modules/fusionax/Adresses.sql
modules/fusionax/Anciens.sql
modules/fusionax/Entreprises.sql
modules/fusionax/Formations.sql

index 653ec74..e412b15 100644 (file)
@@ -18,7 +18,7 @@ CREATE TABLE IF NOT EXISTS `fusionax_activites` (
   INDEX (jobid)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
-LOAD DATA LOCAL INFILE '{?}Activites.txt' INTO TABLE `fusionax_activites` FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'
+LOAD DATA LOCAL INFILE '{?}Activites.txt' INTO TABLE `fusionax_activites` CHARACTER SET utf8 FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'
 (AC, ax_id, Code_etab, Raison_sociale, Libelle_fonctio, Annuaire,
 @Ligne1, @Ligne2, @Ligne3, @code_postal, @ville, @zip_cedex, @etat_distr, @pays, @tel, @fax, @StringDate_maj);
 
index b72f851..e450574 100644 (file)
@@ -25,12 +25,12 @@ CREATE TABLE IF NOT EXISTS fusionax_adresses (
   INDEX (jobid)
 ) ENGINE=InnoDB, CHARSET=utf8;
 
-LOAD DATA LOCAL INFILE '{?}Adresses.txt' INTO TABLE `fusionax_adresses` FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'
+LOAD DATA LOCAL INFILE '{?}Adresses.txt' INTO TABLE `fusionax_adresses` CHARACTER SET utf8 FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'
 (provenance, ax_id, @Type_adr, Ligne1, Ligne2, Ligne3, code_postal, ville, zip_cedex, etat_distr, pays, tel, fax, @StringDate_maj)
 SET
 `Type_adr` = IF(@Type_adr = 'E', 'E', IF(@Type_adr = '', '', 'P'));
 
-LOAD DATA LOCAL INFILE '{?}Anciens.txt' INTO TABLE `fusionax_adresses` FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'
+LOAD DATA LOCAL INFILE '{?}Anciens.txt' INTO TABLE `fusionax_adresses` CHARACTER SET utf8 FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'
 (provenance, ax_id, @login, @password, @promotion_etude, @gpe_promo, @Nom_patronymique, @partic_patro, @prenom, @Nom_usuel, @partic_nom,
   @Nom_complet, @civilite, @Code_nationalite, @type, @corps_sortie, @StringDate_deces, @grade, @Mel_usage, @Mel_publiable, @xxx, @xxx,
   @tel_mobile, @xxx, @xxx, @xxx, @xxx, @xxx, @xxx, @xxx, @X_M_D, @xxx, @xxx, @xxx, @xxx, @xxx, @xxx, @Type_adr,
@@ -38,7 +38,7 @@ LOAD DATA LOCAL INFILE '{?}Anciens.txt' INTO TABLE `fusionax_adresses` FIELDS TE
 SET
 Type_adr = IF(@Type_adr = 'E', 'E', IF(@Type_adr = '', '', 'P'));
 
-LOAD DATA LOCAL INFILE '{?}Activites.txt' INTO TABLE `fusionax_adresses` FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'
+LOAD DATA LOCAL INFILE '{?}Activites.txt' INTO TABLE `fusionax_adresses` CHARACTER SET utf8 FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'
 (provenance, ax_id, Code_etab, @Raison_sociale, @Libelle_fonctio, @Annuaire,
 Ligne1, Ligne2, Ligne3, code_postal, ville, zip_cedex, etat_distr, pays, tel, fax, @StringDate_maj)
 SET
index 4736e2d..af12e11 100644 (file)
@@ -25,7 +25,7 @@ CREATE TABLE IF NOT EXISTS fusionax_anciens (
   INDEX (pid)
 ) ENGINE=InnoDB, CHARSET=utf8;
 
-LOAD DATA LOCAL INFILE '{?}Anciens.txt' INTO TABLE `fusionax_anciens` FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'
+LOAD DATA LOCAL INFILE '{?}Anciens.txt' INTO TABLE `fusionax_anciens` CHARACTER SET utf8 FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'
 (AN, ax_id, @login, @password, promotion_etude, @gpe_promo, Nom_patronymique, partic_patro, prenom, Nom_usuel, partic_nom,
   Nom_complet, @civilite, Code_nationalite, @type, corps_sortie, @StringDate_deces, grade, Mel_usage, Mel_publiable, @xxx, Mob_publiable,
   tel_mobile, @xxx, @xxx, @xxx, @xxx, @xxx, @xxx, @xxx, @X_M_D, @xxx, @xxx, @xxx, @xxx, @xxx, @xxx, @Type_adr,
index 3e3cfeb..1c66461 100644 (file)
@@ -11,7 +11,7 @@ CREATE TABLE IF NOT EXISTS `fusionax_entreprises` (
   INDEX (Raison_sociale(20))
 ) ENGINE=InnoDB, CHARSET=utf8;
 
-LOAD DATA LOCAL INFILE '{?}Entreprises.txt' INTO TABLE `fusionax_entreprises` FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'
+LOAD DATA LOCAL INFILE '{?}Entreprises.txt' INTO TABLE `fusionax_entreprises` CHARACTER SET utf8 FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'
 (EN, Code_etab, Raison_sociale, Sigle, @Inconnu, @StringDate_maj);
 
 UPDATE fusionax_entreprises SET Raison_sociale = TRIM(Raison_sociale), Sigle = TRIM(Sigle);
index 94131c5..c1c2222 100644 (file)
@@ -5,22 +5,27 @@ DROP TABLE IF EXISTS `fusionax_formations`;
 CREATE TABLE IF NOT EXISTS `fusionax_formations` (
   FO CHAR(2) NOT NULL COMMENT 'Vaut toujours FO pour cette table',
   ax_id VARCHAR(8) NOT NULL COMMENT 'Id unique de l''ancien',
-  Intitule_diplome CHAR(60) NOT NULL DEFAULT 0 COMMENT 'Intitulé du diplôme',
-  Intitule_formation CHAR(60) NOT NULL DEFAULT 0 COMMENT 'Intitulé de la formation',
-  Descr_formation CHAR(60) NOT NULL COMMENT 'Description de la formation',
+  Intitule_diplome VARCHAR(255) NOT NULL DEFAULT 0 COMMENT 'Intitulé du diplôme',
+  Intitule_formation VARCHAR(255) NOT NULL DEFAULT 0 COMMENT 'Intitulé de la formation',
+  Descr_formation VARCHAR(255) NOT NULL COMMENT 'Description de la formation',
   pid INT(11) UNSIGNED DEFAULT NULL,
   eduid INT(4) DEFAULT NULL,
   degreeid INT(4) DEFAULT NULL,
   fieldid INT(2) DEFAULT NULL,
   PRIMARY KEY (ax_id, Intitule_diplome, Intitule_formation, Descr_formation),
-  INDEX (Intitule_diplome),
-  INDEX (Intitule_formation),
-  INDEX (Descr_formation),
+  INDEX (Intitule_diplome(60)),
+  INDEX (Intitule_formation(60)),
+  INDEX (Descr_formation(60)),
   INDEX (pid),
   INDEX (eduid),
   INDEX (degreeid),
   INDEX (fieldid)
 ) ENGINE=InnoDB, CHARSET=utf8;
 
-LOAD DATA LOCAL INFILE  '{?}Formations.txt' INTO TABLE  fusionax_formations FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n'
+LOAD DATA LOCAL INFILE  '{?}Formations.txt' INTO TABLE  fusionax_formations CHARACTER SET utf8 FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n'
 (FO, ax_id, Intitule_diplome, Intitule_formation, Descr_formation);
+
+    UPDATE  fusionax_formations    AS f
+INNER JOIN  profile_education_enum AS e ON (f.Intitule_diplome = e.abbreviation)
+       SET  f.Intitule_diplome = e.name
+     WHERE  f.Intitule_diplome != '';