org.apache.derby.client.am
Class Cursor

java.lang.Object
  extended by org.apache.derby.client.am.Cursor
Direct Known Subclasses:
NetCursor

public abstract class Cursor
extends java.lang.Object


Field Summary
protected  Agent agent_
           
private  boolean allRowsReceivedFromServer_
           
static int BYTES
           
 int[] ccsid_
           
(package private)  char[] charBuffer_
           
 java.lang.String[] charsetName_
           
protected  int[] columnDataComputedLength_
           
protected  java.util.ArrayList columnDataIsNullCache_
           
protected  java.util.ArrayList columnDataLengthCache_
           
protected  int[] columnDataPosition_
           
protected  java.util.ArrayList columnDataPositionCache_
           
 int columns_
           
protected  int currentRowPosition_
           
 byte[] dataBuffer_
           
 java.io.ByteArrayOutputStream dataBufferStream_
           
static int DBCS_CLOB
           
 int[] fdocaLength_
           
 boolean hasLobs_
           
 boolean[] isNull_
           
private  boolean isRowUpdated_
           
 boolean isUpdateDeleteHole_
           
 java.util.ArrayList isUpdateDeleteHoleCache_
           
 int[] jdbcTypes_
           
 int lastValidBytePosition_
           
(package private)  int maxFieldSize_
           
static int MBCS_CLOB
           
private  int nextRowPosition_
           
static int NULL_TERMINATED_BYTES
           
static int NULL_TERMINATED_STRING
           
 boolean[] nullable_
           
 int position_
           
(package private)  java.util.Calendar recyclableCalendar_
           
static java.lang.Boolean ROW_IS_NOT_NULL
           
static java.lang.Boolean ROW_IS_NULL
           
(package private)  int rowsRead_
           
static int SBCS_CLOB
           
static int STRING
           
static int VARIABLE_BYTES
           
static int VARIABLE_SHORT_BYTES
           
static int VARIABLE_SHORT_STRING
           
static int VARIABLE_STRING
           
 
Constructor Summary
Cursor(Agent agent)
           
Cursor(Agent agent, byte[] dataBuffer)
           
 
Method Summary
 void allocateCharBuffer()
           
 boolean allRowsReceivedFromServer()
          Return true if all rows are received from the server.
protected abstract  boolean calculateColumnOffsetsForRow_(int row, boolean allowServerFetch)
          Calculate the column offsets for a row.
protected abstract  void clearLobData_()
           
 boolean currentRowPositionIsEqualToNextRowPosition()
           
 boolean dataBufferHasUnprocessedData()
           
private  long get_BIGINT(int column)
           
private  byte[] get_CHAR_FOR_BIT_DATA(int column)
           
private  java.math.BigDecimal get_DECIMAL(int column)
           
private  double get_DOUBLE(int column)
           
private  float get_FLOAT(int column)
           
protected  int get_INTEGER(int column)
           
private  short get_SMALLINT(int column)
           
private  java.lang.Object get_UDT(int column)
           
private  byte[] get_VARCHAR_FOR_BIT_DATA(int column)
           
 java.sql.Array getArray(int column)
           
 java.io.InputStream getAsciiStream(int column)
           
(package private)  java.math.BigDecimal getBigDecimal(int column)
           
 java.io.InputStream getBinaryStream(int column)
           
 java.sql.Blob getBlob(int column)
           
abstract  Blob getBlobColumn_(int column, Agent agent, boolean toBePublished)
          Returns a Blob object.
(package private)  boolean getBoolean(int column)
           
(package private)  byte getByte(int column)
           
(package private)  byte[] getBytes(int column)
           
(package private)  byte[] getBytesFromVARCHAR(int column)
           
private  java.lang.String getCHAR(int column)
           
 java.io.Reader getCharacterStream(int column)
           
 java.sql.Clob getClob(int column)
           
abstract  byte[] getClobBytes_(int column, int[] dataOffset)
           
abstract  Clob getClobColumn_(int column, Agent agent, boolean toBePublished)
          Returns a Clob object.
private  int getColumnPrecision(int column)
           
private  int getColumnScale(int column)
           
 byte[] getDataBuffer()
           
 int getDataBufferLength()
           
(package private)  java.sql.Date getDate(int column, java.util.Calendar cal)
           
private  java.sql.Date getDATE(int column, java.util.Calendar cal)
           
private  java.sql.Date getDateFromTIMESTAMP(int column, java.util.Calendar cal)
           
(package private)  double getDouble(int column)
           
private  double getDoubleFromDECIMAL(int column)
           
(package private)  float getFloat(int column)
           
(package private)  int getInt(int column)
           
 boolean getIsRowUpdated()
          Get updated status for this row.
 boolean getIsUpdateDeleteHole()
          Get deleted status for this row.
 int getLastValidBytePosition()
           
(package private)  CallableLocatorProcedures getLocatorProcedures()
          Returns a reference to the locator procedures.
(package private)  long getLong(int column)
           
private  long getLongFromDECIMAL(int column)
           
protected abstract  void getMoreData_()
           
 java.lang.Object getObject(int column)
           
(package private)  int getPosition()
           
private  java.util.Calendar getRecyclableCalendar()
          Instantiate an instance of Calendar that can be re-used for getting Time, Timestamp, and Date values from this cursor.
 java.sql.Ref getRef(int column)
           
(package private)  short getShort(int column)
           
(package private)  java.lang.String getString(int column)
           
private  java.lang.String getStringFromDATE(int column)
           
private  java.lang.String getStringFromTIME(int column)
           
private  java.lang.String getStringFromTIMESTAMP(int column)
           
private  java.lang.String getStringWithoutConvert(int position, int actualLength)
           
(package private)  java.sql.Time getTime(int column, java.util.Calendar cal)
           
private  java.sql.Time getTIME(int column, java.util.Calendar cal)
           
private  java.sql.Time getTimeFromTIMESTAMP(int column, java.util.Calendar cal)
           
(package private)  java.sql.Timestamp getTimestamp(int column, java.util.Calendar cal)
           
private  java.sql.Timestamp getTIMESTAMP(int column, java.util.Calendar cal)
           
private  java.sql.Timestamp getTimestampFromDATE(int column, java.util.Calendar cal)
           
private  java.sql.Timestamp getTimestampFromTIME(int column, java.util.Calendar cal)
           
 java.io.InputStream getUnicodeStream(int column)
           
private  java.lang.String getVARCHAR(int column)
           
 void incrementRowsReadEvent()
           
protected abstract  int locator(int column)
          Returns the locator for the specified LOB column, or Lob.INVALID_LOCATOR if the LOB was not sent as a locator.
 void makeNextRowPositionCurrent()
           
 void markCurrentRowPosition()
           
 void markNextRowPosition()
           
 boolean next()
          Makes the next row the current row.
 void nullDataForGC()
           
(package private)  void repositionCursorToCurrentRow()
           
(package private)  void repositionCursorToNextRow()
           
 void resetDataBuffer()
           
 void setAllRowsReceivedFromServer(boolean b)
          Set the value of value of allRowsReceivedFromServer_.
 void setBuffer(byte[] dataBuffer)
           
 void setIsRowUpdated(boolean isRowUpdated)
          Keep track of updated status for this row.
 void setIsUpdataDeleteHole(int row, boolean isRowNull)
           
 void setNumberOfColumns(int numberOfColumns)
           
(package private)  void setPosition(int newPosition)
           
protected  boolean stepNext(boolean allowServerFetch)
          Makes the next row the current row.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

agent_

protected Agent agent_

STRING

public static final int STRING
See Also:
Constant Field Values

VARIABLE_STRING

public static final int VARIABLE_STRING
See Also:
Constant Field Values

VARIABLE_SHORT_STRING

public static final int VARIABLE_SHORT_STRING
See Also:
Constant Field Values

NULL_TERMINATED_STRING

public static final int NULL_TERMINATED_STRING
See Also:
Constant Field Values

BYTES

public static final int BYTES
See Also:
Constant Field Values

VARIABLE_BYTES

public static final int VARIABLE_BYTES
See Also:
Constant Field Values

VARIABLE_SHORT_BYTES

public static final int VARIABLE_SHORT_BYTES
See Also:
Constant Field Values

NULL_TERMINATED_BYTES

public static final int NULL_TERMINATED_BYTES
See Also:
Constant Field Values

SBCS_CLOB

public static final int SBCS_CLOB
See Also:
Constant Field Values

MBCS_CLOB

public static final int MBCS_CLOB
See Also:
Constant Field Values

DBCS_CLOB

public static final int DBCS_CLOB
See Also:
Constant Field Values

dataBuffer_

public byte[] dataBuffer_

dataBufferStream_

public java.io.ByteArrayOutputStream dataBufferStream_

position_

public int position_

lastValidBytePosition_

public int lastValidBytePosition_

hasLobs_

public boolean hasLobs_

currentRowPosition_

protected int currentRowPosition_

nextRowPosition_

private int nextRowPosition_

columnDataPosition_

protected int[] columnDataPosition_

columnDataComputedLength_

protected int[] columnDataComputedLength_

allRowsReceivedFromServer_

private boolean allRowsReceivedFromServer_

rowsRead_

int rowsRead_

maxFieldSize_

int maxFieldSize_

columnDataPositionCache_

protected java.util.ArrayList columnDataPositionCache_

columnDataLengthCache_

protected java.util.ArrayList columnDataLengthCache_

columnDataIsNullCache_

protected java.util.ArrayList columnDataIsNullCache_

isUpdateDeleteHoleCache_

public java.util.ArrayList isUpdateDeleteHoleCache_

isUpdateDeleteHole_

public boolean isUpdateDeleteHole_

isRowUpdated_

private boolean isRowUpdated_

ROW_IS_NULL

public static final java.lang.Boolean ROW_IS_NULL

ROW_IS_NOT_NULL

public static final java.lang.Boolean ROW_IS_NOT_NULL

recyclableCalendar_

java.util.Calendar recyclableCalendar_

jdbcTypes_

public int[] jdbcTypes_

columns_

public int columns_

nullable_

public boolean[] nullable_

charsetName_

public java.lang.String[] charsetName_

isNull_

public boolean[] isNull_

fdocaLength_

public int[] fdocaLength_

ccsid_

public int[] ccsid_

charBuffer_

char[] charBuffer_
Constructor Detail

Cursor

public Cursor(Agent agent)

Cursor

public Cursor(Agent agent,
              byte[] dataBuffer)
Method Detail

setNumberOfColumns

public void setNumberOfColumns(int numberOfColumns)

stepNext

protected boolean stepNext(boolean allowServerFetch)
                    throws SqlException
Makes the next row the current row. Returns true if the current row position is a valid row position.

Parameters:
allowServerFetch - if false, don't fetch more data from the server even if more data is needed
Returns:
true if current row position is valid
Throws:
SqlException - if an error occurs

next

public boolean next()
             throws SqlException
Makes the next row the current row. Returns true if the current row position is a valid row position.

Returns:
true if current row position is valid
Throws:
SqlException - if an error occurs

setAllRowsReceivedFromServer

public void setAllRowsReceivedFromServer(boolean b)
Set the value of value of allRowsReceivedFromServer_.

Parameters:
b - a boolean value indicating whether all rows are received from the server

allRowsReceivedFromServer

public final boolean allRowsReceivedFromServer()
Return true if all rows are received from the server.

Returns:
true if all rows are received from the server.

currentRowPositionIsEqualToNextRowPosition

public final boolean currentRowPositionIsEqualToNextRowPosition()

resetDataBuffer

public final void resetDataBuffer()

dataBufferHasUnprocessedData

public final boolean dataBufferHasUnprocessedData()

calculateColumnOffsetsForRow_

protected abstract boolean calculateColumnOffsetsForRow_(int row,
                                                         boolean allowServerFetch)
                                                  throws SqlException,
                                                         DisconnectException
Calculate the column offsets for a row.

Parameters:
row - row index
allowServerFetch - if true, allow fetching more data from server
Returns:
true if the current row position is a valid row position.
Throws:
SqlException
DisconnectException

clearLobData_

protected abstract void clearLobData_()

getMoreData_

protected abstract void getMoreData_()
                              throws SqlException
Throws:
SqlException

setBuffer

public final void setBuffer(byte[] dataBuffer)

setIsUpdataDeleteHole

public final void setIsUpdataDeleteHole(int row,
                                        boolean isRowNull)

setIsRowUpdated

public final void setIsRowUpdated(boolean isRowUpdated)
Keep track of updated status for this row.

Parameters:
isRowUpdated - true if row has been updated
See Also:
getIsRowUpdated()

getIsRowUpdated

public final boolean getIsRowUpdated()
Get updated status for this row. Minion of ResultSet#rowUpdated.

See Also:
setIsRowUpdated(boolean)

getIsUpdateDeleteHole

public final boolean getIsUpdateDeleteHole()
Get deleted status for this row. Minion of ResultSet#rowDeleted.

See Also:
setIsUpdataDeleteHole(int, boolean)

getPosition

final int getPosition()

setPosition

final void setPosition(int newPosition)

markCurrentRowPosition

public final void markCurrentRowPosition()

markNextRowPosition

public final void markNextRowPosition()

makeNextRowPositionCurrent

public final void makeNextRowPositionCurrent()

repositionCursorToCurrentRow

final void repositionCursorToCurrentRow()

repositionCursorToNextRow

final void repositionCursorToNextRow()

getDataBuffer

public final byte[] getDataBuffer()

getDataBufferLength

public final int getDataBufferLength()

getLastValidBytePosition

public final int getLastValidBytePosition()

incrementRowsReadEvent

public final void incrementRowsReadEvent()

get_SMALLINT

private final short get_SMALLINT(int column)

get_INTEGER

protected final int get_INTEGER(int column)

get_BIGINT

private final long get_BIGINT(int column)

get_FLOAT

private final float get_FLOAT(int column)

get_DOUBLE

private final double get_DOUBLE(int column)

get_DECIMAL

private final java.math.BigDecimal get_DECIMAL(int column)
                                        throws SqlException
Throws:
SqlException

getDoubleFromDECIMAL

private final double getDoubleFromDECIMAL(int column)
                                   throws SqlException
Throws:
SqlException

getLongFromDECIMAL

private final long getLongFromDECIMAL(int column)
                               throws SqlException
Throws:
SqlException

getVARCHAR

private final java.lang.String getVARCHAR(int column)
                                   throws SqlException
Throws:
SqlException

getCHAR

private final java.lang.String getCHAR(int column)
                                throws SqlException
Throws:
SqlException

getDATE

private final java.sql.Date getDATE(int column,
                                    java.util.Calendar cal)
                             throws SqlException
Throws:
SqlException

getTIME

private final java.sql.Time getTIME(int column,
                                    java.util.Calendar cal)
                             throws SqlException
Throws:
SqlException

getTIMESTAMP

private final java.sql.Timestamp getTIMESTAMP(int column,
                                              java.util.Calendar cal)
                                       throws SqlException
Throws:
SqlException

getTimestampFromDATE

private final java.sql.Timestamp getTimestampFromDATE(int column,
                                                      java.util.Calendar cal)
                                               throws SqlException
Throws:
SqlException

getTimestampFromTIME

private final java.sql.Timestamp getTimestampFromTIME(int column,
                                                      java.util.Calendar cal)
                                               throws SqlException
Throws:
SqlException

getDateFromTIMESTAMP

private final java.sql.Date getDateFromTIMESTAMP(int column,
                                                 java.util.Calendar cal)
                                          throws SqlException
Throws:
SqlException

getTimeFromTIMESTAMP

private final java.sql.Time getTimeFromTIMESTAMP(int column,
                                                 java.util.Calendar cal)
                                          throws SqlException
Throws:
SqlException

getStringFromDATE

private final java.lang.String getStringFromDATE(int column)
                                          throws SqlException
Throws:
SqlException

getStringFromTIME

private final java.lang.String getStringFromTIME(int column)
                                          throws SqlException
Throws:
SqlException

getStringFromTIMESTAMP

private final java.lang.String getStringFromTIMESTAMP(int column)
                                               throws SqlException
Throws:
SqlException

get_CHAR_FOR_BIT_DATA

private final byte[] get_CHAR_FOR_BIT_DATA(int column)
                                    throws SqlException
Throws:
SqlException

get_VARCHAR_FOR_BIT_DATA

private final byte[] get_VARCHAR_FOR_BIT_DATA(int column)
                                       throws SqlException
Throws:
SqlException

get_UDT

private final java.lang.Object get_UDT(int column)
                                throws SqlException
Throws:
SqlException

getRecyclableCalendar

private java.util.Calendar getRecyclableCalendar()
Instantiate an instance of Calendar that can be re-used for getting Time, Timestamp, and Date values from this cursor. Assumption is that all users of the returned Calendar object will clear it as appropriate before using it.


getLocatorProcedures

CallableLocatorProcedures getLocatorProcedures()
Returns a reference to the locator procedures.

These procedures are used to operate on large objects referenced on the server by locators.

Returns:
The locator procedures object.

locator

protected abstract int locator(int column)
Returns the locator for the specified LOB column, or Lob.INVALID_LOCATOR if the LOB was not sent as a locator. The server may send the LOB value instead of a locator if it is running an old version which doesn't support locators, or if the database it accesses is soft upgraded from a version that doesn't have the necessary stored procedures for locator support.

Note that this method cannot be invoked on a LOB column that is NULL.

Parameters:
column - 1-based column index
Returns:
A positive integer locator if valid, Lob.INVALID_LOCATOR otherwise.

getBlobColumn_

public abstract Blob getBlobColumn_(int column,
                                    Agent agent,
                                    boolean toBePublished)
                             throws SqlException
Returns a Blob object.

Parameters:
column - 1-based column index
agent - associated agent
toBePublished - whether the Blob will be published to the user
Returns:
A Blob object.
Throws:
SqlException - if getting the Blob fails

getClobColumn_

public abstract Clob getClobColumn_(int column,
                                    Agent agent,
                                    boolean toBePublished)
                             throws SqlException
Returns a Clob object.

Parameters:
column - 1-based column index
agent - associated agent
toBePublished - whether the Clob will be published to the user
Returns:
A Clob object.
Throws:
SqlException - if getting the Clob fails

getClobBytes_

public abstract byte[] getClobBytes_(int column,
                                     int[] dataOffset)
                              throws SqlException
Throws:
SqlException

getBoolean

final boolean getBoolean(int column)
                  throws SqlException
Throws:
SqlException

getByte

final byte getByte(int column)
            throws SqlException
Throws:
SqlException

getShort

final short getShort(int column)
              throws SqlException
Throws:
SqlException

getInt

final int getInt(int column)
          throws SqlException
Throws:
SqlException

getLong

final long getLong(int column)
            throws SqlException
Throws:
SqlException

getFloat

final float getFloat(int column)
              throws SqlException
Throws:
SqlException

getDouble

final double getDouble(int column)
                throws SqlException
Throws:
SqlException

getBigDecimal

final java.math.BigDecimal getBigDecimal(int column)
                                  throws SqlException
Throws:
SqlException

getDate

final java.sql.Date getDate(int column,
                            java.util.Calendar cal)
                     throws SqlException
Throws:
SqlException

getTime

final java.sql.Time getTime(int column,
                            java.util.Calendar cal)
                     throws SqlException
Throws:
SqlException

getTimestamp

final java.sql.Timestamp getTimestamp(int column,
                                      java.util.Calendar cal)
                               throws SqlException
Throws:
SqlException

getString

final java.lang.String getString(int column)
                          throws SqlException
Throws:
SqlException

getBytes

final byte[] getBytes(int column)
               throws SqlException
Throws:
SqlException

getBinaryStream

public final java.io.InputStream getBinaryStream(int column)
                                          throws SqlException
Throws:
SqlException

getAsciiStream

public final java.io.InputStream getAsciiStream(int column)
                                         throws SqlException
Throws:
SqlException

getUnicodeStream

public final java.io.InputStream getUnicodeStream(int column)
                                           throws SqlException
Throws:
SqlException

getCharacterStream

public final java.io.Reader getCharacterStream(int column)
                                        throws SqlException
Throws:
SqlException

getBlob

public final java.sql.Blob getBlob(int column)
                            throws SqlException
Throws:
SqlException

getClob

public final java.sql.Clob getClob(int column)
                            throws SqlException
Throws:
SqlException

getArray

public final java.sql.Array getArray(int column)
                              throws SqlException
Throws:
SqlException

getRef

public final java.sql.Ref getRef(int column)
                          throws SqlException
Throws:
SqlException

getObject

public final java.lang.Object getObject(int column)
                                 throws SqlException
Throws:
SqlException

allocateCharBuffer

public final void allocateCharBuffer()

getStringWithoutConvert

private final java.lang.String getStringWithoutConvert(int position,
                                                       int actualLength)
                                                throws SqlException
Throws:
SqlException

nullDataForGC

public void nullDataForGC()

getColumnPrecision

private final int getColumnPrecision(int column)

getColumnScale

private final int getColumnScale(int column)

getBytesFromVARCHAR

final byte[] getBytesFromVARCHAR(int column)
                          throws SqlException
Throws:
SqlException

Built on Thu 2010-12-23 20:49:13+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.