Git clean

This commit is contained in:
Vincent 2024-10-27 20:51:20 +01:00
parent 74cb4b1d90
commit bef0b378b5
43 changed files with 0 additions and 162 deletions

@ -1,54 +0,0 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
public class AllScore {
public static ArrayList<Integer> getScoresForSeries(int idSerie) {
ArrayList<Integer> scores = new ArrayList<>();
try { Class.forName("org.mariadb.jdbc.Driver");
}catch(ClassNotFoundException e ){
System.err.println("erreur db");
System.exit(1);
};
try { Connection cnx = DriverManager.getConnection(
"jdbc:mariadb://dwarves.iut-fbleau.fr/akagundu",
"akagundu", "dersim62Lodek");
try{
PreparedStatement pst = cnx.prepareStatement("SELECT Score from score where id_serie=?;");
pst.setInt(1, idSerie);
ResultSet rs = pst.executeQuery();
while(rs.next()) {
scores.add(rs.getInt(1));
}
rs.close();
pst.close();
cnx.close();
}
catch(SQLException e ){
System.err.println("erreur aff");
System.exit(2);
}
}catch(SQLException e ){
System.err.println("erreur cn");
System.exit(2);
};
return scores;
}
public static void main(String[] args) {
int idSerie = 1;
ArrayList<Integer> scores = getScoresForSeries(idSerie);
System.out.println("Scores for series " + idSerie + ": " + scores);
}
}

@ -1,64 +0,0 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class RecupTuile {
public String[][] recup(int idSerie) {
String[][] tuiles = new String[3][50];
int index = 0;
try {
Class.forName("org.mariadb.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.err.println("erreur db");
return tuiles;
}
try (Connection cnx = DriverManager.getConnection(
"jdbc:mariadb://dwarves.iut-fbleau.fr/akagundu",
"akagundu", "dersim62Lodek")) {
String query = "SELECT couleur1, couleur2, nombre FROM Tuile WHERE id_serie = ?";
try (PreparedStatement pst = cnx.prepareStatement(query)) {
pst.setInt(1, idSerie);
try (ResultSet rs = pst.executeQuery()) {
while (rs.next() && index < 50) {
String couleur1 = rs.getString(1);
String couleur2 = rs.getString(2);
int nombre = rs.getInt(3);
// Remplir le tableau
tuiles[0][index] = couleur1 != null ? couleur1 : "null";
tuiles[1][index] = couleur2 != null ? couleur2 : "null";
tuiles[2][index] = String.valueOf(nombre);
index++;
}
}
} catch (SQLException e) {
System.err.println("erreur aff " + e.getMessage());
}
} catch (SQLException e) {
System.err.println("erreur cn " + e.getMessage());
}
return tuiles;
}
public static void main(String[] args) {
RecupTuile recupTuile = new RecupTuile();
int idSerie = 1;
String[][] tuiles = recupTuile.recup(idSerie);
for (int i = 0; i < 50; i++) {
if (tuiles[0][i] != null) {
System.out.println("Tuile " + (i + 1) + ": Couleur 1 = " + tuiles[0][i] + ", Couleur 2 = " + tuiles[1][i] + ", Nombre = " + tuiles[2][i]);
}
}
}
}

@ -1,44 +0,0 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class SendScore {
public void insertscore(int idSerie,int score) {
try { Class.forName("org.mariadb.jdbc.Driver");
}catch(ClassNotFoundException e ){
System.err.println("erreur db");
System.exit(1);
};
try { Connection cnx = DriverManager.getConnection(
"jdbc:mariadb://dwarves.iut-fbleau.fr/akagundu",
"akagundu", "dersim62Lodek");
try{
PreparedStatement pst = cnx.prepareStatement("INSERT INTO Score (id_serie, score) VALUES (?, ?);");
pst.setInt(1, idSerie);
pst.setInt(2, score);
pst.executeUpdate();
pst.close();
cnx.close();
}
catch(SQLException e ){
System.err.println("erreur aff");
System.exit(2);
}
}catch(SQLException e ){
System.err.println("erreur cn");
System.exit(2);
};
}
public static void main(String[] args) {
int idSerie = 1;
int score=111;
SendScore sendScore = new SendScore();
sendScore.insertscore(idSerie, score);
System.out.println("Scores for series " + idSerie + ": " + score);
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

(image error) Size: 27 KiB

Binary file not shown.

Before

(image error) Size: 322 KiB

Binary file not shown.

Before

(image error) Size: 36 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.