/**
  * Create a cached result set with the same columns as an existing result set.
  *
  * @param rs The result set to copy.
  * @throws SQLException
  */
 CachedResultSet(JtdsResultSet rs) throws SQLException {
   super(
       (JtdsStatement) rs.getStatement(),
       ResultSet.TYPE_FORWARD_ONLY,
       ResultSet.CONCUR_UPDATABLE,
       null,
       false);
   this.columns = rs.getColumns();
   this.columnCount = getColumnCount(columns);
   this.rowData = new ArrayList(INITIAL_ROW_COUNT);
   this.rowsInResult = 0;
   this.initialRowCnt = 0;
   this.pos = POS_BEFORE_FIRST;
   this.tempResultSet = true;
   this.cursorName = null;
 }
 /** Close current result set (if any). */
 void closeCurrentResultSet() {
   try {
     if (currentResult != null) {
       currentResult.close();
     }
   } catch (SQLException e) {
     // Ignore
   } finally {
     currentResult = null;
   }
 }
  /**
   * Set the specified column's data value.
   *
   * @param colIndex The index of the column in the row.
   * @param value The new column value.
   */
  protected void setColValue(int colIndex, int jdbcType, Object value, int length)
      throws SQLException {

    super.setColValue(colIndex, jdbcType, value, length);

    if (!onInsertRow && currentRow == null) {
      throw new SQLException(Messages.get("error.resultset.norow"), "24000");
    }
    colIndex--;
    ParamInfo pi;
    ColInfo ci = columns[colIndex];

    if (onInsertRow) {
      pi = insertRow[colIndex];
      if (pi == null) {
        pi = new ParamInfo(-1);
        pi.collation = ci.collation;
        pi.charsetInfo = ci.charsetInfo;
        insertRow[colIndex] = pi;
      }
    } else {
      if (updateRow == null) {
        updateRow = new ParamInfo[columnCount];
      }
      pi = updateRow[colIndex];
      if (pi == null) {
        pi = new ParamInfo(-1);
        pi.collation = ci.collation;
        pi.charsetInfo = ci.charsetInfo;
        updateRow[colIndex] = pi;
      }
    }

    if (value == null) {
      pi.value = null;
      pi.length = 0;
      pi.jdbcType = ci.jdbcType;
      pi.isSet = true;
    } else {
      pi.value = value;
      pi.length = length;
      pi.isSet = true;
      pi.jdbcType = jdbcType;
      pi.isUnicode =
          ci.sqlType.equals("ntext") || ci.sqlType.equals("nchar") || ci.sqlType.equals("nvarchar");
    }
  }
 public void setFetchSize(int size) throws SQLException {
   sizeChanged = size != fetchSize;
   super.setFetchSize(size);
 }