rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Data Access Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IliMemoryTable Class Reference

Table class. More...

#include <ilviews/dataccess/memtable.h>

Inheritance diagram for IliMemoryTable:
IliTable IliSchema IliRefCounted IliSQLTable

List of all members.

Public Member Functions

 IliMemoryTable (const IliMemoryTable &tbl)
 Copy constructor.
 IliMemoryTable (IlvDisplay *display, IlInt rowCnt, const char *const *values, IlInt colCnt=1, const char *const *headers=0)
 Constructor from a description.
 IliMemoryTable (IlvDisplay *display)
 Constructor.
virtual IlBoolean allowColumnMove () const
 Returns IlTrue if columns can be moved to this schema.
virtual IlBoolean allowRowMove () const
 Returns IlTrue if the table (or subclass of the table) allows row move operations.
virtual void clearRows ()
 Deletes all rows.
virtual IlBoolean deleteRow (IlInt r)
 Deletes a row.
virtual IlBoolean deleteRowInCache (IlInt rowno)
 Deletes a row.
virtual IlBoolean exchangeRows (IlInt rowno1, IlInt rowno2)
 Exchanges two rows.
virtual IlBoolean exchangeRowsInCache (IlInt rowno1, IlInt rowno2)
 Exchanges two rows.
virtual IlInt getRowsCount () const
 Returns the number of rows in the table.
virtual IliRowStatus getRowStatus (IlInt rowno) const
 Returns the status of one row.
virtual IlBoolean getValue (IlInt r, IlInt c, IliValue &) const
 Returns a value.
virtual IlBoolean insertRow (IlInt r, IliTableBuffer *)
 Inserts a row that is defined by the table buffer.
virtual IlBoolean insertRowInCache (IlInt rowno, IliTableBuffer *)
 Inserts a row that is defined by the table buffer.
virtual IlBoolean moveRow (IlInt from, IlInt to)
 Moves a row.
virtual IlBoolean moveRowInCache (IlInt from, IlInt to)
 Moves a row.
virtual void setColumnMaxLength (IlInt, IlInt)
 Sets the maximum length for one column.
virtual void setColumnNullable (IlInt, IlBoolean)
 Determines if the column positioned at colno is nullable (that is, may contain null values).
virtual void setColumnType (IlInt, const IliDatatype *)
 Sets the type of the column.
virtual IlBoolean updateRow (IlInt r, IliTableBuffer *)
 Updates a row with the values in the table buffer.
virtual IlBoolean updateRowInCache (IlInt rowno, IliTableBuffer *)
 Updates a row.
virtual void write (IL_STDPREF ostream &output) const
 Writes to output stream.

Detailed Description

Table class.

Library: dataccess

The IliMemoryTable class implements the protocol defined by the IliTable class, by managing all the memory necessary to store the rows. Since it can handle any set of columns (schema), it may be used as a general purpose table implementation. It is also used as a base class for other more specialized classes such as IliSQLTable. This class manages rows on a remote database system, and caches parts of these rows locally. In this situation, the IliMemoryTable base class provides the cache capability.

See also:
Classes: IliTable, IliStringType

Constructor & Destructor Documentation

IliMemoryTable::IliMemoryTable ( IlvDisplay display  ) 

Constructor.

This constructor initializes a memory table. Initially, this table has no columns and no rows.

Parameters:
display The display.
IliMemoryTable::IliMemoryTable ( IlvDisplay display,
IlInt  rowCnt,
const char *const *  values,
IlInt  colCnt = 1,
const char *const *  headers = 0 
)

Constructor from a description.

This constructor creates a memory table with columnsCount columns and rowsCount rows. All columns are of the IliStringType and their names are given by the columnsNames array. The row cells take their initial values from the values array, which must be of size columnsCount x rowsCount. If the columnNames parameter is null, then the columns will be given names in the set {"Column 1", "Column 2", ...}. Note that this constructor does not keep any pointers to the character strings and arrays of character strings that it is given.

Parameters:
display The display.
rowCnt The row count.
values The values.
colCnt The column count.
headers The columns name.
IliMemoryTable::IliMemoryTable ( const IliMemoryTable tbl  ) 

Copy constructor.

This is the copy constructor of the IliMemoryTable class.

Parameters:
tbl The table.

Member Function Documentation

virtual IlBoolean IliMemoryTable::allowColumnMove (  )  const [virtual]

Returns IlTrue if columns can be moved to this schema.

The reason why columns can or cannot be moved depends on the specific subclass of IliSchema that is used.

Returns:
IlTrue if columns can be moved to this schema, and IlFalse otherwise.

Reimplemented from IliSchema.

Reimplemented in IliSQLTable.

virtual IlBoolean IliMemoryTable::allowRowMove (  )  const [virtual]

Returns IlTrue if the table (or subclass of the table) allows row move operations.

Returns:
IlTrue if the table (or subclass of the table) allows row move operations.

Reimplemented from IliTable.

virtual void IliMemoryTable::clearRows (  )  [virtual]

Deletes all rows.

If the table (or subclass of the table) defines a mapping with a remote database, then only the rows in the IliTable object are deleted. The rows in the remote database are not affected by this operation. This enables the row cache of such a table to be cleared.

Reimplemented from IliTable.

Reimplemented in IliSQLTable.

virtual IlBoolean IliMemoryTable::deleteRow ( IlInt  rowno  )  [virtual]

Deletes a row.

Parameters:
rowno The row position.
Returns:
IlTrue if successful and IlFalse if rowno is out of bounds, or if the row could not be deleted. If the table (or subclass of the table) defines a mapping with a remote database, the row is also deleted in the remote database.

Reimplemented from IliTable.

Reimplemented in IliSQLTable.

virtual IlBoolean IliMemoryTable::deleteRowInCache ( IlInt  rowno  )  [virtual]

Deletes a row.

This virtual member function is similar to the deleteRow member function except that it only deletes the row in the local row cache if this table is a two-tier table.

Parameters:
rowno The row position.
Returns:
IlTrue if successful and IlFalse if rowno is out of bounds, or if the row could not be deleted. If the table (or subclass of the table) defines a mapping with a remote database, the row is also deleted in the remote database.

Reimplemented from IliTable.

virtual IlBoolean IliMemoryTable::exchangeRows ( IlInt  rowno1,
IlInt  rowno2 
) [virtual]

Exchanges two rows.

Parameters:
rowno1 The first row position.
rowno2 The second row position.
Returns:
IlTrue if successful. If the table (or subclass of the table) defines a mapping with a remote database, the rows are also exchanged in the remote database (if possible).

Reimplemented from IliTable.

Reimplemented in IliSQLTable.

virtual IlBoolean IliMemoryTable::exchangeRowsInCache ( IlInt  rowno1,
IlInt  rowno2 
) [virtual]

Exchanges two rows.

This virtual member function is similar to the exchangeRows member function except that it exchanges only the rows in the local row cache.

Parameters:
rowno1 The first row position.
rowno2 The second row position.
Returns:
IlTrue if successful. If the table (or subclass of the table) defines a mapping with a remote database, the rows are also exchanged in the remote database (if possible).

Reimplemented from IliTable.

virtual IlInt IliMemoryTable::getRowsCount (  )  const [virtual]

Returns the number of rows in the table.

Returns:
The count.

Reimplemented from IliTable.

Reimplemented in IliSQLTable.

virtual IliRowStatus IliMemoryTable::getRowStatus ( IlInt  rowno  )  const [virtual]

Returns the status of one row.

This is useful when a transaction manager manages the table. The row status can be one of the following:

  • IliNotARow The row index is out of bounds.
  • IliRegularRow The row has not been touched in the current local transaction.
  • IliInsertedRow The row has been inserted in the current local transaction.
  • IliUpdatedRow The row has been updated in the current local transaction.
  • IliDeletedRow The row has been deleted in the current local transaction.

The "current local transaction" refers to the changes that have occurred since the most recent call to one of the following member functions (assuming the transaction manager is currently started):

Note that the IliDeletedRow tag is never returned since a deleted row has no row index. This exists and is mentioned here for your information only.

Parameters:
rowno The row position.
Returns:
The status.

Reimplemented from IliTable.

virtual IlBoolean IliMemoryTable::getValue ( IlInt  rowno,
IlInt  colno,
IliValue value 
) const [virtual]

Returns a value.

This member function handles the fetching of the row (and all preceding rows) as necessary.

Parameters:
rowno The row position.
colno The column position.
value The value.
Returns:
IlTrue if successful.

Reimplemented from IliTable.

Reimplemented in IliSQLTable.

virtual IlBoolean IliMemoryTable::insertRow ( IlInt  rowno,
IliTableBuffer buff 
) [virtual]

Inserts a row that is defined by the table buffer.

Not all the values are used to insert the row, instead the values for which the isModified are used, the others being replaced by null values. Note that this member function does not check any of the constraints defined in the schema. If the table (or subclass of the table) defines a mapping with a remote database, the row is also inserted in the remote database.

Parameters:
rowno The row position.
buff The table buffer.
Returns:
IlTrue if successful, and IlFalse if rowno is out of bounds, or if the row could not be inserted.

Reimplemented from IliTable.

Reimplemented in IliSQLTable.

virtual IlBoolean IliMemoryTable::insertRowInCache ( IlInt  rowno,
IliTableBuffer buff 
) [virtual]

Inserts a row that is defined by the table buffer.

This virtual member function is similar to the insertRow member function except that it only inserts the row in the local row cache if this table is a two-tier table.

Parameters:
rowno The row position.
buff The table buffer.
Returns:
IlTrue if successful, and IlFalse if rowno is out of bounds, or if the row could not be inserted.

Reimplemented from IliTable.

virtual IlBoolean IliMemoryTable::moveRow ( IlInt  from,
IlInt  to 
) [virtual]

Moves a row.

Parameters:
from The origin row position.
to The destination row position.
Returns:
IlTrue if successful. If the table (or subclass of the table) defines a mapping with a remote database, the row is also moved in the remote database (if possible).

Reimplemented from IliTable.

Reimplemented in IliSQLTable.

virtual IlBoolean IliMemoryTable::moveRowInCache ( IlInt  from,
IlInt  to 
) [virtual]

Moves a row.

This virtual member function is similar to the moveRow member function except that it moves only the row in the local row cache.

Parameters:
from The origin row position.
to The destination row position.
Returns:
IlTrue if successful. If the table (or subclass of the table) defines a mapping with a remote database, the row is also moved in the remote database (if possible).

Reimplemented from IliTable.

virtual void IliMemoryTable::setColumnMaxLength ( IlInt  colno,
IlInt  maxlen 
) [virtual]

Sets the maximum length for one column.

Parameters:
colno The column position.
maxlen The maximum length.

Reimplemented from IliSchema.

virtual void IliMemoryTable::setColumnNullable ( IlInt  colno,
IlBoolean  nullable 
) [virtual]

Determines if the column positioned at colno is nullable (that is, may contain null values).

Parameters:
colno The column position.
nullable If IlTrue, the column is nullable.

Reimplemented from IliSchema.

virtual void IliMemoryTable::setColumnType ( IlInt  colno,
const IliDatatype type 
) [virtual]

Sets the type of the column.

Parameters:
colno The column position.
type The column type.

Reimplemented from IliSchema.

virtual IlBoolean IliMemoryTable::updateRow ( IlInt  rowno,
IliTableBuffer buff 
) [virtual]

Updates a row with the values in the table buffer.

Not all the values are used to update the row. Instead the values for which the isModified member function returns IlTrue , are used. Note that this member function does not check any of the constraints defined in the schema. If the table (or subclass of the table) defines a mapping with a remote database, the row is also changed in the remote database.

Parameters:
rowno The row position.
buff The table buffer.
Returns:
IlTrue if successful and IlFalse if rowno is out of bounds, or if the row could not be updated.

Reimplemented from IliTable.

Reimplemented in IliSQLTable.

virtual IlBoolean IliMemoryTable::updateRowInCache ( IlInt  rowno,
IliTableBuffer buff 
) [virtual]

Updates a row.

This virtual member function is similar to the updateRow member function except that it only updates the row in the local row cache if this table is a two-tier table.

Parameters:
rowno The row position.
buff The table buffer.
Returns:
IlTrue if successful and IlFalse if rowno is out of bounds, or if the row could not be updated.

Reimplemented from IliTable.

virtual void IliMemoryTable::write ( IL_STDPREF ostream &  output  )  const [virtual]

Writes to output stream.

Writes a memory table to an output stream, in a form suitable to be able to be read back by the stream-based constructor.

Parameters:
output The output stream.

Reimplemented from IliTable.

Reimplemented in IliSQLTable.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends

© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.