septembre + octobre
1
Anglish/.~lock.Best_Companies_to_Work.docx#
Normal file
@ -0,0 +1 @@
|
||||
,wamster,salle223-04,18.09.2023 11:47,file:///export/home/an22/wamster/.config/libreoffice/4;
|
BIN
Anglish/AMMARAG2Crypto2.docx
Executable file
BIN
Anglish/Best_Companies_to_Work.docx
Executable file
BIN
Anglish/FMO_transitive_verb.docx
Executable file
BIN
Anglish/Monthly ice cream sales.docx
Executable file
BIN
Anglish/ReponseQuestion.docx
Executable file
BIN
Anglish/Resume podcast.docx
Executable file
BIN
Anglish/WAMSTERG2FormMetaverseDebate.docx
Executable file
BIN
Anglish/Wamster+ Toolbox+ G2.docx
Executable file
BIN
Anglish/WamsterG2Crypto2.docx
Executable file
BIN
Anglish/WamsterG2crypto.docx
Executable file
BIN
Anglish/WamsterMollaWillatteG2MCQ.docx
Executable file
35
Anglish/adjectif.txt
Executable file
@ -0,0 +1,35 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|-----------------|
|
||||
| LES ADJECTIFS |
|
||||
|-----------------|
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|-------------------------------------------------------|-----|
|
||||
|thrill / to be thrilled | + |
|
||||
|-------------------------------------------------------|-----|
|
||||
|belief / optimism / to be optimistic | + |
|
||||
|-------------------------------------------------------|-----|
|
||||
|anxiety | - |
|
||||
|-------------------------------------------------------|-----|
|
||||
|denial / hope(=espoir) / to be hopeful vs hopeless | + |
|
||||
|-------------------------------------------------------|-----|
|
||||
|panic / anxiety | - |
|
||||
|-------------------------------------------------------|-----|
|
||||
|euphoria | + |
|
||||
|-------------------------------------------------------|-----|
|
||||
|capitulation / anger | - |
|
||||
|-------------------------------------------------------|-----|
|
||||
|disapointment / to be disappointed | - |
|
||||
|-------------------------------------------------------|-----|
|
||||
|
||||
|
||||
terrorisme
|
||||
énergie
|
||||
spéculation
|
BIN
Anglish/amawam.docx
Executable file
BIN
Anglish/english_question.08.03.23.docx
Executable file
BIN
Anglish/graph.docx
Executable file
BIN
Anglish/noir_us_force.docx
Executable file
BIN
Anglish/note.docx
Executable file
19
Anglish/phraseBiezzard.txt
Executable file
@ -0,0 +1,19 @@
|
||||
... you ... Thai food before? |
|
||||
a) have / eaten |
|
||||
b) has / eaten |
|
||||
c) will / eat |
|
||||
|
|
||||
|
|
||||
-----------------------------------------------------------------|
|
||||
My dad [...] me |
|
||||
a) left |
|
||||
b) has left |
|
||||
c) has leave |
|
||||
|
|
||||
-----------------------------------------------------------------|
|
||||
My mother [...] me that my litlle brother [...] kidnap by my dad.|
|
||||
a) has told, has been |
|
||||
b) has asked, have been |
|
||||
c) has told, has |
|
||||
d) has asked, has |
|
||||
-----------------------------------------------------------------|
|
BIN
Anglish/wamsterG2emotionscomp.docx
Executable file
BIN
Anglish/~$note.docx
Executable file
33
BD/TP01_Requetes_avec_agregats.txt
Executable file
@ -0,0 +1,33 @@
|
||||
SELECT Region, COUNT(ALL NumVin)
|
||||
FROM Vin
|
||||
GROUP BY Region;
|
||||
|
||||
|
||||
SELECT NUMVITIC, NOM, COUNT(ALL CRU)
|
||||
FROM VITICULTEUR NATURAL JOIN VIN
|
||||
GROUP BY NUMVITIC, NOM
|
||||
|
||||
|
||||
SELECT NOM, NUMBUVEUR,AVG(ALL QTTE)
|
||||
FROM BUVEUR NATURAL JOIN COMMANDE
|
||||
WHERE VILLE='PARIS'
|
||||
GROUP BY NOM, NUMBUVEUR;
|
||||
|
||||
|
||||
SELECT NOM, COUNT(*)
|
||||
FROM BUVEUR NATURAL JOIN COMMANDE
|
||||
GROUP BY NOM;
|
||||
|
||||
|
||||
SELECT NOM, SUM(ALL QTTE)
|
||||
FROM BUVEUR NATURAL JOIN COMMANDE
|
||||
GROUP BY NOM
|
||||
HAVING AVG(ALL QTTE) >= 12;
|
||||
|
||||
|
||||
SELECT NOM, NUMVITIC
|
||||
FROM VITICULTEUR NATURAL JOIN VIN
|
||||
GROUP BY NOM, NUMVITIC
|
||||
HAVING COUNT(DISTINCT CRU) >= 2;
|
||||
|
||||
|
32
BD/TP2.16.03.2023.txt
Executable file
@ -0,0 +1,32 @@
|
||||
Q1)
|
||||
CREATE VIEW VinDesViticulteurs (idVin, Cru, idViticulteur, NomViticulteur)
|
||||
AS SELECT NumVin, Cru, NumVitic, Nom
|
||||
FROM Vin natural join Viticulteur
|
||||
WHERE Region='BOURGOGNE';
|
||||
|
||||
Q2)
|
||||
CREATE VIEW CommandeBuveur(num, nom, nbCommande)
|
||||
AS SELECT NumBuveur, Nom, COUNT(*)
|
||||
FROM Buveur NATURAL JOIN Commande
|
||||
GROUP BY NumBuveur, Nom;
|
||||
|
||||
Q3)
|
||||
SELECT NumVitic, Nom
|
||||
FROM Viticulteur NATURAL JOIN Vin
|
||||
WHERE NumVin IN(SELECT NumVin FROM Commande);
|
||||
|
||||
Q4)
|
||||
SELECT NumVitic, Nom
|
||||
FROM Viticulteur
|
||||
WHERE NumVitic NOT IN(SELECT NumVitic FROM Vin NATURAL JOIN Commande);
|
||||
|
||||
Q5)
|
||||
SELECT NumVitic, Nom
|
||||
FROM Viticulteur NATURAL JOIN Vin NATURAL JOIN Commande
|
||||
WHERE Ville='PARIS'
|
||||
INTERSECT
|
||||
SELECT NumVitic, Nom
|
||||
FROM Viticulteur NATURAL JOIN Vin NATURAL JOIN Commande
|
||||
WHERE Ville='MACON'
|
||||
|
||||
Q6)
|
37
BD/TP4_BD_29.03.2023.txt
Executable file
@ -0,0 +1,37 @@
|
||||
CREATE TABLE AEROPORT
|
||||
(codeAeroport VARCHAR(15) PRIMARY KEY,
|
||||
nom Varchar(40),
|
||||
ville Varchar(40),
|
||||
pays Varchar(40)
|
||||
);
|
||||
|
||||
Create table VOL
|
||||
(numVol number primary key,
|
||||
compagnie varchar(40),
|
||||
periodeVol varchar(30)
|
||||
);
|
||||
|
||||
create table TYPE_AVION
|
||||
(nomType varchar(40) primary key,
|
||||
maxSieges number,
|
||||
nomConstructeur varchar(40)
|
||||
);
|
||||
|
||||
create table AVION
|
||||
(idAvion number primary key,
|
||||
totalSieges number,
|
||||
nomTypeAvion varchar(40) references TYPE_AVION
|
||||
);
|
||||
|
||||
create table PEUT_ATTERRIR
|
||||
(nomTypeAvion varchar(40) references TYPE_AVION,
|
||||
codeAeroprot varchar(15) references AEROPORT,
|
||||
Primary key(nomTypeAvion, codeAeroprot)
|
||||
);
|
||||
|
||||
create table PERSONEL
|
||||
(idPersonne number primary key,
|
||||
nom varchar(40),
|
||||
prenom varchar(40),
|
||||
fonction varchar(40)
|
||||
);
|
104
BD/TP5_BD_29.03.2023.txt
Executable file
@ -0,0 +1,104 @@
|
||||
|
||||
Q1)
|
||||
CREATE TABLE AUTEUR
|
||||
NumAuteur number primary key,
|
||||
NomAuteur Varchar(20)
|
||||
);
|
||||
|
||||
Insert into AUTEUR
|
||||
VALUES
|
||||
(1,'wamster');
|
||||
Insert into AUTEUR
|
||||
VALUES
|
||||
(2,'Wiliatt');
|
||||
Insert into AUTEUR
|
||||
VALUES
|
||||
(3,'Schnur');
|
||||
Insert into AUTEUR
|
||||
VALUES
|
||||
(4,'JKwroling');
|
||||
Insert into AUTEUR
|
||||
VALUES
|
||||
(5,'Squeezie');
|
||||
Insert into AUTEUR
|
||||
VALUES
|
||||
(6,'Lov');
|
||||
Insert into AUTEUR
|
||||
VALUES
|
||||
(7,'Apolinaire');
|
||||
|
||||
|
||||
CREATE TABLE EDITEUR
|
||||
(CodeEditer number primary key,
|
||||
RaisonSociale Varchar(50)
|
||||
);
|
||||
|
||||
Insert into EDITEUR
|
||||
VALUES (1,'FOU');
|
||||
Insert into EDITEUR
|
||||
VALUES (2,'RIEN');
|
||||
Insert into EDITEUR
|
||||
VALUES (3,'PERSONNE');
|
||||
Insert into EDITEUR
|
||||
VALUES (4,'INTELLIGENT');
|
||||
Insert into EDITEUR
|
||||
VALUES (5,'SKIZOFRIEND');
|
||||
|
||||
|
||||
|
||||
2)
|
||||
----------------------------------------------
|
||||
RAPPEL:
|
||||
<nom_attribut> (type_attribut> REFERENCES <table_parente>
|
||||
(ON DELETE / ON UPDATE) (CASCADE / SET DEFAULT / SET NULL)
|
||||
----------------------------------------------
|
||||
|
||||
CREATE TABLE LIVRE
|
||||
(NumLivre number primary key,
|
||||
Titre Varchar(60),
|
||||
CodeEditeur number references EDITEUR ON DELETE SET NULL
|
||||
);
|
||||
|
||||
INSERT INTO LIVRE
|
||||
VALUES (1,'Harry Potter',4);
|
||||
INSERT INTO LIVRE
|
||||
VALUES (2,'Tournes la page',3);
|
||||
INSERT INTO LIVRE
|
||||
VALUES (3,'Roger et ses humains',3);
|
||||
INSERT INTO LIVRE
|
||||
VALUES (4,'devenir courreur pro en 10 conseils',1);
|
||||
INSERT INTO LIVRE
|
||||
VALUES (5,'geu',1);
|
||||
|
||||
DELETE FROM EDITEUR WHERE RaisonSociale='PERSONNE';
|
||||
|
||||
SELECT *
|
||||
FROM LIVRE;
|
||||
|
||||
|
||||
|
||||
3)
|
||||
|
||||
CREATE TABLE A_ECRIT
|
||||
(NumAuteur number references AUTEUR ON DELETE SET NULL,
|
||||
NumLivre number references LIVRE ON DELETE CASCADE,
|
||||
Primary key(NumAuteur,NumLivre)
|
||||
);
|
||||
|
||||
INSERT INTO A_ECRIT
|
||||
VALUES (1,4);
|
||||
INSERT INTO A_ECRIT
|
||||
VALUES (2,5);
|
||||
INSERT INTO A_ECRIT
|
||||
VALUES (4,1);
|
||||
INSERT INTO A_ECRIT
|
||||
VALUES (5,2);
|
||||
INSERT INTO A_ECRIT
|
||||
VALUES (6,3);
|
||||
|
||||
DELETE FROM Livre WHERE Titre='devenir courreur pro en 10 conseils';
|
||||
SELECT * FROM A_ECRIT;
|
||||
|
||||
|
||||
DELETE FROM AUTEUR WHERE NomAuteur='Lov';
|
||||
|
89
BD/TP_BD_06.04.2023.txt
Executable file
@ -0,0 +1,89 @@
|
||||
connection: wamster iut ora2 nomal
|
||||
|
||||
Q1)----------------------------------------------------------------------------------------------------------------
|
||||
CREATE USER wamster_prop1 identified by iut default tablespace datausers4F temporary tablespace temp;
|
||||
CREATE USER wamster_prop2 identified by iut default tablespace datausers4F temporary tablespace temp;
|
||||
grant connect, resource to wamster_prop1, wamster_prop2
|
||||
|
||||
Q2)a)----------------------------------------------------------------------------------------------------------------
|
||||
create table Client(
|
||||
login varchar2(20) primary key,
|
||||
nomClient varchar2(30),
|
||||
prenomClient varchar2(30)
|
||||
);
|
||||
|
||||
create table Film(
|
||||
numFilm integer primary key,
|
||||
nomFilm varchar2(30)
|
||||
);
|
||||
|
||||
create table Location(
|
||||
login varchar2(20) references Client,
|
||||
numFilm integer references Film,
|
||||
dateLocation Date,
|
||||
primary key(login,numFilm)
|
||||
);
|
||||
|
||||
b)
|
||||
insert into Client
|
||||
values ('WAMSTER_PROP1', 'Wamster', 'Willy');
|
||||
insert into Client
|
||||
values ('WAMSTER_PROP2', 'Wamster', 'Marty');
|
||||
insert into Client
|
||||
values ('WAMSTER', 'Wamster', 'Alexis');
|
||||
|
||||
insert into Film
|
||||
values (0, 'Harry Poter');
|
||||
insert into Film
|
||||
values (1, 'L''armée des 12 singes');
|
||||
insert into Film
|
||||
values (2, 'Avenger: infinity war');
|
||||
|
||||
insert into Location
|
||||
values('WAMSTER_PROP1',2,'13-12-2002');
|
||||
insert into Location
|
||||
values('WAMSTER_PROP1',1,'12-12-2012');
|
||||
insert into Location
|
||||
values('WAMSTER_PROP2',2,'12-01-2008');
|
||||
insert into Location
|
||||
values('WAMSTER_PROP2',1,'20-02-2002');
|
||||
insert into Location
|
||||
values('WAMSTER',0,'28-05-2004');
|
||||
insert into Location
|
||||
values('WAMSTER',1,'11-11-2011');
|
||||
|
||||
c)
|
||||
create view Mes_Locations
|
||||
as select nomClient, numFilm, dateLocation
|
||||
From Client natural join Location
|
||||
where login=user;
|
||||
grant select on Mes_Locations to public;
|
||||
|
||||
Q3)----------------------------------------------------------------------------------------------------------------
|
||||
select * from Client; => table inexistante
|
||||
|
||||
select * from wamster_prop1.Client;
|
||||
|
||||
Q4)a)----------------------------------------------------------------------------------------------------------------
|
||||
grant select on Mes_Locations to wamster_prop2;
|
||||
grant select,insert,update on Location to wamster_prop2;
|
||||
create view VClient
|
||||
as select nomClient, prenomClient
|
||||
from Client;
|
||||
grant insert,update on VClient to wamster_prop2;
|
||||
grant insert on Film to wamster_prop2;
|
||||
|
||||
b)
|
||||
select * from wamster_prop1.Mes_Locations;
|
||||
|
||||
c)
|
||||
insert into wamster_prop1.Film
|
||||
values (3,'Les aventures de Jordan');
|
||||
insert into wamster_prop1.Client
|
||||
values ('koumbisamba','Cyril','Koumbisamba');
|
||||
delete from wamster_prop1.Client
|
||||
where login='koumbisamba';
|
||||
delete from wamster_prop1.Film
|
||||
where numFilm=3;
|
||||
|
||||
|
2
DEV/DEV3.1/TP01_BD/.bashrc
Normal file
@ -0,0 +1,2 @@
|
||||
alias javacdb='javac -cp ".:/export/documents/mariadb-client.jar"'
|
||||
alias javadb='java -cp ".:/export/documents/mariadb-client.jar"'
|
1
DEV/DEV3.1/TP01_BD/.bashrc~
Normal file
@ -0,0 +1 @@
|
||||
alias javacdb='java -cp ".:/export/documents/mariadb-client.jar"'
|
BIN
DEV/DEV3.1/TP01_BD/Q1Main.class
Normal file
116
DEV/DEV3.1/TP01_BD/Q1Main.java
Normal file
@ -0,0 +1,116 @@
|
||||
import org.mariadb.jdbc.*;
|
||||
import java.sql.*;
|
||||
|
||||
public class Q1Main{
|
||||
public static void main(String[] args) {
|
||||
if (args.length < 1){
|
||||
System.out.println("Arguments invalide");
|
||||
System.exit(0);
|
||||
}
|
||||
String pays = args[0];
|
||||
try{
|
||||
int idPays = -1;
|
||||
Connection cnx = DriverManager.getConnection(
|
||||
"jdbc:mariadb://dwarves.iut-fbleau.fr/wamster",
|
||||
"wamster","32201909");
|
||||
try {
|
||||
Class.forName("org.mariadb.jdbc.Driver");
|
||||
}
|
||||
catch(ClassNotFoundException e){
|
||||
System.out.println("ClassNotFoundException");
|
||||
cnx.close();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
|
||||
// recuperation de l'id du pays entree en ligne de commande
|
||||
try {
|
||||
PreparedStatement pst = cnx.prepareStatement(
|
||||
"SELECT idPays FROM DEV31TP01Q1_ListePays WHERE nomPays=?");
|
||||
pst.setString(1, pays);
|
||||
ResultSet rs = pst.executeQuery();
|
||||
pst.close();
|
||||
if (rs.next()){
|
||||
idPays = rs.getInt("idPays");
|
||||
}
|
||||
rs.close();
|
||||
if (idPays == -1){
|
||||
System.out.println("Pays inconnus");
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
catch(SQLException e){
|
||||
System.out.println("probleme de select 1");
|
||||
cnx.close();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
// recuperation des score du pays
|
||||
try {
|
||||
PreparedStatement pst = cnx.prepareStatement(
|
||||
"SELECT * FROM DEV31TP01Q1_score WHERE idCompetiteurs=?");
|
||||
pst.setInt(1, idPays);
|
||||
ResultSet rsid = pst.executeQuery();
|
||||
pst.close();
|
||||
int scoreTotal = 0;
|
||||
|
||||
//recuperation du nom du votant à partir de son id
|
||||
try{
|
||||
pst = cnx.prepareStatement(
|
||||
"SELECT nomPays FROM DEV31TP01Q1_ListePays WHERE idPays=?");
|
||||
while (rsid.next()){
|
||||
int idVotant = rsid.getInt("idVotants");
|
||||
int score = rsid.getInt("score");
|
||||
String nomVotant = null;
|
||||
pst.setInt(1, idVotant);
|
||||
ResultSet rsnom = pst.executeQuery();
|
||||
if (rsnom.next()){
|
||||
nomVotant = rsnom.getString("NomPays");
|
||||
}
|
||||
rsnom.close();
|
||||
|
||||
// affichage du score qu'a donne le votant (aligner proprement)
|
||||
System.out.print(nomVotant);
|
||||
int espaceAAjouter = 20 - (nomVotant.length() + Integer.toString(score).length());
|
||||
for (int i=0; i<espaceAAjouter; i++){
|
||||
System.out.print(" ");
|
||||
}
|
||||
System.out.println(score);
|
||||
scoreTotal += score;
|
||||
}
|
||||
pst.close();
|
||||
rsid.close();
|
||||
|
||||
//affichage du score total
|
||||
for (int i=0; i<17; i++){
|
||||
System.out.print(" ");
|
||||
}
|
||||
System.out.println("___");
|
||||
int espaceAAjouter = 20 - ("Total".length() + Integer.toString(scoreTotal).length());
|
||||
System.out.print("Total");
|
||||
for (int i=0; i<espaceAAjouter; i++){
|
||||
System.out.print(" ");
|
||||
}
|
||||
System.out.println(scoreTotal);
|
||||
|
||||
}
|
||||
catch(SQLException e){
|
||||
System.out.println("probleme de select ?");
|
||||
cnx.close();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
}
|
||||
catch(SQLException e){
|
||||
System.out.println("probleme de select 2");
|
||||
cnx.close();
|
||||
System.exit(0);
|
||||
}
|
||||
cnx.close();
|
||||
|
||||
}
|
||||
catch(SQLException e){
|
||||
System.out.println("SQLException");
|
||||
}
|
||||
}
|
||||
}
|
65
DEV/DEV3.1/TP01_BD/Q1Main.java~
Normal file
@ -0,0 +1,65 @@
|
||||
import org.mariadb.jdbc.*;
|
||||
import java.sql.*;
|
||||
|
||||
public class Q1Main{
|
||||
public static void main(String[] args) {
|
||||
if (args.length < 1){
|
||||
System.out.println("Arguments invalide");
|
||||
System.exit(0);
|
||||
}
|
||||
String pays = args[0];
|
||||
try{
|
||||
Connection cnx = DriverManager.getConnection(
|
||||
"jdbc:mariadb://dwarves.iut-fbleau.fr/wamster",
|
||||
"wamster","32201909");
|
||||
try {
|
||||
Class.forName("org.mariadb.jdbc.Driver");
|
||||
}
|
||||
catch(ClassNotFoundException e){
|
||||
System.out.println("ClassNotFoundException");
|
||||
cnx.close();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
|
||||
// récupération de l'id du pays entrée en ligne de commande
|
||||
try {
|
||||
PreparedStatement pst = cnx.prepareStatement(
|
||||
"SELECT idPays FROM DEV31TP01Q1_ListePays WHERE nomPays=?");
|
||||
pst.setString(1, pays);
|
||||
ResultSet rs = pst.executeQuery();
|
||||
pst.close();
|
||||
int idPays = -1;
|
||||
if (rs.next()){
|
||||
idPays = rs.getInt("idPays");
|
||||
}
|
||||
rs.close();
|
||||
if (idPays == -1){
|
||||
System.out.println("Pays inconnus");
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
catch(SQLException e){
|
||||
System.out.println("problème de select 1");
|
||||
cnx.close();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
// récupération des score du pays
|
||||
PreparedStatement pst = cnx.prepareStatement(
|
||||
"SELECT * FROM DEV31TP01Q1_score WHERE idCompetiteurs=?");
|
||||
pst.setInt(1, idPays);
|
||||
ResultSet rs = pst.executeQuery();
|
||||
while (rs.next()){
|
||||
System.out.println(rs.getInt("idCompetiteurs")+" "+rs.getInt("idVotants")+" "+rs.getInt("score"));
|
||||
}
|
||||
rs.close();
|
||||
pst.close();
|
||||
cnx.close();
|
||||
|
||||
}
|
||||
catch(SQLException e){
|
||||
System.out.println("SQLException");
|
||||
}
|
||||
}
|
||||
}
|
BIN
DEV/DEV3.1/TP01_BD/Q2BestPays.class
Normal file
64
DEV/DEV3.1/TP01_BD/Q2BestPays.java
Normal file
@ -0,0 +1,64 @@
|
||||
import org.mariadb.jdbc.*;
|
||||
import java.sql.*;
|
||||
|
||||
public class Q2BestPays{
|
||||
public static String[] bestPays() {
|
||||
try{
|
||||
int idPays = -1;
|
||||
String nomPays = null;
|
||||
String bestPays = null;
|
||||
int score = 0;
|
||||
int bestScore = 0;
|
||||
|
||||
Connection cnx = DriverManager.getConnection(
|
||||
"jdbc:mariadb://dwarves.iut-fbleau.fr/wamster",
|
||||
"wamster","32201909");
|
||||
try {
|
||||
Class.forName("org.mariadb.jdbc.Driver");
|
||||
}
|
||||
catch(ClassNotFoundException e){
|
||||
cnx.close();
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
PreparedStatement pstCompetiteur = cnx.prepareStatement(
|
||||
"SELECT * FROM DEV31TP01Q1_ListePays");
|
||||
ResultSet rsCompetiteur = pstCompetiteur.executeQuery();
|
||||
while (rsCompetiteur.next()){
|
||||
idPays = rsCompetiteur.getInt("idPays");
|
||||
nomPays = rsCompetiteur.getString("NomPays");
|
||||
score = 0;
|
||||
PreparedStatement pstScore = cnx.prepareStatement(
|
||||
"SELECT score FROM DEV31TP01Q1_score WHERE idCompetiteurs=?");
|
||||
pstScore.setInt(1, idPays);
|
||||
ResultSet rsScore = pstScore.executeQuery();
|
||||
pstScore.close();
|
||||
while (rsScore.next()){
|
||||
score += rsScore.getInt("score");
|
||||
}
|
||||
rsScore.close();
|
||||
if (score > bestScore){
|
||||
bestScore = score;
|
||||
bestPays = nomPays;
|
||||
}
|
||||
}
|
||||
rsCompetiteur.close();
|
||||
pstCompetiteur.close();
|
||||
if (idPays == -1){
|
||||
cnx.close();
|
||||
return null;
|
||||
}
|
||||
cnx.close();
|
||||
return new String[] {bestPays, Integer.toString(bestScore)};
|
||||
}
|
||||
catch(SQLException e){
|
||||
cnx.close();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch(SQLException e){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
BIN
DEV/DEV3.1/TP01_BD/Q2Evenement.class
Normal file
22
DEV/DEV3.1/TP01_BD/Q2Evenement.java
Normal file
@ -0,0 +1,22 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class Q2Evenement implements ActionListener{
|
||||
public JLabel pays;
|
||||
public JLabel score;
|
||||
|
||||
public Q2Evenement(JLabel pays, JLabel score){
|
||||
this.pays = pays;
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent evenement){
|
||||
String[] bestPays = Q2BestPays.bestPays();
|
||||
if (bestPays != null){
|
||||
this.pays.setText(bestPays[0]);
|
||||
this.score.setText(bestPays[1]);
|
||||
}
|
||||
}
|
||||
}
|
BIN
DEV/DEV3.1/TP01_BD/Q2Main.class
Normal file
35
DEV/DEV3.1/TP01_BD/Q2Main.java
Normal file
@ -0,0 +1,35 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class Q2Main{
|
||||
public static void main(String[] args) {
|
||||
|
||||
JFrame fenetre = new JFrame("Question 2");
|
||||
fenetre.setSize(300, 200);
|
||||
fenetre.setLocation(700, 300);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
JLabel labelPays = new JLabel("", JLabel.CENTER);
|
||||
JLabel labelScore = new JLabel("", JLabel.CENTER);
|
||||
|
||||
JButton bouton = new JButton("o");
|
||||
JPanel bas = new JPanel(new BorderLayout());
|
||||
bas.add(bouton,BorderLayout.EAST);
|
||||
|
||||
String[] bestPays = Q2BestPays.bestPays();
|
||||
if (bestPays != null){
|
||||
labelPays.setText(bestPays[0]);
|
||||
labelScore.setText(bestPays[1]);
|
||||
}
|
||||
|
||||
fenetre.add(labelPays, BorderLayout.NORTH);
|
||||
fenetre.add(labelScore, BorderLayout.CENTER);
|
||||
fenetre.add(bas, BorderLayout.SOUTH);
|
||||
|
||||
Q2Evenement evenementBouton = new Q2Evenement(labelPays, labelScore);
|
||||
bouton.addActionListener(evenementBouton);
|
||||
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
56
DEV/DEV3.1/TP01_BD/Question1.java~
Normal file
@ -0,0 +1,56 @@
|
||||
import org.mariadb.jdbc.*;
|
||||
|
||||
public class Q1Main{
|
||||
public static void main(String[] args) {
|
||||
if (args.length < 1){
|
||||
System.out.println("Arguments invalide");
|
||||
return 0;
|
||||
}
|
||||
String pays = args[0];
|
||||
try{
|
||||
Connection cnx = DriverManager.getConnection(
|
||||
"jdbc:mariadb://dwarves.iut-fbleau.fr/wamster",
|
||||
"wamster","...");
|
||||
try {
|
||||
Class.forName("org.mariadb.jdbc.Driver");
|
||||
}
|
||||
catch(ClassNotFoundException){
|
||||
System.out.println("ClassNotFoundException");
|
||||
cnx.close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// récupération de l'id du pays entrée en ligne de commande
|
||||
PreparedStatement pst = cnx.prepareStatement(
|
||||
"SELECT idPays FROM DEV31TP01Q1_ListePays WHERE nomPays=?");
|
||||
pst.setString(1, pays);
|
||||
ResultSet rs = pst.executeQuery();
|
||||
pst.close();
|
||||
int idPays = null;
|
||||
if (rs.next()){
|
||||
idPays = rs;
|
||||
}
|
||||
rs.close();
|
||||
if (idPays == null){
|
||||
System.out.println("Pays inconnus");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// récupération des score du pays
|
||||
PreparedStatement pst = cnx.prepareStatement(
|
||||
"SELECT * FROM DEV31TP01Q1_score WHERE idCompetiteurs=?");
|
||||
pst.setInt(1, idPays);
|
||||
ResultSet rs = pst.executeQuery();
|
||||
while (rs.next()){
|
||||
System.out.println(rs);
|
||||
}
|
||||
rs.close();
|
||||
pst.close();
|
||||
|
||||
}
|
||||
catch(SQLException){
|
||||
System.out.println("SQLException");
|
||||
cnx.close();
|
||||
}
|
||||
}
|
||||
}
|
0
DEV/DEV3.1/TP02_Transitions/Image.java~
Normal file
BIN
DEV/DEV3.1/TP02_Transitions/Images/0000000.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
DEV/DEV3.1/TP02_Transitions/Images/0000100.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
DEV/DEV3.1/TP02_Transitions/Images/0000200.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
DEV/DEV3.1/TP02_Transitions/Images/0000300.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
DEV/DEV3.1/TP02_Transitions/Images/0000400.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
DEV/DEV3.1/TP02_Transitions/Images/0000500.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
DEV/DEV3.1/TP02_Transitions/Images/0000600.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
DEV/DEV3.1/TP02_Transitions/Images/0000700.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
DEV/DEV3.1/TP02_Transitions/Images/0000800.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
DEV/DEV3.1/TP02_Transitions/Images/0000900.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
DEV/DEV3.1/TP02_Transitions/Images/0001000.png
Normal file
After Width: | Height: | Size: 21 KiB |