1870 |
jpm |
1 |
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
|
|
|
2 |
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
|
|
|
3 |
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
|
|
|
4 |
|
|
|
5 |
-- -----------------------------------------------------
|
|
|
6 |
-- View `del_obs_images`
|
|
|
7 |
-- -----------------------------------------------------
|
1919 |
jpm |
8 |
DROP VIEW IF EXISTS `del_obs_image` ;
|
|
|
9 |
DROP TABLE IF EXISTS `del_obs_image`;
|
1870 |
jpm |
10 |
|
1880 |
jpm |
11 |
-- View `v_del_image`
|
|
|
12 |
-- -----------------------------------------------------
|
|
|
13 |
DROP VIEW IF EXISTS `v_del_image` ;
|
|
|
14 |
DROP TABLE IF EXISTS `v_del_image`;
|
1870 |
jpm |
15 |
|
|
|
16 |
-- -----------------------------------------------------
|
|
|
17 |
-- View `del_observations`
|
|
|
18 |
-- -----------------------------------------------------
|
|
|
19 |
DROP VIEW IF EXISTS `del_observation` ;
|
|
|
20 |
DROP TABLE IF EXISTS `del_observation`;
|
|
|
21 |
CREATE OR REPLACE VIEW del_observation AS
|
|
|
22 |
SELECT id_observation,
|
|
|
23 |
if((char_length(o.ce_utilisateur) <> 32),cast(o.ce_utilisateur as unsigned),0) AS ce_utilisateur,
|
|
|
24 |
o.prenom_utilisateur, o.nom_utilisateur, o.courriel_utilisateur,
|
|
|
25 |
nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, famille,
|
|
|
26 |
ce_zone_geo, zone_geo, lieudit, station, milieu, nom_referentiel,
|
|
|
27 |
date_observation, o.mots_cles_texte, o.commentaire,
|
|
|
28 |
o.date_creation, o.date_modification, o.date_transmission, certitude
|
|
|
29 |
FROM tb_cel.cel_obs AS o INNER JOIN tb_cel.cel_images AS i ON (o.id_observation = i.ce_observation)
|
|
|
30 |
WHERE o.transmission = '1' ;
|
|
|
31 |
|
|
|
32 |
-- -----------------------------------------------------
|
|
|
33 |
-- View `del_images`
|
|
|
34 |
-- -----------------------------------------------------
|
|
|
35 |
DROP VIEW IF EXISTS `del_image` ;
|
|
|
36 |
DROP TABLE IF EXISTS `del_image`;
|
|
|
37 |
CREATE OR REPLACE VIEW del_image AS
|
|
|
38 |
SELECT i.id_image, i.ce_observation,
|
|
|
39 |
if((char_length(i.ce_utilisateur) <> 32),cast(i.ce_utilisateur as unsigned),0) AS ce_utilisateur, i.prenom_utilisateur, i.nom_utilisateur, i.courriel_utilisateur,
|
|
|
40 |
i.hauteur, i.largeur, i.date_prise_de_vue, i.mots_cles_texte, i.commentaire, i.nom_original,
|
|
|
41 |
i.date_creation, i.date_modification, i.date_liaison, i.date_transmission
|
|
|
42 |
FROM tb_cel.cel_images AS i
|
|
|
43 |
WHERE i.transmission = '1';
|
|
|
44 |
|
|
|
45 |
-- -----------------------------------------------------
|
1880 |
jpm |
46 |
-- View `del_plantnet`
|
1870 |
jpm |
47 |
-- -----------------------------------------------------
|
1880 |
jpm |
48 |
## Il est nécessaire de garder une vue de ce type car l'optimisateur d'index de MYSQL fait n'importe quoi dans le cas du WS plantnet/changements...
|
|
|
49 |
DROP VIEW IF EXISTS `del_plantnet` ;
|
|
|
50 |
DROP TABLE IF EXISTS `del_plantnet`;
|
|
|
51 |
CREATE OR REPLACE VIEW del_plantnet AS
|
2128 |
mathias |
52 |
SELECT `o`.`id_observation` AS `id_observation`,`o`.`ce_utilisateur` AS `ce_utilisateur`,`o`.`prenom_utilisateur` AS `prenom_utilisateur`,
|
|
|
53 |
`o`.`nom_utilisateur` AS `nom_utilisateur`,`o`.`courriel_utilisateur` AS `courriel_utilisateur`,`o`.`nom_sel` AS `nom_sel`,
|
|
|
54 |
`o`.`nom_sel_nn` AS `nom_sel_nn`,`o`.`nom_ret` AS `nom_ret`,`o`.`famille` AS `famille`,`o`.`nom_referentiel` AS `nom_referentiel`,
|
|
|
55 |
`o`.`zone_geo` AS `zone_geo`,`o`.`latitude` AS `latitude`,`o`.`longitude` AS `longitude`,`o`.`altitude` AS `altitude`,
|
|
|
56 |
`o`.`date_observation` AS `date_observation`,`o`.`mots_cles_texte` AS `mots_cles_texte`,`o`.`date_creation` AS `date_creation`,
|
|
|
57 |
`o`.`date_modification` AS `date_modification`,`o`.`date_transmission` AS `date_transmission`,`i`.`id_image` AS `id_image`,
|
|
|
58 |
`i`.`ce_utilisateur` AS `i_ce_utilisateur`,`i`.`mots_cles_texte` AS `i_mots_cles_texte`,`i`.`nom_original` AS `nom_original`,
|
|
|
59 |
`i`.`date_creation` AS `i_date_creation`,`i`.`date_modification` AS `i_date_modification`
|
|
|
60 |
FROM (`tb_cel_test`.`cel_obs` `o`
|
|
|
61 |
JOIN `tb_cel_test`.`cel_images` `i` ON ((`o`.`id_observation` = `i`.`ce_observation`)))
|
|
|
62 |
WHERE (`o`.`transmission` = '1');
|
1870 |
jpm |
63 |
|
|
|
64 |
-- -----------------------------------------------------
|
|
|
65 |
SET SQL_MODE=@OLD_SQL_MODE;
|
|
|
66 |
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
|
|
|
67 |
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|