resulution bug
This commit is contained in:
@@ -9,7 +9,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import com.test.beans.Client;
|
||||
import com.test.beans.ClientOld;
|
||||
import java.sql.PreparedStatement;
|
||||
|
||||
/**
|
||||
@@ -17,8 +17,7 @@ import java.sql.PreparedStatement;
|
||||
* @author emile.malcuit
|
||||
*/
|
||||
public class ClientMysql {
|
||||
private Connection laConnexion = connexionSQL.getConnect("192.168.100.100", "bdclient", "adminClient", "admin");
|
||||
|
||||
private Connection laConnexion = connexionSQL.getConnect("192.168.100.100", "bdclient", "adminClient", "mdpBDclient");
|
||||
public ClientMysql() {
|
||||
}
|
||||
|
||||
@@ -27,7 +26,7 @@ public class ClientMysql {
|
||||
}
|
||||
|
||||
|
||||
public void createClient(Client newCli) {
|
||||
public void createClient(ClientOld newCli) {
|
||||
String commande = "INSERT INTO client(nom, prenom, mail) VALUES (?, ?, ?)";
|
||||
|
||||
try (PreparedStatement pstmt = laConnexion.prepareStatement(commande)) {
|
||||
@@ -47,14 +46,14 @@ public class ClientMysql {
|
||||
|
||||
|
||||
|
||||
public ArrayList<Client> readAll(){
|
||||
ArrayList<Client> lesClients=new ArrayList<>();
|
||||
public ArrayList<ClientOld> readAll(){
|
||||
ArrayList<ClientOld> lesClients=new ArrayList<>();
|
||||
try {
|
||||
Statement stmt=laConnexion.createStatement();
|
||||
ResultSet resultQ=null;
|
||||
resultQ=stmt.executeQuery("SELECT * FROM client;");
|
||||
while (resultQ.next()){
|
||||
Client resultat=new Client(resultQ.getInt("id"),resultQ.getString("nom"),resultQ.getString("prenom"),resultQ.getString("mail"));
|
||||
ClientOld resultat=new ClientOld(resultQ.getInt("id"),resultQ.getString("nom"),resultQ.getString("prenom"),resultQ.getString("mail"));
|
||||
lesClients.add(resultat);
|
||||
}
|
||||
resultQ.close();
|
||||
@@ -70,9 +69,9 @@ public class ClientMysql {
|
||||
}
|
||||
|
||||
|
||||
public Client read(int id){
|
||||
public ClientOld read(int id){
|
||||
String commande = "SELECT * FROM client WHERE id = ?";
|
||||
Client recherche = new Client();
|
||||
ClientOld recherche = new ClientOld();
|
||||
|
||||
try(PreparedStatement pstmt = laConnexion.prepareStatement(commande)){
|
||||
pstmt.setString(1, Integer.toString(id));
|
||||
|
||||
Reference in New Issue
Block a user