Package com.mysql.jdbc

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


    ArrayList<String[]> l = new ArrayList<String[]>();
    Connection connex;
    connex = getConnection();
    String select = "SELECT `idFilm`,`date` FROM `vente` WHERE `idClient` = ? AND `type` = ?";
    try {
      PreparedStatement preStat = (PreparedStatement) connex.prepareStatement(select);   
      preStat.setInt(1, c.getId());
      preStat.setString(2, "l");
      ResultSet rs = preStat.executeQuery();
      while(rs.next()){
        String loc[] = {rs.getString(1) , String.valueOf(rs.getLong(2))};
View Full Code Here


    ArrayList<String> l = new ArrayList<String>();
    Connection connex;
    connex = getConnection();
    String select = "SELECT  `idFilm` FROM `vente` WHERE `type` = ?";
    try {
      PreparedStatement preStat = (PreparedStatement) connex.prepareStatement(select);   
      preStat.setString(1, type);       
      ResultSet rs = preStat.executeQuery();
      while(rs.next()){
        l.add(rs.getString(1));
      }
View Full Code Here

  public int bonValide(int id) {
    Connection connex;
    connex = getConnection();
    String select = "SELECT `utilise` FROM `bon` WHERE `id`= ?";
    try {
      PreparedStatement preStat = (PreparedStatement) connex.prepareStatement(select);   
      preStat.setInt(1, id);       
      ResultSet rs = preStat.executeQuery();
      while(rs.next()){
        if(rs.getInt(1) == 0){
          int montant = -1;
View Full Code Here

      ResultSet rs = preStat.executeQuery();
      while(rs.next()){
        if(rs.getInt(1) == 0){
          int montant = -1;
          String select2 = "SELECT `prix` FROM `vente` WHERE `id` = ?";
          PreparedStatement preStat2 = (PreparedStatement) connex.prepareStatement(select2);   
          preStat2.setInt(1, id);       
          ResultSet rs2 = preStat2.executeQuery();
          while(rs2.next()){
            montant = rs2.getInt(1);
          }
View Full Code Here

  public void updateBon(Bon b) {
    Connection connex;
    connex = getConnection();
    String select = "UPDATE `bon` SET `idFilm`=?,`dateU`=?,`type`=?,`idClientU`=?,`utilise`=? WHERE `id` = ?";
    try {
      PreparedStatement preStat = (PreparedStatement) connex.prepareStatement(select);   
      preStat.setString(1, b.getIdFilm());
      preStat.setLong(2, b.getDateU());
      preStat.setString(3, b.getType());
      preStat.setInt(4, b.getIdClientU());
      preStat.setInt(5, b.getUtilise());
View Full Code Here

            PreparedStatement pstmt;


            // Inserir um novo objeto

            pstmt = con.prepareStatement("insert into usuario "
                    + "(usuario, senha)"
                    + "values"
                    + "(?, ?);");

            pstmt.setString(1, o.getUsuario());
View Full Code Here

            if (o == null) {
                return false;

            } else {
                pstmt = con.prepareStatement("select * from usuario "
                        + "where usuario = ? and senha = ? "
                        );
                pstmt.setString(1, o.getUsuario());
                pstmt.setString(2, o.getSenha());
                pstmt.setTimestamp(3, new Timestamp(new Date().getTime()));
View Full Code Here

                return null;

            } else {

                // Com restrição de limite de quantidade de retorno.
                pstmt = con.prepareStatement("select * from usuario where usuario = ?;");
                pstmt.setString(1, o.getUsuario());
            }

        } catch (SQLException sqlex) {
            //LogExcecao.registraExcecao(sqlex);
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.