/* 
 Now that the Panama check list is in mysql, I am editing directly there. At import, status needs to be set for many I had already looked up.
*/

USE stagePanamaTree;
/*
 SOURCE ~/data/treedatabase/TreeSpeciesPanama/PanamaTree.sql
*/

DELIMITER //

/* Silly errors */
DROP PROCEDURE IF EXISTS basicStageSet //
CREATE PROCEDURE basicStageSet()
BEGIN
   
   UPDATE stagePanamaTree.complete SET status='syn' WHERE expert='Syn';
   UPDATE complete SET familia='Hydrophyllaceae' WHERE genero='Wigandia' AND id=1110;   

   UPDATE complete SET especie='coibensis' WHERE genero='Eugenia' AND especie='cobensis';   
   UPDATE complete SET especie='grandis' WHERE genero='Myrcia' AND especie='grandia';   
   UPDATE complete SET familia='Myrtaceae' WHERE familia='Mrytaceae';   
      
END //


/* My web app does not permit deletion */
DROP PROCEDURE IF EXISTS deleteSpecies //
CREATE PROCEDURE deleteSpecies()
BEGIN
   
   DELETE FROM stagePanamaTree.complete WHERE genero='Capparis' AND especie='amplissima' AND id=504;
   DELETE FROM stagePanamaTree.complete WHERE genero='Desmopsis' AND especie='oerstedii' AND id=3027;
   DELETE FROM stagePanamaTree.complete WHERE genero='Sapranthus' AND especie='violaceus' AND id=3079;
   DELETE FROM stagePanamaTree.complete WHERE genero='Blakea' AND familia='Mel' AND id=3250;
   DELETE FROM stagePanamaTree.complete WHERE genero='Boehmeria' AND especie='ulmifolia' AND id=3240;
   DELETE FROM stagePanamaTree.complete WHERE genero='Pleurothyrium' AND especie='' AND id=3260;   
   DELETE FROM stagePanamaTree.complete WHERE genero='Pterocarpus' AND especie='rohrii' AND id=3077;  
    
   DELETE FROM stagePanamaTree.complete WHERE genero='Plinia' AND especie='' AND year_added=2018;
   DELETE FROM stagePanamaTree.complete WHERE genero='Trichospermum' AND especie='' AND year_added=2018;   
   DELETE FROM stagePanamaTree.complete WHERE genero='Triumfetta' AND especie='speciosa' AND autor='Jacq.' AND year_added=2018;   
   DELETE FROM stagePanamaTree.complete WHERE genero='Eugenia' AND especie='siggersii' AND id=3266 AND year_added=2018;   
   DELETE FROM stagePanamaTree.complete WHERE genero='Plinia' AND especie='salamancana' AND year_added=2018;   
      
END //



DELIMITER ;
