我正在使用 CachedRowSetImpl 来存储从数据库中获取的数据。但我想用我自己的列替换前两列。我获取数据的代码是:
cachedRowSet = new CachedRowSetImpl();
cachedRowSet.setType(ResultSet.TYPE_SCROLL_INSENSITIVE);
cachedRowSet.setConcurrency(ResultSet.CONCUR_UPDATABLE);
cachedRowSet.setUrl(connection.getDbUrl());
cachedRowSet.setUsername(connection.getUserName());
cachedRowSet.setPassword(connection.getPassword());
workerThread.setProgressValue(40);
cachedRowSet.setCommand("select e.event_id,e.user_label,a.attempt_id,a.preferred,a.duration,a.location from event e,attempt a where e.user_label=? and e.start_time=? and e.end_time=? and e.duration_min=? and e.duration_max=? and e.event_id=a.event_id");
cachedRowSet.setString(1, event.getUserLabel());
cachedRowSet.setTimestamp(2, event.getStartTime());
cachedRowSet.setTimestamp(3, event.getEndTime());
cachedRowSet.setTimestamp(4, event.getDurationMin());
cachedRowSet.setTimestamp(5, event.getDurationMax());
因此,我想删除列 event_id 和 user_label,并首先放置包含已删除 event_id 和 user_label 的新列。
谢谢!