public method IO2GRow.getCell
Brief
Gets value of a table cell.
Declaration | ||||
|
Parameters | |
column |
The index of the column. The index should be between |
Returns
Returns the cell value that can be of different types. To determine a type, it is necessary to
get a column by using the IO2GGenericTableResponseReader.columns
and the IO2GTableColumnCollection.get
methods. The index passed to the latter
method should be the same as the column parameter.
The type of value is defined by using the IO2GTableColumn.getType
method.
The IO2GTableColumn::O2GTableColumnType
enumerator returned
by the above method contains the returned value type. A client application must cast void* data to the returned type
and copy the value.
Column types and cast operations:
Column type |
getCell value |
|
The method returns a pointer to a 32-bit integer value on a 32-bit operation system or a 64 bit integer on a 64-bit system. |
|
The method returns a pointer to a 64-bit floating-point value. |
|
The method returns a pointer to a boolean value. |
|
The method returns a pointer to a 64-bit floating-point value. The date is in the OLE Automation Date format. An OLE Automation date is implemented as a floating-point number whose integral component is the number of days before or after midnight, December 30, 1899, and whose fractional component represents the time on that day divided by 24. If it is not specified explicitly, all the date/time values are in the UTC time zone. |
|
The method returns a pointer to a zero-terminated ASCII string. |
Details
The method is used to work with an abstract table. The method provides common access to a row value independently of a row type (a table type).
Example
Prints rows by using a GenericTableResponseReader [hide]
void printGenericTableInterface(IO2GGenericTableResponseReader *genericReader) { char szBuffer[3072]; IO2GTableColumnCollection *columns = genericReader->columns(); // Print table values for (int i = 0; i < genericReader->size(); i++) { std::ostringstream stream; int count = columns->size(); IO2GRow *row = genericReader->getGenericRow(i); for (int j = 0; j < count; j++) { const void* value = row->getCell(j); IO2GTableColumn *column = columns->get(j); std::string sIsValid = row->isCellValid(j) ? "True" : "False"; switch (column->getType()) { case IO2GTableColumn::Integer: { int iValue = *(const int*)(value); stream << column->getID() << "=" << iValue << " Valid=" << sIsValid << " "; } break; case IO2GTableColumn::Double: { double dblValue = *(const double*)(value); stream << column->getID() << "=" << dblValue << " Valid=" << sIsValid << " "; } break; case IO2GTableColumn::Boolean: { bool bValue = *(const bool*)(value); const char* value = bValue ? "True" : "False"; stream << column->getID() << "=" << value << " Valid=" << sIsValid << " "; } break; case IO2GTableColumn::Date: { DATE date = *(DATE*)(value); std::string sDate = dateToString(date); stream << column->getID() << "=" << sDate.c_str() << " Valid=" << sIsValid << " "; } break; case IO2GTableColumn::String: { const char* szValue = (const char*)value; stream << column->getID() << "=" << szValue << " Valid=" << sIsValid << " "; } break; } column->release(); } row->release();! stream << std::ends; std::cout << stream.str().c_str(); } columns->release(); }
Declared in IO2GRow