Subversion Repositories eFlore/Applications.cel

Rev

Rev 1517 | Blame | Last modification | View Log | RSS feed

<?php
class Dao extends Bdd {
        public function rechercherCoordonnees() {
                $requete = "SELECT longitude, latitude
                                        FROM `cel_obs`
                                        GROUP BY `longitude` , `latitude`";
                $resultat = $this->recupererTous($requete);
                return $resultat;
        }
        
        public function rechercherCoordonneesSansCorrespondances() {
                $requete = "SELECT longitude, latitude
                                                FROM `cel_obs`
                                                WHERE code_insee_calcule = '' AND latitude LIKE '43.3%' AND longitude LIKE '3.25%' 
                                                GROUP BY `longitude` , `latitude`";
                $resultat = $this->recupererTous($requete);
                return $resultat;
        }
        
        public function creerColonneCodeInseeCalculee() {
                $create = "ALTER TABLE `cel_obs` ADD `code_insee_calcule` VARCHAR( 5 ) NOT NULL";
                $this->requeter($create);
        }
        
        public function ajouterCodeInseeCalculee($latitude, $longitude, $code_insee) {
                $insert = "UPDATE `cel_obs` SET `code_insee_calcule` = '$code_insee' ".
                                        "WHERE latitude = $latitude AND longitude = $longitude";
                $this->requeter($insert);
        }
        
        public function modifierCodeInsee() {
                $update = "UPDATE `cel_obs` SET `ce_zone_geo` = concat('INSEE-C:' , `code_insee_calcule`) ".
                                                "WHERE  ce_zone_geo = '' ";
                $this->requeter($update);
        }
}
?>