TTXlaRowViewer Reference
TTXlaRowViewer
, which represents a row image from change notification records, is used to examine XLA change notification record structures and old and new column values.
Also see TTXlaRowViewer Usage.
Public Methods
This section summarizes then describes the TTXlaRowViewer
public methods.
Public Methods Summary
Method | Description |
---|---|
Returns the precision of the specified column in the row image. |
|
Returns the scale of the specified column in the row image. |
|
Fetches the value of the specified column in the row image. |
|
Returns the specified column from the row image. |
|
Indicates whether the specified column in the row image is a |
|
Indicates whether the specified column in the row image has the value |
|
Returns the number of columns in the row image that have been updated. |
|
Associates the |
|
Returns the column number in the row image of a column that has been updated, typically during iteration through all updated columns. |
columnPrec()
SQLULEN columnPrec(int cno)
Returns the precision of data in column number cno
of the row image, referring to the maximum number of digits that are used by the data type.
columnScale()
int columnScale(int cno)
Returns the scale of data in column number cno
of the row image, referring to the maximum number of digits to the right of the decimal point.
Get()
void Get(int cno, TYPE* valueP)
void Get(int cno, TYPE* valueP, SQLULEN* byteLenP)
Fetches the value of column number cno
in the row image. These methods are very similar to the TTCmd::
getColumn()
methods.
Table 5-1 shows the supported SQL data types and the appropriate versions of Get()
to use for each data type. Design the application according to the types of data that are stored. For example, data of type NUMBER(9,0)
can be accessed by the Get(int, int*)
method without loss of information.
Table 5-1 Get() Signatures for Supported Table Column Types
XLA Data Type | Database Data Type | Get() Variant |
---|---|---|
|
|
|
|
|
|
|
|
Get(int cno, char** cPP) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getColumn()
const TTXlaColumn* getColumn(u_int cno) const
Returns a TTXlaColumn
object with metadata for column number cno
in the row image.
isColumnTTTimestamp()
bool isColumnTTTimestamp(int cno)
Returns TRUE
if column number cno
in the row image is a TT_TIMESTAMP
column, or FALSE
otherwise.
isNull()
bool isNull(int cno)
Indicates whether the column number cno
in the row image has the value NULL
, returning TRUE
if so or FALSE
if not.
numUpdatedCols()
SQLUSMALLINT numUpdatedCols()
Returns the number of columns that have been updated in the row image.
setTuple()
void setTuple(ttXlaUpdateDesc_t* updateDescP, int whichTuple)
Before a row can be examined, this method must be called to associate the TTXlaRowViewer
object with a particular row image. It is invoked inside the TTXlaTableHandler::
HandleInsert()
, HandleUpdate()
, or HandleDelete()
method, or by a user-written overloaded method. You would typically call it when overloading the TTXlaTableHandler::HandleChange()
method. The TimesTen Classic Quick Start xlasubscriber1
demo provides an example of its usage. (See About TimesTen Quick Start and Sample Applications.)
The ttXlaUpdateDesc_t
structures that are returned by TTXlaPersistConnection::
fetchUpdatesWait()
contain either zero, one, or two rows. Note the following:
-
Structures that define a row that was inserted into a table contain the row image of the inserted row.
-
Structures that define a row that was deleted from a table contain the row image of the deleted row.
-
Structures that define a row that was updated in a table contain the images of the row before and after the update.
-
Structures that define other changes to the table or the database contain no row images. For example, structures reporting that an index was dropped contain no row images.
The setTuple()
method takes two arguments:
-
A pointer to a particular
ttXlaUpdateDesc_t
structure defining a database change -
An integer specifying which type of row image in the update structure should be examined
The following are valid values:
-
INSERTED_TUP
: Examine the inserted row. -
DELETED_TUP
: Examine the deleted row. -
UPDATE_OLD_TUP
: Examine the row before it was updated. -
UPDATE_NEW_TUP
: Examine the row after it was updated.
-
updatedCol()
SQLUSMALLINT updatedCol(u_int cno)
Returns the column number of a column that has been updated. For the input parameter you can iterate from 1 through n
, where n
is the number returned by numUpdatedCols()
. The example that follows shows a snippet from the TimesTen Classic Quick Start demo xlasubscriber1
, where updatedCol()
is used with numUpdatedCols()
to retrieve each column that has been updated. (See About TimesTen Quick Start and Sample Applications.)
void
SampleHandler::HandleUpdate(ttXlaUpdateDesc_t* )
{
cerr << row2.numUpdatedCols() << " column(s) updated: ";
for ( int i = 1; i <= row2.numUpdatedCols(); i++ )
{
cerr << row2.updatedCol(i) << "("
<< row2.getColumn(row2.updatedCol(i)-1)->getColName() << ") ";
}
cerr << endl;
}