如何获取cachedrowset特定列的原始值?

时间:2015-11-25 02:48:52

标签: java jdbc cachedrowset

它返回select列的当前值,我只需要返回原始值以检查值是否真的发生了变化。

while(rs.next()){
    if (rs.rowUpdated){
        String strOrigVal = "";
        rs.getOriginalRow();
        strOrigVal = rs.getString("col1");
    }
}

1 个答案:

答案 0 :(得分:2)

ResultSet getOriginalRow()
                     throws SQLException
while(rs.next()){
  if (rs.rowUpdated){
      String strOrigVal = "";
      ResultSet ors = rs.getOriginalRow(); //you should catch the return value
      if(ors.next()){ //move to the first cursor
        strOrigVal = ors.getString("col1");
      }    
  }
}