Package com.mysql.jdbc

Examples of com.mysql.jdbc.Connection.prepareStatement()


    connex = getConnection();
    String insert = "INSERT INTO `user`(`id`, `pseudo`, `nom`, `prenom`, `solde`, `psswd`) VALUES ( ?, ?, ?, ?, ?, ?) ";

    try {
      // inscription
      PreparedStatement preStat = (PreparedStatement) connex
          .prepareStatement(insert);

      preStat.setInt(1, 0);
      preStat.setString(2, utilisateur.getPseudo());
      preStat.setString(3, utilisateur.getNom());
View Full Code Here


    Connection connex;
    boolean exist = false;
    connex = getConnection();
    String select = "SELECT * FROM user WHERE pseudo = ? ";
    try {
      PreparedStatement preStat = (PreparedStatement) connex
          .prepareStatement(select);

      preStat.setString(1, utilisateur.getPseudo());

      ResultSet rs = preStat.executeQuery();
View Full Code Here

    Connection connex;
    boolean exist = false;
    connex = getConnection();
    String select = "SELECT * FROM user WHERE pseudo = ? AND psswd = ?";
    try {
      PreparedStatement preStat = (PreparedStatement) connex
          .prepareStatement(select);

      preStat.setString(1, utilisateur.getPseudo());
      preStat.setString(2, utilisateur.getMotDePasse());

View Full Code Here

    Connection connex;
    int solde = -1;
    connex = getConnection();
    String select = "SELECT solde FROM user WHERE pseudo = ?";
    try {
      PreparedStatement preStat = (PreparedStatement) connex
          .prepareStatement(select);

      preStat.setString(1, utilisateur.getPseudo());
      ResultSet rs = preStat.executeQuery();
View Full Code Here

  public void updateSolde(Utilisateur utilisateur, int somme) {
    Connection connex;
    connex = getConnection();
    String select = "UPDATE user SET solde = solde + ? WHERE pseudo = ?";
    try {
      PreparedStatement preStat = (PreparedStatement) connex
          .prepareStatement(select);
      preStat.setInt(1, somme);
      preStat.setString(2, utilisateur.getPseudo());
      preStat.executeUpdate();
    } catch (SQLException ignore) {
View Full Code Here

    ArrayList<Utilisateur> l = new ArrayList<Utilisateur>();
    Connection connex;
    connex = getConnection();
    String select = "SELECT  * FROM `user`";
    try {
      PreparedStatement preStat = (PreparedStatement) connex
          .prepareStatement(select);

      ResultSet rs = preStat.executeQuery();
      while (rs.next()) {
        Utilisateur u = new Utilisateur();
View Full Code Here

    Connection connex;
    connex = getConnection();
    String delete = "DELETE FROM `user` WHERE id = ?";
    try {
      PreparedStatement preStat = (PreparedStatement) connex
          .prepareStatement(delete);
     
    for (Utilisateur u : list) {
      preStat.setInt(1, u.getId());     
      preStat.executeUpdate()
View Full Code Here

    int id = -1;
    Connection connex;
    connex = getConnection();
    String insert = "INSERT INTO `vente`(`idFilm`, `date`, `prix`, `idClient`, `type`) VALUES (?,?,?,?,?)";
    try {
      PreparedStatement preStat = (PreparedStatement) connex.prepareStatement(insert);   
      preStat.setString(1, v.getIdFilm());
      preStat.setLong(2, v.getDate());
      preStat.setInt(3, v.getPrix());
      preStat.setInt(4, v.getIdClient());
      preStat.setString(5, v.getType());
View Full Code Here

  public void ajouterBon(Bon b) {
    Connection connex;
    connex = getConnection();
    String insert = "INSERT INTO `bon`(`id`) VALUES (?)";
    try {
      PreparedStatement preStat = (PreparedStatement) connex.prepareStatement(insert);   
      preStat.setInt(1, b.getId());
      preStat.executeUpdate();
    }catch (SQLException ignore) {     
      System.out.println("erreur ajouterBon : " + ignore);
    }
View Full Code Here

    ArrayList<Vente> l = new ArrayList<Vente>();
    Connection connex;
    connex = getConnection();
    String select = "SELECT * FROM `vente` WHERE `idClient` = ?";
    try {
      PreparedStatement preStat = (PreparedStatement) connex.prepareStatement(select);   
      preStat.setInt(1, c.getId());       
      ResultSet rs = preStat.executeQuery();
      while(rs.next()){
        Vente v = new Vente();
        v.setId(rs.getInt(1));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.