public int updateByExternal(DataTransferObject newRecord, RecordDTO originalRecord)
      throws SQLException, Exception {
    checkConnection();

    // Connection conn = DButil.getConnection();
    SQLPlaceholder placeholder = getValuesFromDTO(newRecord);
    String sql =
        "UPDATE "
            + TABLE_NAME
            + " SET "
            + placeholder.createUpdate()
            + " WHERE external_id = '"
            + originalRecord.getExternalId()
            + "'"
            + " AND repository_code = '"
            + originalRecord.getRepositoryCode()
            + "'"
            + " AND record_type = "
            + originalRecord.getRecordType();

    PreparedStatement stmt = null;
    int rowNumber;
    try {
      stmt = conn.prepareStatement(sql);
      placeholder.replacePlaceholders(stmt);
      prglog.debug("[PRG] " + stmt.toString());
      lastSQL = stmt.toString();
      rowNumber = execute(stmt);
    } finally {
      stmt.close();
    }
    // DButil.closeConnection(conn);
    return rowNumber;
  }
  public int updateByTrackingId(DataTransferObject newRecord, int trackingId)
      throws SQLException, Exception {
    checkConnection();

    // Connection conn = DButil.getConnection();
    SQLPlaceholder placeholder = getValuesFromDTO(newRecord);
    String sql =
        "UPDATE "
            + TABLE_NAME
            + " SET "
            + placeholder.createUpdate()
            + " WHERE tracking_id = '"
            + trackingId
            + "'";
    PreparedStatement stmt = null;
    int rowNumber;
    try {
      stmt = conn.prepareStatement(sql);
      placeholder.replacePlaceholders(stmt);
      prglog.debug("[PRG] " + stmt.toString());
      lastSQL = stmt.toString();
      rowNumber = execute(stmt);
    } finally {
      stmt.close();
    }
    // DButil.closeConnection(conn);
    return rowNumber;
  }
  public int update(DataTransferObject newRecord, DataTransferObject oldRecord)
      throws SQLException, Exception {
    checkConnection();

    SQLPlaceholder placeholder = getValuesFromDTO(newRecord);
    SQLPlaceholder placeholderOld = getValuesFromDTO(oldRecord);
    String sql =
        "UPDATE "
            + TABLE_NAME
            + " SET "
            + placeholder.createUpdate()
            + " WHERE "
            + placeholderOld.createWhere();
    PreparedStatement stmt = null;
    int rowNumber;
    try {
      stmt = conn.prepareStatement(sql);
      placeholder.replacePlaceholders(stmt);
      placeholderOld.replacePlaceholders(stmt, placeholder.getDataValues().size() + 1);
      prglog.debug("[PRG] update SQL: " + stmt.toString());
      lastSQL = stmt.toString();
      rowNumber = execute(stmt);
    } finally {
      stmt.close();
    }
    // DButil.closeConnection(conn);

    return rowNumber;
  }