Table class. More...
#include <ilviews/dataccess/tblbuf.h>
Public Member Functions | |
IliValue & | at (IliName colname) |
Returns a value. More... | |
const IliValue & | at (IliName colname) const |
Returns a value. More... | |
IliValue & | at (IlInt colno) |
Returns a value. More... | |
const IliValue & | at (IlInt colno) const |
Returns a value. More... | |
void | clear () |
Sets all values in the table buffer to the 0 value. More... | |
IlInt | count () const |
Returns the number of values in the table buffer. More... | |
IliTable * | getTable () const |
Returns the table from which the table buffer has been obtained. More... | |
IlBoolean | isModified () const |
Returns IlTrue if a value in the table buffer has been modified. More... | |
IlBoolean | isNull () const |
Returns IlTrue if all the values in the table buffer are 0 . More... | |
IliValue & | operator[] (IliName colname) |
Returns a value. More... | |
const IliValue & | operator[] (IliName colname) const |
Returns a value. More... | |
IliValue & | operator[] (IlInt colno) |
Returns a value. More... | |
const IliValue & | operator[] (IlInt colno) const |
Returns a value. More... | |
IlBoolean | rowToBuffer (IlInt rowno) |
Retrieves a row from the underlying table. More... | |
Public Member Functions inherited from IliRefCounted | |
IlInt | getRefCount () const |
Returns the reference count of the object. Initially, this property is set to 0 . More... | |
void | lock () const |
Increments the reference count of the object. | |
void | unLock () const |
Decrements the reference count of the object. More... | |
Friends | |
class | IliTable |
Additional Inherited Members | |
Protected Member Functions inherited from IliRefCounted | |
virtual | ~IliRefCounted () |
This is the virtual destructor of the IliRefCounted class. More... | |
Table class.
Library: dataccess
The IliTableBuffer
class works in conjunction with the IliTable
class. It is required by the users of a table object, to inspect, alter, or insert new rows into the table. An IliTableBuffer
object can be obtained using the IliTable::getBuffer()
member function. It can then be used to retrieve rows from the table, to update, or insert new rows into the table. When it is no longer required, it should be returned to the table using the IliTable::releaseBuffer()
member function.
Name | Type | Equivalent methods |
---|---|---|
table | Object | getTable() |
columnsCount | Int | getTable()->getColumnsCount() |
Name | Return type | Equivalent methods |
---|---|---|
getValue(String colName) | Object | new IliTableBufferValueItf getColumnIndex(colName) ) |
getValueAt(Int col) | Object | new IliTableBufferValueItf(this, col) |
rowToBuffer(Int row) | Void | rowToBuffer(row) |
clear() | Void | clear() |
modifyAll() | Void | modifyAll() |
isModified() | Boolean | isModified() |
isNull() | Boolean | isNull() |
You first obtain a table buffer by calling the table's getBuffer()
method. Then the table buffer contains value objects, one for each column of the table to which the table buffer belongs. (See IliTableBufferValue
class for more information.)
These value objects are properties of the table buffer so that they can be accessed using the dot notation.
Each of these value objects holds:
When you assign explicitly a value, the value object becomes "modified". Conversely, when you call either the clear()
or rowToBuffer()
methods, all value objects in the table buffer become "not modified".
Once you have set up the values in the table buffer according to your needs, you can call one of the IliTable
methods that take a table buffer as a parameter (such as insertRow()
, appendRow()
or updateRow()
).
These methods will consider only the values that are marked as modified. All other values will be considered as unspecified. This feature is important when you work with SQL databases. You do not want the IliTable.updateRow()
method to send back to the database server all values in the row. Only the values that must be modified are sent to the database server.
So, the following code updates only column NAME
and leaves column ID
unchanged:
Note that a table buffer obtained from one table can be used with any other table if both tables have the same number of columns and corresponding columns have the same data types in both tables. This lets you easily copy rows from one table to another. (See the description of the modifyAll()
method for an example.)
Returns a value.
colname | The column name. |
Returns a value.
colname | The column name. |
Returns a value.
colno | The column position. |
Returns a value.
colno | The column position. |
void IliTableBuffer::clear | ( | ) |
Sets all values in the table buffer to the 0
value.
In addition, the modified property of the table buffer is cleared.
IlInt IliTableBuffer::count | ( | ) | const |
Returns the number of values in the table buffer.
Each of these values corresponds to a column in the underlying table.
IliTable* IliTableBuffer::getTable | ( | ) | const |
Returns the table from which the table buffer has been obtained.
IlBoolean IliTableBuffer::isModified | ( | ) | const |
Returns IlTrue
if a value in the table buffer has been modified.
IlTrue
if a value in the table buffer has been modified since the last time either of the clear()
or rowToBuffer()
member functions was called. IlBoolean IliTableBuffer::isNull | ( | ) | const |
Returns IlTrue
if all the values in the table buffer are 0
.
IlTrue
if all the values in the table buffer are 0
. Returns a value.
colname | The column name. |
Returns a value.
colname | The column name. |
Returns a value.
colno | The column position. |
Returns a value.
colno | The column position. |
Retrieves a row from the underlying table.
After this member function has been called, each value in the table buffer is the same as its corresponding value in the designated row. In addition, the modified property of the table buffer is cleared.
rowno | The row position. |
IlTrue
if successful.