From 3f07c6b0b4fdcd3c9eb715e5a2d24c36f0390ab9 Mon Sep 17 00:00:00 2001 From: lemoinealexandre Date: Fri, 4 Dec 2020 02:52:32 +0100 Subject: [PATCH 1/4] contructeur --- php/Hystorique.php | 8 ++++++++ php/Joueur.php | 8 ++++++++ php/MeteoSpot.php | 8 ++++++++ php/MeteoVille.php | 8 ++++++++ php/Pointage.php | 13 +++++++++++++ 5 files changed, 45 insertions(+) diff --git a/php/Hystorique.php b/php/Hystorique.php index d657622..229d16d 100644 --- a/php/Hystorique.php +++ b/php/Hystorique.php @@ -7,4 +7,12 @@ class Hystorique private Utilisateur $utilisateur; private Spot $spot; private Pointage $pointage; + + public function __construct(int $id, Utilisateur $utilisateur, Spot $spot, Pointage $pointage) + { + $this->id=$id; + $this->utilisateur=$utilisateur; + $this->spot=$spot; + $this->pointage=$pointage; + } } \ No newline at end of file diff --git a/php/Joueur.php b/php/Joueur.php index 2ec093d..28e7bc8 100644 --- a/php/Joueur.php +++ b/php/Joueur.php @@ -6,4 +6,12 @@ class Joueur private int $id; private bool $estVivant; private bool $estImposteur; + + + public function __construct(int $id,bool $estVivant,bool $estImposteur) + { + $this->id=$id; + $this->estVivant=$estVivant; + $this->estImposteur=$estImposteur; + } } \ No newline at end of file diff --git a/php/MeteoSpot.php b/php/MeteoSpot.php index 367015b..31ff97e 100644 --- a/php/MeteoSpot.php +++ b/php/MeteoSpot.php @@ -7,4 +7,12 @@ class MeteoSpot private int $houle; private int $maree; private int $vent; + + public function __construct(int $id,int $houle,int $maree,int $vent) + { + $this->id=$id; + $this->houle=$houle; + $this->mare=$maree; + $this->vent=$vent; + } } \ No newline at end of file diff --git a/php/MeteoVille.php b/php/MeteoVille.php index e2d616f..f1918fb 100644 --- a/php/MeteoVille.php +++ b/php/MeteoVille.php @@ -6,4 +6,12 @@ class MeteoVille private int $id; private int $temperature; private int $vent; + + + public function __construct(int $id,int $temperature,int $vent) + { + $this->id=$id; + $this->temperature=$temperature; + $this->vent=$vent; + } } \ No newline at end of file diff --git a/php/Pointage.php b/php/Pointage.php index 0f903fe..f6a9fea 100644 --- a/php/Pointage.php +++ b/php/Pointage.php @@ -11,4 +11,17 @@ class Pointage private int $bateauVoile; private Produits $produit; private int $niveauDechet; + + + public function __construct(int $id,int $nbBaigneur,int $nbPratiquant,int $bateauPeche, int $bateauLoisir,int $bateauVoile, Produits $produit,int $niveauDechet) + { + $this->id=$id; + $this->nbBaigneur=$nbBaigneur; + $this->nbPratiquant=$nbPratiquant; + $this->bateauPeche=$bateauPeche; + $this->bateauLoisir=$bateauLoisir; + $this->bateauVoile=$bateauVoile; + $this->produit=$produit; + $this->niveauDechet=$niveauDechet; + } } \ No newline at end of file From 550a20d30e6b169d3841f9e6c82302c48820ecc1 Mon Sep 17 00:00:00 2001 From: lemoinealexandre Date: Fri, 4 Dec 2020 02:52:54 +0100 Subject: [PATCH 2/4] contructeur --- .idea/workspace.xml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index b59d6de..5fe496d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,12 +2,12 @@ - - - - - + + + + + + + \ No newline at end of file From 113bcf209d541e872fca07157388b5239ef6f866 Mon Sep 17 00:00:00 2001 From: JunkJumper Date: Fri, 4 Dec 2020 02:58:35 +0100 Subject: [PATCH 3/4] schemaSQL OK --- sql/createSchema.sql | 197 +++++++++++++++---------------------------- 1 file changed, 68 insertions(+), 129 deletions(-) diff --git a/sql/createSchema.sql b/sql/createSchema.sql index 5d0bd76..8876167 100644 --- a/sql/createSchema.sql +++ b/sql/createSchema.sql @@ -1,89 +1,36 @@ --- Create a new database called 'bddsurf' --- Connect to the 'master' database to run this snippet -USE master -GO --- Create the new database if it does not exist already -IF NOT EXISTS ( - SELECT name - FROM sys.databases - WHERE name = N'bddsurf' -) CREATE DATABASE bddsurf -GO --- Create a new table called 'joueur' in schema 'bddsurf' --- Drop the table if it already exists -IF OBJECT_ID('bddsurf.joueur', 'U') IS NOT NULL -DROP TABLE bddsurf.joueur -GO --- Create the table in the specified schema -CREATE TABLE bddsurf.joueur +CREATE TABLE joueur ( - idJoueur INT NOT NULL PRIMARY KEY, -- primary key column + idJoueur INT PRIMARY KEY NOT NULL AUTO_INCREMENT, -- primary key column estVivant TINYINT, estImposteur TINYINT - -- specify more columns here ); -GO - --- Create a new table called 'UTILISATEUR' in schema 'bddsurf' --- Drop the table if it already exists -IF OBJECT_ID('bddsurf.utilisateur', 'U') IS NOT NULL -DROP TABLE bddsurf.utilisateur -GO --- Create the table in the specified schema -CREATE TABLE bddsurf.utilisateur +CREATE TABLE utilisateur ( - idUtilisateur INT NOT NULL PRIMARY KEY, -- primary key column - nomUtilisateur VARCHAR, - prenomUtilisateur VARCHAR, - mailUtilisateur VARCHAR, - pseudoUtilisateur VARCHAR, - passwordUtilisateur VARCHAR - -- specify more columns here + idUtilisateur INT PRIMARY KEY NOT NULL AUTO_INCREMENT, -- primary key column + nomUtilisateur VARCHAR(50), + prenomUtilisateur VARCHAR(50), + mailUtilisateur VARCHAR(50), + pseudoUtilisateur VARCHAR(50), + passwordUtilisateur VARCHAR(50) ); -GO - --- Create a new table called 'meteoville' in schema 'bddsurf' --- Drop the table if it already exists -IF OBJECT_ID('bddsurf.meteoville', 'U') IS NOT NULL -DROP TABLE bddsurf.meteoville -GO --- Create the table in the specified schema -CREATE TABLE bddsurf.meteoville +CREATE TABLE meteoville ( - IdMeteoVille INT NOT NULL PRIMARY KEY, -- primary key column + IdMeteoVille INT PRIMARY KEY NOT NULL AUTO_INCREMENT, -- primary key column temperatureMeteoVille INT, ventMeteoVille INT - -- specify more columns here ); -GO - --- Create a new table called 'meteoSpot' in schema 'bddsurf' --- Drop the table if it already exists -IF OBJECT_ID('bddsurf.meteoSpot', 'U') IS NOT NULL -DROP TABLE bddsurf.meteoSpot -GO --- Create the table in the specified schema -CREATE TABLE bddsurf.meteoSpot +CREATE TABLE meteoSpot ( - idMeteoSpot INT NOT NULL PRIMARY KEY, -- primary key column + idMeteoSpot INT PRIMARY KEY NOT NULL AUTO_INCREMENT, -- primary key column houleMeteoSpot INT, mareeMeteoSpot INT, ventMeteoSpot INT - -- specify more columns here ); -GO - --- Create a new table called 'produits' in schema 'bddsurf' --- Drop the table if it already exists -IF OBJECT_ID('bddsurf.produits', 'U') IS NOT NULL -DROP TABLE bddsurf.produits -GO --- Create the table in the specified schema -CREATE TABLE bddsurf.produits +CREATE TABLE produits ( - idProduits INT NOT NULL PRIMARY KEY, -- primary key column + idProduits INT PRIMARY KEY NOT NULL AUTO_INCREMENT, -- primary key column estCremeSolaire TINYINT, estParfum TINYINT, estCremeHydratante TINYINT, @@ -92,80 +39,72 @@ CREATE TABLE bddsurf.produits estCigarette TINYINT, estEngrais TINYINT, estPeinture TINYINT, - AutreProduit VARCHAR - -- specify more columns here + AutreProduit VARCHAR(50) ); -GO - --- Create a new table called 'ville' in schema 'bddsurf' --- Drop the table if it already exists -IF OBJECT_ID('bddsurf.ville', 'U') IS NOT NULL -DROP TABLE bddsurf.ville -GO --- Create the table in the specified schema -CREATE TABLE bddsurf.ville +CREATE TABLE pollution ( - idVille INT NOT NULL PRIMARY KEY, -- primary key column - nomVille VARCHAR, - cpVille VARCHAR, + idPollution INT PRIMARY KEY NOT NULL AUTO_INCREMENT, -- primary key column + niveauPollution INT, + descriptionPollution VARCHAR(50) +); +CREATE TABLE ville +( + idVille INT PRIMARY KEY NOT NULL AUTO_INCREMENT, -- primary key column + nomVille VARCHAR(50), + cpVille VARCHAR(50), meteoVille INT NOT NULL, CONSTRAINT fk_meteoville FOREIGN KEY (meteoVille) - REFERENCES bddsurf.meteoville(IdMeteoVille) - -- specify more columns here + REFERENCES meteoville(IdMeteoVille) ); -GO - --- Create a new table called 'historique' in schema 'bddsurf' --- Drop the table if it already exists -IF OBJECT_ID('bddsurf.historique', 'U') IS NOT NULL -DROP TABLE bddsurf.historique -GO --- Create the table in the specified schema -CREATE TABLE bddsurf.historique +CREATE TABLE pointage ( - idHistorique INT NOT NULL PRIMARY KEY, -- primary key column + idPointage INT PRIMARY KEY NOT NULL AUTO_INCREMENT, -- primary key column + nbBaigneur INT, + nbPratiquant INT, + nbBateauPeche INT, + nbBateauLoisir INT, + nbBateauVoile INT, + produits INT NOT NULL, + niveauDechet INT, + CONSTRAINT fk_produitsPointage + FOREIGN KEY (produits) + REFERENCES produits(idProduits) +); +CREATE TABLE spot +( + idSpot INT PRIMARY KEY NOT NULL AUTO_INCREMENT, -- primary key column + nomSpot VARCHAR(50), + villeSpot INT NOT NULL, + meteoSpot INT NOT NULL, + pollutionSpot INT NOT NULL, + CONSTRAINT fk_villeSpot + FOREIGN KEY (villeSpot) + REFERENCES ville(idVille), + CONSTRAINT fk_meteoSpot + FOREIGN KEY (meteoSpot) + REFERENCES meteoSpot(idMeteoSpot), + CONSTRAINT fk_pollutionSpot + FOREIGN KEY (pollutionSpot) + REFERENCES pollution(idPollution) +); +CREATE TABLE historique +( + idHistorique INT PRIMARY KEY NOT NULL AUTO_INCREMENT, -- primary key column utilisateur INT NOT NULL, spot INT NOT NULL, pointage INT NOT NULL, CONSTRAINT fk_user FOREIGN KEY (utilisateur) - REFERENCES bddsurf.utilisateur(idUtilisateur) - -- specify more columns here + REFERENCES utilisateur(idUtilisateur), + CONSTRAINT fk_spot + FOREIGN KEY (spot) + REFERENCES spot(idSpot), + CONSTRAINT fk_pointage + FOREIGN KEY (pointage) + REFERENCES pointage(idPointage) ); -GO - --- Create a new table called 'pollution' in schema 'bddsurf' --- Drop the table if it already exists -IF OBJECT_ID('bddsurf.pollution', 'U') IS NOT NULL -DROP TABLE bddsurf.pollution -GO --- Create the table in the specified schema -CREATE TABLE bddsurf.pollution -( - idPollution INT NOT NULL PRIMARY KEY, -- primary key column - niveauPollution INT, - descriptionPollution VARCHAR - -- specify more columns here -); -GO - --- Create a new table called 'spot' in schema 'bddsurf' --- Drop the table if it already exists -IF OBJECT_ID('bddsurf.spot', 'U') IS NOT NULL -DROP TABLE bddsurf.spot -GO --- Create the table in the specified schema -CREATE TABLE bddsurf.spot -( - idSpot INT NOT NULL PRIMARY KEY, -- primary key column - nomSpot VARCHAR, - villeSpot INT NOT NULL, - meteoSpot INT NOT NULL, - pollutionSpot INT NOT NULL - -- specify more columns here -); -GO + From 8882ef65e1c5f3b96cb305a4f9b8129484945a64 Mon Sep 17 00:00:00 2001 From: lemoinealexandre Date: Fri, 4 Dec 2020 03:00:20 +0100 Subject: [PATCH 4/4] constructeur --- .idea/workspace.xml | 84 --------------------------------------------- php/Pointage.php | 2 +- 2 files changed, 1 insertion(+), 85 deletions(-) delete mode 100644 .idea/workspace.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 5fe496d..0000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1607026953826 - - - - - - - - - \ No newline at end of file diff --git a/php/Pointage.php b/php/Pointage.php index f6a9fea..1dc1ae7 100644 --- a/php/Pointage.php +++ b/php/Pointage.php @@ -22,6 +22,6 @@ class Pointage $this->bateauLoisir=$bateauLoisir; $this->bateauVoile=$bateauVoile; $this->produit=$produit; - $this->niveauDechet=$niveauDechet; + $this->niveauDechet=$niveauDechet; } } \ No newline at end of file