コード例 #1
0
  public String generateUserInsertQuery(Staff staff) {

    StringBuffer strQuery = new StringBuffer(INSERT_USER_QUERY);
    strQuery.append(staff.getF_name());
    strQuery.append("', '");
    strQuery.append(staff.getL_name());
    strQuery.append("', '");
    strQuery.append(staff.getPassword());
    strQuery.append("', '");
    strQuery.append(staff.getEmail());
    strQuery.append("', '");
    strQuery.append(staff.getAddress());
    strQuery.append("', '");
    strQuery.append(staff.getCity());
    strQuery.append("', '");
    strQuery.append(staff.getState());
    strQuery.append("', '");
    strQuery.append(staff.getZipcode());
    strQuery.append("', '");
    strQuery.append(utility.convertStringToDate(staff.getDob()));
    strQuery.append("', '");
    strQuery.append(staff.getType());
    strQuery.append("')");

    System.out.println("Insert User query : " + strQuery.toString());

    return strQuery.toString();
  }
コード例 #2
0
  public void insertIntoStaffTable(int user_id, Staff staff) {

    StringBuffer strQuery = new StringBuffer(INSERT_STAFF_QUERY);
    strQuery.append(user_id);
    strQuery.append("', '");
    strQuery.append(staff.getStaff_ssn());
    strQuery.append("', '");
    strQuery.append(staff.getWork_desc());
    strQuery.append("', '");
    strQuery.append(staff.getPosition());
    strQuery.append("', '");
    strQuery.append(utility.convertStringToDate(staff.getHire_date()));
    strQuery.append("')");
    System.out.println("Insert Staff query : " + strQuery.toString());

    try {
      DBOperation.executeQuery(strQuery.toString());
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }