Ejemplo n.º 1
0
  public String updateModifiedOnlySql(ValueObject obj, String[] fields) throws SQLException {

    if ((obj instanceof PT_KICA_ERR_LOGEntity) == false) {
      throw new SQLException("DAO 에러(1): PT_KICA_ERR_LOG : updateModifiedOnly() ");
    }
    PT_KICA_ERR_LOGEntity entity = (PT_KICA_ERR_LOGEntity) obj;

    HashMap clobs = new HashMap();

    if (fields == null) throw new SQLException("Field Name can not be Null");

    StringBuffer setString = new StringBuffer();
    boolean flag = false;
    for (int i = 0; i < fields.length; i++) {
      if (fields[i] == null) throw new SQLException("Field Name can not be Null");
      if (default_update_field.containsKey(fields[i]) == false) {
        if (flag) setString.append(",");
        flag = true;
        if (clobs.containsKey(fields[i])) {
          setString.append(fields[i]).append("=?");
        } else {
          setString.append(fields[i]).append("=").append(toDB(entity.getByName(fields[i])));
        }
      }
    }
    if (flag = false) throw new SQLException("Nothing to update");

    StringBuffer sb = new StringBuffer();
    sb.append("update PT_KICA_ERR_LOG  set ").append(setString.toString()).append(" where  1=1 ");

    sb.append(" and SEQ = ").append(toDB(entity.getSEQ()));

    return sb.toString();
  }
  public static String getFieldDesc(String key) {
    Integer idx = (Integer) fieldMap.get(key);
    if (idx != null)
      switch (idx.intValue()) {
        case 1:
          return "";
        case 2:
          return "";
        case 3:
          return "";
        case 4:
          return "";
        case 5:
          return "";
        case 6:
          return "";
        case 7:
          return "";
        case 8:
          return "";
        case 9:
          return "";
        case 10:
          return "";
        case 11:
          return "";
        case 12:
          return "";
        case 13:
          return "";
        case 14:
          return "";
        case 15:
          return "";
        case 16:
          return "";
        case 17:
          return "";
        case 18:
          return "";
        case 19:
          return "";
        case 20:
          return "";
        case 21:
          return "";
        case 22:
          return "";
        case 23:
          return "";
        case 24:
          return "";
        case 25:
          return "";
        case 26:
          return "";
        case 27:
          return "";
        case 28:
          return "";
        case 29:
          return "";
        case 30:
          return "";
        case 31:
          return "";
        case 32:
          return "";
        case 33:
          return "";
        case 34:
          return "";
        case 35:
          return "";
        case 36:
          return "";
        case 37:
          return "";
        case 38:
          return "";
        case 39:
          return "";
        case 40:
          return "";
        case 41:
          return "";
        case 42:
          return "";
        case 43:
          return "";
        case 44:
          return "";
        case 45:
          return "";
        case 46:
          return "";
        case 47:
          return "";
        case 48:
          return "";
        case 49:
          return "";
        case 50:
          return "";
        case 51:
          return "";
        case 52:
          return "";
        case 53:
          return "";
        case 54:
          return "";
        case 55:
          return "";
        case 56:
          return "";
        case 57:
          return "";
      }

    return null;
  }
 static {
   fieldMap.put(RECV_NUM, new Integer(1));
   fieldMap.put(SIDO_CODE, new Integer(2));
   fieldMap.put(COI_WRT_NUM, new Integer(3));
   fieldMap.put(MOT_STE, new Integer(4));
   fieldMap.put(DEFI_STE, new Integer(5));
   fieldMap.put(RECV_DT, new Integer(6));
   fieldMap.put(RECV_TIME, new Integer(7));
   fieldMap.put(PROC_LIM, new Integer(8));
   fieldMap.put(PROC_TIME, new Integer(9));
   fieldMap.put(COMMANA_CLASS, new Integer(10));
   fieldMap.put(MANA_NUM, new Integer(11));
   fieldMap.put(NAME, new Integer(12));
   fieldMap.put(REP_SSN1, new Integer(13));
   fieldMap.put(REP_SSN2, new Integer(14));
   fieldMap.put(REP_NM_KOR, new Integer(15));
   fieldMap.put(REP_NM_HAN, new Integer(16));
   fieldMap.put(REP_TEL_NUM, new Integer(17));
   fieldMap.put(ADDR_POST_NUM, new Integer(18));
   fieldMap.put(ADDR_ADDR, new Integer(19));
   fieldMap.put(ADDR_DETAIL_ADDR, new Integer(20));
   fieldMap.put(ADDR_TEL_NUM, new Integer(21));
   fieldMap.put(ADDR_FAX_NUM, new Integer(22));
   fieldMap.put(EMAIL_ADDR, new Integer(23));
   fieldMap.put(OFFICE_AREA, new Integer(24));
   fieldMap.put(OFFICE_USE_CODE, new Integer(25));
   fieldMap.put(COMPANY_DIAG_CLASS_CODE, new Integer(26));
   fieldMap.put(COMPANY_DIAG_BAS_DT, new Integer(27));
   fieldMap.put(COMPANY_DIAG_ISSUE_DT, new Integer(28));
   fieldMap.put(DIAG_ORG_CODE, new Integer(29));
   fieldMap.put(DIAG_NM_NM, new Integer(30));
   fieldMap.put(DIAG_NM_WRT_NUM, new Integer(31));
   fieldMap.put(PAY_CAP, new Integer(32));
   fieldMap.put(REA_CAP, new Integer(33));
   fieldMap.put(TUP_AOM, new Integer(34));
   fieldMap.put(TUP_CLASS_CODE, new Integer(35));
   fieldMap.put(COM_COV_DT, new Integer(36));
   fieldMap.put(BAS_STA_DT, new Integer(37));
   fieldMap.put(OFFICE_OWN_CLASS, new Integer(38));
   fieldMap.put(REP_MOBILE, new Integer(39));
   fieldMap.put(LICTAX, new Integer(40));
   fieldMap.put(HOSCRE, new Integer(41));
   fieldMap.put(COM_NUM, new Integer(42));
   fieldMap.put(GUBUN, new Integer(43));
   fieldMap.put(DOC_CODE, new Integer(44));
   fieldMap.put(OFFICE_USE_NAME, new Integer(45));
   fieldMap.put(MEMO_CONT, new Integer(46));
   fieldMap.put(WRT_ID, new Integer(47));
   fieldMap.put(INS_DT, new Integer(48));
   fieldMap.put(UPD_DT, new Integer(49));
   fieldMap.put(TMP_WRT_NUM, new Integer(50));
   fieldMap.put(WRT_DT, new Integer(51));
   fieldMap.put(CHG_DT, new Integer(52));
   fieldMap.put(CHGBRE_SEQ, new Integer(53));
   fieldMap.put(COMPANY_DIAG_BAS_DT2, new Integer(54));
   fieldMap.put(BUSS_YMD, new Integer(55));
   fieldMap.put(FOREIGN_YN, new Integer(56));
   fieldMap.put(REGIST_YMD, new Integer(57));
 }
Ejemplo n.º 4
0
  ///////////////////////////////////////////////////////////////////////////////////
  // 특정필드를 제외한 전체 필드를 수정한다.
  public int updateExcludeOnly(ValueObject obj, String[] fields) throws SQLException {

    fields = KJFUtil.getDifferenceOfSets(default_fields, fields);

    if ((obj instanceof PT_KICA_ERR_LOGEntity) == false) {
      throw new SQLException("DAO 에러(1): PT_KICA_ERR_LOG : updateModifiedOnly() ");
    }
    PT_KICA_ERR_LOGEntity entity = (PT_KICA_ERR_LOGEntity) obj;

    HashMap clobs = new HashMap();

    Connection conn = null;
    PreparedStatement ps = null;
    int result = 0;

    if (fields == null) throw new SQLException("Field Name can not be Null");

    StringBuffer setString = new StringBuffer();
    boolean flag = false;
    for (int i = 0; i < fields.length; i++) {
      if (fields[i] == null) throw new SQLException("Field Name can not be Null");
      if (default_update_field.containsKey(fields[i]) == false) {
        if (flag) setString.append(",");
        flag = true;
        if (clobs.containsKey(fields[i])) {
          setString.append(fields[i]).append("=?");
        } else {
          setString.append(fields[i]).append("=").append(toDB(entity.getByName(fields[i])));
        }
      }
    }
    if (flag = false) throw new SQLException("Nothing to update");

    StringBuffer sb = new StringBuffer();
    sb.append("update PT_KICA_ERR_LOG  set ").append(setString.toString()).append(" where  1=1 ");

    sb.append(" and SEQ = ").append(toDB(entity.getSEQ()));

    KJFLog.sql(sb.toString());

    try {

      conn = this.getConnection();
      ps = conn.prepareStatement(sb.toString());

      int k = 1;
      for (int i = 0; i < fields.length; i++) {
        if (clobs.containsKey(fields[i])) {

          ps.setString(k++, (entity.getByName(fields[i])).toString());
        }
      }

      result = ps.executeUpdate();

    } catch (SQLException e) {
      throw e;
    } finally {
      if (ps != null) ps.close();
      this.release(conn);
    }

    return result;
  }