예제 #1
0
  public List select_status(String statusid, String statusname) {

    List statusList = new ArrayList();

    try {

      conn = agent.getConnectMYSql();

      String sqlQ = "select * from status";

      pStmt = conn.createStatement();
      rs = pStmt.executeQuery(sqlQ);

      while (rs.next()) {

        statusList.add(new StatusForm(rs.getString("statusid"), rs.getString("statusname")));
      }

    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    return statusList;
  }
예제 #2
0
  public void delete_from_status(String statusid) throws IOException, Exception {
    conn = agent.getConnectMYSql();
    String sqlQuery = "delete from status where statusid = '" + statusid + "'";

    pStmt = conn.createStatement();
    pStmt.executeUpdate(sqlQuery);

    conn.close();
    pStmt.close();
  }
예제 #3
0
  public void insert_to_status(String statusname) throws Exception {

    conn = agent.getConnectMYSql();

    String sqlQuery = "insert into status(statusname) value('" + statusname + "')";
    pStmt = conn.createStatement();
    pStmt.executeUpdate(sqlQuery);

    pStmt.close();
    conn.close();
  }
예제 #4
0
  public void update_status(String statusid, String statusname) throws Exception {

    conn = agent.getConnectMYSql();

    String sqlQuery =
        "update status set statusname = '" + statusname + "' where statusid = '" + statusid + "'";
    pStmt = conn.createStatement();
    pStmt.executeUpdate(sqlQuery);

    pStmt.close();
    conn.close();
  }
예제 #5
0
  public String[] select_from_status(String statusid) throws IOException, Exception {
    conn = agent.getConnectMYSql();
    String sqlQuery = "select statusid, statusname from status where statusid = '" + statusid + "'";

    String[] result = new String[2];

    pStmt = conn.createStatement();
    rs = pStmt.executeQuery(sqlQuery);
    while (rs.next()) {

      result[0] = rs.getString("statusid");
      result[1] = rs.getString("statusname");
    }
    rs.close();
    conn.close();
    pStmt.close();
    return result;
  }