DSIExtSimpleResultSet Class Reference

Simple partial implementation of DSIExtResultSet which supports forward-only cursors. More...

Inherits Simba::SQLEngine::DSIExtResultSet.

List of all members.

Public Member Functions

virtual void CloseCursor ()
 Closes the DSI's internal result cursor and clears associated memory.
virtual bool GetDataNeeded (simba_uint16 in_column)
 Gets the data needed status of a column as set by SetDataNeeded.
virtual const IIndexMetadataListGetIndexes () const
 Get the indexes for this result set.
virtual Simba::DSI::ICellmarkMarkCell (simba_uint16 in_column)
 Returns a cellmark to the column of the row at which the cursor is positioned.
bool Move (Simba::DSI::DSIDirection in_direction, simba_signed_native in_offset)
 Traverses the result set.
virtual AutoPtr< DSIExtIndexOpenIndex (const IUseableIndexMetadata *in_indexMeta, bool in_mustKeepOrder=false, bool in_mustSupplyBookmarks=false)
 Create and return an DSIExtIndex object to use for indexing this DSIExtResultSet.
virtual void Reset ()
 Resets the cursor to before the first row.
virtual bool RetrieveData (simba_uint16 in_column, SqlData *io_data, simba_signed_native in_offset, simba_signed_native in_maxSize)=0
 Fills in in_data with a chunk of data for the given column in the current row.
virtual void SetBookmarkSource (DSIExtBookmarkSource *in_bookmarkSource)
 Set a bookmark source on this result set.
void SetCurrentRow (simba_signed_native in_rowNumber)
 Set the current row number (0-based).
void SetCursorType (Simba::DSI::DSICursorType in_cursorType)
 Sets the type of cursor to be used for traversing over the result set.
virtual void SetDataNeeded (simba_uint16 in_column, bool in_dataNeeded)
 Indicates whether RetrieveData() might be called on the given column after the next call to Move().
virtual ~DSIExtSimpleResultSet ()
 Destructor.

Protected Member Functions

virtual void DoCloseCursor ()=0
 Called from CloseCursor() to ensure that the ResultSet performs any special handling and that it clears associated memory.
 DSIExtSimpleResultSet ()
 Constructor.
simba_signed_native GetCurrentRow ()
 Returns the current row index (0-based).
virtual void MoveToBeforeFirstRow ()=0
 Resets the cursor to before the first row.
virtual bool MoveToNextRow ()=0
 Called from Move() to indicate that the cursor should now be moved to the next row.

Protected Attributes

DSIExtBookmarkSourcem_bookmarkSource
std::vector< simba_byte > m_colsDataNeeded
simba_signed_native m_currentRow
DSIExtIndexMetadataList m_indexMetaList

Detailed Description

Simple partial implementation of DSIExtResultSet which supports forward-only cursors.

It also implements the UnsafeSharedObject interface. The implementation is not thread-safe.


Constructor & Destructor Documentation

virtual ~DSIExtSimpleResultSet (  )  [virtual]

Destructor.

DSIExtSimpleResultSet (  )  [protected]

Constructor.


Member Function Documentation

virtual void CloseCursor (  )  [virtual]

Closes the DSI's internal result cursor and clears associated memory.

Exceptions:
DSIException in the event that an error occurred.

Implements IResult.

virtual void DoCloseCursor (  )  [protected, pure virtual]

Called from CloseCursor() to ensure that the ResultSet performs any special handling and that it clears associated memory.

simba_signed_native GetCurrentRow (  )  [protected]

Returns the current row index (0-based).

Returns:
The 0-based index of the current row.
virtual bool GetDataNeeded ( simba_uint16  in_column  )  [virtual]

Gets the data needed status of a column as set by SetDataNeeded.

If SetDataNeeded was not called, the value is assumed to be false.

Parameters:
in_column A column index. The first column uses index 0.
Exceptions:
DSIException if an error occurs.
Returns:
The data needed status of in_column.

Implements IResult.

virtual const IIndexMetadataList& GetIndexes (  )  const [virtual]

Get the indexes for this result set.

Return an empty collection of indexes if indexes are not supported.

Returns:
The indexes for this result set.

Implements DSIExtResultSet.

virtual Simba::DSI::ICellmark* MarkCell ( simba_uint16  in_column  )  [virtual]

Returns a cellmark to the column of the row at which the cursor is positioned.

This implementation does not support cell marking. This method returns NULL alway.

Parameters:
in_column A column index for this cellmark. The first column uses index 0.
Returns:
NULL always since cell marking is not supported. (OWN)

Reimplemented from DSIExtResultSet.

bool Move ( Simba::DSI::DSIDirection  in_direction,
simba_signed_native  in_offset 
) [virtual]

Traverses the result set.

Different CursorTypes correspond to support for different sets of values of in_direction.

It is expected that the IResult's internal cursor is positioned before the start of the result set before the first Move().

Parameters:
in_direction Direction to traverse the result set
in_offset Used for certain directions to indicate an offset from a relative position.
Exceptions:
DSIException if the direction is not supported.
Returns:
true if there are more rows left, false otherwise.

Implements IResult.

virtual void MoveToBeforeFirstRow (  )  [protected, pure virtual]

Resets the cursor to before the first row.

Note: This method could be called multiple times on the same result set.

virtual bool MoveToNextRow (  )  [protected, pure virtual]

Called from Move() to indicate that the cursor should now be moved to the next row.

Returns:
True if there are more rows in the ResultSet; false otherwise.
virtual AutoPtr<DSIExtIndex> OpenIndex ( const IUseableIndexMetadata in_indexMeta,
bool  in_mustKeepOrder = false,
bool  in_mustSupplyBookmarks = false 
) [virtual]

Create and return an DSIExtIndex object to use for indexing this DSIExtResultSet.

Note: If this is called multiple times for the same index, independent DSIExtIndex objects should be returned. I.E., they can be moved through independently without affecting each other.

Parameters:
in_indexMeta The IIndexMetadata object corresponding to the index to open. Should have been retrieved via GetIndexes(). (NOT OWN)
in_mustKeepOrder Whether the produced DSIExtIndex must traverse its rows in the order of the index. For a sorted index, this means that rows will be traversed in the index's sort order. For a clustered index, this means that rows will be traversed in the order of the associated IBookmarkComparator. (default is false)
in_mustSupplyBookmarks Whether the produced index must support the use of IInDSIExtIndexdex::GetTableBookmark() and associated methods. (default is false)
Exceptions:
SEInvalidArgumentException If in_indexMeta was not from GetIndexes().
SEInvalidArgumentException If in_mustSupplyBookmarks is true and the index is incapable of doing so. (see IIndexMetadata::CanProduceTableBookmarks())
SEInvalidOperationException If this result set doesn't support indexes.
Returns:
An DSIExtIndex object which can be used to index this DSIExtResultSet.

Implements DSIExtResultSet.

virtual void Reset (  )  [virtual]

Resets the cursor to before the first row.

If there is currently a bookmark source set, it resets it.

Otherwise it calls the protected method MoveToBeforeFirstRow().

Implements DSIExtResultSet.

virtual bool RetrieveData ( simba_uint16  in_column,
SqlData io_data,
simba_signed_native  in_offset,
simba_signed_native  in_maxSize 
) [pure virtual]

Fills in in_data with a chunk of data for the given column in the current row.

The SqlTypeMetadata* used by in_data is the same SqlTypeMetadata* exposed by the IColumn describing the column.

It implements the following procedure: (1) If the data is null, call in_data->SetNull(true). in_offset and in_maxSize can be ignored

(2) If the data is not of a character or binary type, then the value should be copied into the pointer returned by in_data->GetBuffer(). in_offset and in_maxSize can be ignored

(3) If the data is of a character or binary type: (a) in_offset specifies the starting point to copy data from, in # of bytes from the start of that piece of data (b) in_offset must be aligned properly to the start of a data element (c) in_maxSize indicates the maximum number of bytes to copy (d) if in_maxSize is RETRIEVE_ALL_DATA, it means that the whole piece of data should be copied (e) the size of the data chunk being copied should be set with in_data->SetLength() (f) this length is the number of full elements copied (g) if there's only room for a partial element at the end, it does not need to be copied, and should not be included in the SetLength() length (h) calling SetLength() must be done before copying data in, because it modifies the size of the data buffer (i) the chunk of data starting at in_offset which is at a maximum in_size bytes long should be copied into the pointer returned by in_data->GetBuffer(). (j) null termination is not necessary, though for character data the buffer has extra room available at the end for a null terminator

Parameters:
in_column A column index. The first column uses index 0.
io_data Holds a buffer to store the requested data. (NOT OWN)
in_offset Number of bytes in the data to skip before copying into in_data.
in_maxSize Maximum number of bytes of data to returning in in_data.
Exceptions:
DSIException when the column has not been activated by SetDataNeeded(...) or on any other error.
Returns:
True if there is more data left, false otherwise.

Implements IResult.

virtual void SetBookmarkSource ( DSIExtBookmarkSource in_bookmarkSource  )  [virtual]

Set a bookmark source on this result set.

See also:
DSIExtResultset::SetBookmarkSource() for more details.
Parameters:
in_bookmarkSource The bookmark source to set on this object. (NOT OWN)
Exceptions:
SEInvalidOperationException if bookmarks are not supported.

Implements DSIExtResultSet.

void SetCurrentRow ( simba_signed_native  in_rowNumber  ) 

Set the current row number (0-based).

The first row is 0, second row is 1, ... nth row is (n - 1).

Parameters:
in_rowNumber The (0-based) row number.
void SetCursorType ( Simba::DSI::DSICursorType  in_cursorType  )  [virtual]

Sets the type of cursor to be used for traversing over the result set.

This method must be called before calling Move(). Otherwise the cursor type used is undefined.

DSIExtSimpleResultSet only supports DSI_FORWARD_ONLY. All other types of cursor types will result in an exception.

Parameters:
in_cursorType Type of cursor used by the DSI to traverse the result set.
Exceptions:
DSIException if the cursor type is not supported.

Implements IResult.

virtual void SetDataNeeded ( simba_uint16  in_column,
bool  in_dataNeeded 
) [virtual]

Indicates whether RetrieveData() might be called on the given column after the next call to Move().

The value given here applies for any subsequent Move() calls.

Parameters:
in_column A column index. The first column uses index 0.
in_dataNeeded Indicates whether data may be retrieved from the given column by the ODBC layer or not.
Exceptions:
DSIException if an error occurs.

Implements IResult.


Member Data Documentation

std::vector<simba_byte> m_colsDataNeeded [protected]
simba_signed_native m_currentRow [protected]

The documentation for this class was generated from the following file:

Generated on Wed May 17 14:21:18 2017 for SimbaEngine 10.1.3.1011 by simba