org.firebirdsql.jdbc

## Class FBUpdatableCursorFetcher

- java.lang.Object
- - org.firebirdsql.jdbc.FBUpdatableCursorFetcher

    public class FBUpdatableCursorFetcher
    extends java.lang.Object

Statement fetcher for updatable cursor case. This fetcher keeps cursor position consistent, however we cannot tell now if we are on the last record. Method `isLast()`throws exception now.

Author:
  Roman Rokytskyy, Mark Rotteveel

### Field Summary

Fields
`protected RowValue` `_nextRow`
`protected FBObjectListener.FetcherListener` `fetcherListener`
`protected int` `fetchSize`
`protected GDSHelper` `gdsHelper`
`static int` `MAX_FETCH_ROWS`
`protected int` `maxRows`
`protected FbStatement` `stmt`
`protected Synchronizable` `syncProvider`

### Method Summary

Methods
`boolean` `absolute(int row)` Move cursor to the absolute row.
`void` `afterLast()` Move cursor after last record.
`void` `beforeFirst()` Move cursor before first record.
`void` `close()` Close this fetcher and corresponding result set.
`void` `close(CompletionReason completionReason)` Close this fetcher and corresponding result set.
`void` `deleteRow()` Delete row at current position.
`void` `fetch()`
`boolean` `first()` Move cursor to the rist row.
`int` `getFetchSize()` Set the suggested number of rows to fetch with each batch fetch.
`protected RowValue` `getNextRow()`
`int` `getRowNum()` Get row number.
`void` `insertRow(RowValue data)` Insert row at current position.
`boolean` `isAfterLast()`
`boolean` `isBeforeFirst()`
`boolean` `isEmpty()`
`boolean` `isFirst()`
`boolean` `isLast()`
`boolean` `last()` Move cursor to the last row.
`boolean` `next()` Move to next row.
`boolean` `previous()` Move cursor to the previous row.
`boolean` `relative(int row)` Move cursor relative to the current row.
`void` `setFetchSize(int fetchSize)` Get the suggested number of rows to fetch with each batch fetch.
`void` `setIsAfterLast(boolean isAfterLastValue)`
`void` `setIsBeforeFirst(boolean isBeforeFirstValue)`
`void` `setIsEmpty(boolean isEmptyValue)`
`void` `setIsFirst(boolean isFirstValue)`
`void` `setIsLast(boolean isLastValue)`
`protected void` `setNextRow(RowValue nextRow)`
`void` `setRowNum(int rowNumValue)`
`void` `updateRow(RowValue data)` Update row at current position.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### gdsHelper

    protected final GDSHelper gdsHelper

#### fetcherListener

    protected final FBObjectListener.FetcherListener fetcherListener

#### maxRows

    protected final int maxRows

#### fetchSize

    protected int fetchSize

#### syncProvider

    protected final Synchronizable syncProvider

#### stmt

    protected final FbStatement stmt

#### _nextRow

    protected RowValue _nextRow

#### MAX_FETCH_ROWS

    public static final int MAX_FETCH_ROWS

See Also:
  Constant Field Values

### Method Detail

#### next

    public boolean next()
                 throws java.sql.SQLException

Move to next row.

Returns:
  `true` if cursor was moved.
Throws:
  `java.sql.SQLException` - if something went wrong.

#### isLast

    public boolean isLast()
                   throws java.sql.SQLException

Throws:
  `java.sql.SQLException`

#### getNextRow

    protected RowValue getNextRow()
                           throws java.sql.SQLException

Throws:
  `java.sql.SQLException`

#### setNextRow

    protected void setNextRow(RowValue nextRow)

#### absolute

    public boolean absolute(int row)
                     throws java.sql.SQLException

Move cursor to the absolute row.

Parameters:
  `row` - absolute row number.
Returns:
  `true` if cursor was successfully moved.
Throws:
  `java.sql.SQLException` - if something went wrong.

#### first

    public boolean first()
                  throws java.sql.SQLException

Move cursor to the rist row.

Returns:
  `true` if cursor was moved to the first row.
Throws:
  `java.sql.SQLException` - if something went wrong.

#### last

    public boolean last()
                 throws java.sql.SQLException

Move cursor to the last row.

Returns:
  `true` if cursor was moved to the last row.
Throws:
  `java.sql.SQLException` - if something went wrong.

#### previous

    public boolean previous()
                     throws java.sql.SQLException

Move cursor to the previous row.

Returns:
  `true` if cursor was moved to the prevous row.
Throws:
  `java.sql.SQLException` - if something went wrong.

#### relative

    public boolean relative(int row)
                     throws java.sql.SQLException

Move cursor relative to the current row.

Parameters:
  `row` - relative row position.
Returns:
  `true` if cursor was successfully moved.
Throws:
  `java.sql.SQLException` - if something went wrong.

#### beforeFirst

    public void beforeFirst()
                     throws java.sql.SQLException

Move cursor before first record.

Throws:
  `java.sql.SQLException` - if something went wrong.

#### afterLast

    public void afterLast()
                   throws java.sql.SQLException

Move cursor after last record.

Throws:
  `java.sql.SQLException` - if something went wrong.

#### fetch

    public void fetch()
               throws java.sql.SQLException

Throws:
  `java.sql.SQLException`

#### close

    public void close()
               throws java.sql.SQLException

Close this fetcher and corresponding result set.

Equivalent to calling `close(CompletionReason)` with `CompletionReason.OTHER`.

Throws:
  `java.sql.SQLException` - if something went wrong.

#### close

    public void close(CompletionReason completionReason)
               throws java.sql.SQLException

Close this fetcher and corresponding result set.

Parameters:
  `completionReason` - Reason for completion
Throws:
  `java.sql.SQLException` - if something went wrong.

#### getRowNum

    public int getRowNum()

Get row number.

Returns:
  row number.

#### setRowNum

    public void setRowNum(int rowNumValue)

#### isEmpty

    public boolean isEmpty()
                    throws java.sql.SQLException

Throws:
  `java.sql.SQLException`

#### setIsEmpty

    public void setIsEmpty(boolean isEmptyValue)

#### isBeforeFirst

    public boolean isBeforeFirst()
                          throws java.sql.SQLException

Throws:
  `java.sql.SQLException`

#### setIsBeforeFirst

    public void setIsBeforeFirst(boolean isBeforeFirstValue)

#### isFirst

    public boolean isFirst()
                    throws java.sql.SQLException

Throws:
  `java.sql.SQLException`

#### setIsFirst

    public void setIsFirst(boolean isFirstValue)

#### setIsLast

    public void setIsLast(boolean isLastValue)

#### isAfterLast

    public boolean isAfterLast()
                        throws java.sql.SQLException

Throws:
  `java.sql.SQLException`

#### setIsAfterLast

    public void setIsAfterLast(boolean isAfterLastValue)

#### deleteRow

    public void deleteRow()
                   throws java.sql.SQLException

Delete row at current position. This method deletes a row at the current position in case of updatable result sets after successfull execution of the `ResultSet.deleteRow()` method.

Throws:
  `java.sql.SQLException` - if operation cannot be completed.

#### insertRow

    public void insertRow(RowValue data)
                   throws java.sql.SQLException

Insert row at current position. This method adds a row at the current position in case of updatable result sets after successfull execution of the `ResultSet.insertRow()` method.

Parameters:
  `data` - row data
Throws:
  `java.sql.SQLException` - if operation cannot be completed.

#### updateRow

    public void updateRow(RowValue data)
                   throws java.sql.SQLException

Update row at current position. This method updates a row at the current position in case of updatable result sets after successfull execution of the `ResultSet.updateRow()` method.

Parameters:
  `data` - row data
Throws:
  `java.sql.SQLException` - if operation cannot be completed.

#### setFetchSize

    public void setFetchSize(int fetchSize)

Get the suggested number of rows to fetch with each batch fetch.

Parameters:
  `fetchSize` - The suggested number of rows to fetch

#### getFetchSize

    public int getFetchSize()

Set the suggested number of rows to fetch with each batch fetch.

Returns:
  The number of rows to be fetched