コード例 #1
0
 /**
  * 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;
 }
コード例 #2
0
 /** Close current result set (if any). */
 void closeCurrentResultSet() {
   try {
     if (currentResult != null) {
       currentResult.close();
     }
   } catch (SQLException e) {
     // Ignore
   } finally {
     currentResult = null;
   }
 }
コード例 #3
0
  /**
   * 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");
    }
  }
コード例 #4
0
 public void setFetchSize(int size) throws SQLException {
   sizeChanged = size != fetchSize;
   super.setFetchSize(size);
 }