LongDataCacheTable Class Reference

The LongDataCacheTable class builds on the TemporaryTable, allowing for storing long data when an underlying relational expression doesn't support bookmarking. More...

Inherits Simba::DSI::TemporaryTable, Simba::DSI::IBookmarkable, and Simba::DSI::LongDataCache.

List of all members.

Public Member Functions

virtual void GetBookmark (simba_byte *out_bookmark)
 Retrieve a bookmark uniquely identifying the current row.
virtual simba_uint16 GetBookmarkSize ()
 Retrieve the length in bytes of the bookmark on the relation.
virtual bool GotoBookmark (const simba_byte *in_bookmark)
 Move the cursor to the row identified by the given bookmark.
 LongDataCacheTable (const IMemoryContext &in_memoryContext, IConnection &in_parentConnection, AutoPtr< Simba::DSI::LongDataCacheInfo > in_cacheInfo, AutoPtr< Simba::DSI::TemporaryTableInfo > in_ttInfo, simba_size_t in_hintBlockSize, Simba::DSI::ISwapAssistant *in_swapAssistant, bool in_shouldCompress)
 Constructor.
 LongDataCacheTable (const IMemoryContext &in_memoryContext, AutoPtr< Simba::DSI::LongDataCacheInfo > in_cacheInfo, AutoPtr< Simba::DSI::TemporaryTableInfo > in_ttInfo, simba_size_t in_hintBlockSize, Simba::DSI::ISwapAssistant *in_swapAssistant, bool in_shouldCompress)
 Constructor. DEPRECATED because this function uses global singleton factories instead of from the connection.
virtual bool RetrieveData (simba_uint16 in_column, SqlData *io_data, simba_signed_native in_offset, simba_signed_native in_maxSize)
 Fills in io_data with a chunk of data for the given column in the current row. The SqlTypeMetadata* used by io_data is the same SqlTypeMetadata* exposed by the IColumn describing the column.
void WriteAllData (simba_uint16 in_column, simba_uint16 in_srcColumn, SqlData *in_sqlData)
 Writes all the data from a column to a column in the current row.
virtual ~LongDataCacheTable ()
 Destructor.

Static Public Member Functions

static AutoPtr< LongDataCacheInfoPrepare (Simba::DSI::IColumns *in_columns)
 Prepare information needed for the creation of an LongDataCacheTable object.

Detailed Description

The LongDataCacheTable class builds on the TemporaryTable, allowing for storing long data when an underlying relational expression doesn't support bookmarking.

The size and offset into a binary file are stored for each column of long data in the table, which is used to look up data by the ETTemporaryTable instead of looking it up in the original relational expression.

This class is not intended to be used by any class but ETTemporaryTable.

USAGE NOTE: To create an LongDataCacheTable object, one needs to call LongDataCacheTable::Prepare() first to prepare for an LongDataCacheInfo object. While inconvenient, it is needed since without preprocessing there is simply no nice way to set up the correct columns.


Constructor & Destructor Documentation

LongDataCacheTable ( const IMemoryContext in_memoryContext,
AutoPtr< Simba::DSI::LongDataCacheInfo in_cacheInfo,
AutoPtr< Simba::DSI::TemporaryTableInfo in_ttInfo,
simba_size_t  in_hintBlockSize,
Simba::DSI::ISwapAssistant in_swapAssistant,
bool  in_shouldCompress 
)

Constructor. DEPRECATED because this function uses global singleton factories instead of from the connection.

Parameters:
in_memoryContext The memory context for this long cache table.
in_cacheInfo The prepared binary cache info. (OWN)
in_ttInfo The prepared temporary table info. (OWN)
in_hintBlockSize The suggested size for a block. See SwapManager for more detailed explanation.
in_swapAssistant The swap assistant to use. Cannot be NULL. (OWN)
in_shouldCompress If this table should use compression.
LongDataCacheTable ( const IMemoryContext in_memoryContext,
IConnection in_parentConnection,
AutoPtr< Simba::DSI::LongDataCacheInfo in_cacheInfo,
AutoPtr< Simba::DSI::TemporaryTableInfo in_ttInfo,
simba_size_t  in_hintBlockSize,
Simba::DSI::ISwapAssistant in_swapAssistant,
bool  in_shouldCompress 
)

Constructor.

Parameters:
in_memoryContext The memory context for this long cache table.
in_parentConnection Connection responsible for constructing metadata (NOT OWN).
in_cacheInfo The prepared binary cache info. (OWN)
in_ttInfo The prepared temporary table info. (OWN)
in_hintBlockSize The suggested size for a block. See SwapManager for more detailed explanation.
in_swapAssistant The swap assistant to use. Cannot be NULL. (OWN)
in_shouldCompress If this table should use compression.
virtual ~LongDataCacheTable (  )  [virtual]

Destructor.


Member Function Documentation

virtual void GetBookmark ( simba_byte *  out_bookmark  )  [virtual]

Retrieve a bookmark uniquely identifying the current row.

The size of the bookmark should always be that of returned by GetBookmarkSize().

Parameters:
out_bookmark The output buffer for the bookmark. The length of the buffer is assumed to be greater than or equal to the bookmark size.

Implements IBookmarkable.

virtual simba_uint16 GetBookmarkSize (  )  [virtual]

Retrieve the length in bytes of the bookmark on the relation.

Returns:
the length in bytes of the bookmark on the relation.

Implements IBookmarkable.

virtual bool GotoBookmark ( const simba_byte *  in_bookmark  )  [virtual]

Move the cursor to the row identified by the given bookmark.

NOTE: The bookmark should have been obtained through GetBookmark() and the size of the bookmark is of that returned by GetBookmarkSize().

Parameters:
in_bookmark The bookmark uniquely identifying a row in the table.
Exceptions:
DSIException if the given bookmark is invalid.
Returns:
true if successfully moved to the bookmarked row, false otherwise.

Implements IBookmarkable.

static AutoPtr<LongDataCacheInfo> Prepare ( Simba::DSI::IColumns in_columns  )  [static]

Prepare information needed for the creation of an LongDataCacheTable object.

Parameters:
in_columns The regular data columns. Cannot be NULL. (NOT OWN)
Returns:
the prepared information for the creation of an ETTemporaryTable object.
virtual bool RetrieveData ( simba_uint16  in_column,
SqlData io_data,
simba_signed_native  in_offset,
simba_signed_native  in_maxSize 
) [virtual]

Fills in io_data with a chunk of data for the given column in the current row. The SqlTypeMetadata* used by io_data is the same SqlTypeMetadata* exposed by the IColumn describing the column.

The following procedure should be implemented by this method:

  • if the data is null, call io_data->SetNull(true). in_offset and in_maxSize can be ignored
  • if the data is not of a character or binary type, then the value should be copied into the pointer returned by io_data->GetBuffer(). in_offset and in_maxSize can be ignored
  • if the data is of a character or binary type:
    • in_offset specifies the starting point to copy data from, in # of bytes from the start of that piece of data
      • in_offset must be aligned properly to the start of a data element
    • in_maxSize indicates the maximum number of bytes to copy
      • if in_maxSize is RETRIEVE_ALL_DATA, it means that the whole piece of data should be copied
    • the size of the data chunk being copied should be set with io_data->SetLength()
      • this length is the number of bytes copied
      • 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
      • calling SetLength() must be done before copying data in, because it modifies the size of the data buffer
    • 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 io_data->GetBuffer().
      • null termination is not necessary
Parameters:
in_column A column index. The first column uses index 0.
io_data Holds a buffer to store the requested data.
in_offset Number of bytes in the data to skip before copying into io_data.
in_maxSize Maximum number of bytes of data to return in in io_data.
Exceptions:
DSIException in the event that an error occurred.
Returns:
true if there is more data left after the retrieved chunk; false otherwise.

Reimplemented from TemporaryTable.

void WriteAllData ( simba_uint16  in_column,
simba_uint16  in_srcColumn,
SqlData in_sqlData 
)

Writes all the data from a column to a column in the current row.

Parameters:
in_column The column to write data to.
in_srcColumn The source column to read data from.
in_sqlData The container for the data to write to the column. (NOT OWN)
Exceptions:
SupportException if the column is invalid, or if the offset is invalid for the column, or it will result in the given data overflowing the boundaries of the column.

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

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