Rogue Wave Views Data Access Package API Reference Guide |
Rogue Wave Views Documentation Home |
Schema class. More...
#include <ilviews/dataccess/schema.h>
Public Member Functions | |
IliSchema (IlvDisplay *display) | |
This constructor initializes a schema object. More... | |
IliSchema (const IliSchema &) | |
This is the copy constructor of the IliSchema class. | |
IliSchema (IlvDisplay *display, IL_STDPREF istream &input) | |
This constructor initializes a schema by reading its definition from an input stream. More... | |
void | addHook (IliTableHook *hook) |
Adds a hook to the list of hooks of the schema object. More... | |
virtual IlBoolean | allowColumnMove () const |
Returns IlTrue if columns can be moved to this schema. More... | |
IlInt | appendColumn (const char *name, const IliDatatype *type, IlInt maxlen=-1) |
Appends a new column to the schema. More... | |
const IliDatatype * | asDatatype () const |
Returns the data type that is defined by this schema. More... | |
virtual IlBoolean | deleteColumn (IlInt colno) |
Deletes a column. More... | |
void | endOfBatch () |
Used in conjunction with the startOfBatch() member function to terminate a series of modifications on the schema. More... | |
IlvAlignment | getColumnAlignment (IlInt colno) const |
Returns the column alignment. More... | |
const char * | getColumnDefault (IlInt colno) const |
Returns the default value for one column. More... | |
IlInt | getColumnDisplayWidth (IlInt colno) const |
Returns the display width, in pixels, of one column. More... | |
const IliFormat & | getColumnFormat (IlInt colno) const |
Returns the format of one column. More... | |
IlInt | getColumnIndex (const char *name) const |
Returns the position of the column. More... | |
IlInt | getColumnIndex (IlInt token) const |
Returns the position of the column. More... | |
const char * | getColumnLabel (IlInt colno) const |
Returns the label of one column. More... | |
const IliInputMask & | getColumnMask (IlInt colno) const |
Returns the input mask of one column. More... | |
IlInt | getColumnMaxLength (IlInt colno) const |
Returns the maximum length allowed for one column. More... | |
const char * | getColumnName (IlInt colno) const |
Returns the name of the column. More... | |
IlInt | getColumnsCount () const |
Returns the number of columns in the schema. More... | |
const char * | getColumnTitle (IlInt colno) const |
Returns the title of one column. More... | |
IlInt | getColumnToken (IlInt colno) const |
Returns the token of the column. More... | |
const IliDatatype * | getColumnType (IlInt colno) const |
Returns the type of the column. More... | |
IlvDisplay * | getDisplay () const |
Returns the display of the schema object. More... | |
const char * | getElementTypeName () const |
Returns the type name of the objects in the collection. More... | |
const IliSchema * | getNestedSchema (const IliAttributePath &path) const |
Returns the nested schema. More... | |
IliSchema * | getNestedSchema (const IliAttributePath &path) |
Returns the nested schema. More... | |
const char * | getSchemaName () const |
Returns the schema name. More... | |
IlBoolean | hasHook (IliTableHook *hook) const |
Returns IlTrue if the hook is already into the list of hooks of the schema object. More... | |
virtual IlBoolean | insertColumn (IlInt colno, const char *colname, const IliDatatype *type, IlInt maxlen=-1) |
Inserts a new column in the schema. More... | |
IlBoolean | isACollection () const |
Returns IlTrue if the schema defines a type that is a collection of objects or values. More... | |
IlBoolean | isASimpleCollection () const |
Returns IlTrue if the schema is defined as a simple collection type. More... | |
IlBoolean | isColumnNullable (IlInt colno) const |
Returns IlTrue if the column allows null values. More... | |
IlBoolean | isColumnPartOfKey (IlInt colno) const |
Returns IlTrue if the column is part of the primary key of the schema. More... | |
IlBoolean | isColumnReadOnly (IlInt colno) const |
Returns IlTrue if the column is read-only. More... | |
IlBoolean | isColumnVisible (IlInt colno) const |
Returns IlTrue if the column should be visible. More... | |
IlBoolean | isPrimaryKeyDefined () const |
Returns IlTrue if the schema has one or more columns defined as being part of the primary key. More... | |
virtual IlBoolean | moveColumn (IlInt from, IlInt to) |
Moves a column. More... | |
void | removeHook (IliTableHook *hook) |
Removes a hook from the list of hooks of the schema object. More... | |
void | setAsCollection (IlBoolean flag) |
Sets the schema as a collection type. More... | |
void | setAsSimpleCollection (IlBoolean flag) |
Sets the schema as a simple collection type. More... | |
virtual void | setColumnAlignment (IlInt colno, IlvAlignment align) |
Sets the alignment of one column. More... | |
virtual void | setColumnDefault (IlInt colno, const char *val) |
Sets the default value for one column. More... | |
virtual void | setColumnDisplayWidth (IlInt colno, IlInt width) |
Sets the display width of one column. More... | |
virtual void | setColumnFormat (IlInt colno, const IliFormat &fmt) |
Sets the format of the column. More... | |
virtual void | setColumnLabel (IlInt colno, const char *label) |
Sets the label of one column. More... | |
virtual void | setColumnMask (IlInt colno, const IliInputMask &mask) |
Sets the input mask of one column. More... | |
virtual void | setColumnMaxLength (IlInt colno, IlInt maxlen) |
Sets the maximum length for one column. More... | |
virtual void | setColumnName (IlInt colno, const char *colname) |
Sets the name of the column. More... | |
virtual void | setColumnNullable (IlInt colno, IlBoolean nullable) |
Determines if the column positioned at colno is nullable (that is, may contain null values). More... | |
virtual void | setColumnPartOfKey (IlInt colno, IlBoolean partOfKey) |
Specifies whether the column is part of the primary key. More... | |
virtual void | setColumnReadOnly (IlInt colno, IlBoolean readOnly) |
Specifies whether a column is read-only. More... | |
virtual void | setColumnTitle (IlInt colno, const char *title) |
Sets the title of one column. More... | |
virtual void | setColumnType (IlInt colno, const IliDatatype *type) |
Sets the type of the column. More... | |
virtual void | setColumnVisible (IlInt colno, IlBoolean visible) |
Sets the column visibility. More... | |
void | setElementTypeName (const char *name) |
Sets the element type name. More... | |
void | setSchemaName (const char *name) |
Sets the schema name. More... | |
void | startOfBatch () |
Used to start a series of modifications on the schema object. More... | |
virtual void | write (IL_STDPREF ostream &output) const |
Writes the definition of a schema to an output stream in a form suitable to be read back by the stream-based constructor. 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... | |
Additional Inherited Members | |
Protected Member Functions inherited from IliRefCounted | |
virtual | ~IliRefCounted () |
This is the virtual destructor of the IliRefCounted class. More... | |
Schema class.
Library: dataccess
The IliSchema
class defines an object that has an ordered collection of columns. Each column has a name, a data type and some other attributes. This class serves as a base class for the IliTable
class. The IliTable
class defines a table object that manages a set of rows with the same schema.
IliDatatype
, IliFormat
, IliTableHook
.Accessors provide a scriptable and uniform way to inspect and modify an object by using its base class methods IlvValueInterface::queryValue()
, IlvValueInterface::queryValues()
, IlvValueInterface::changeValue()
, IlvValueInterface::changeValues()
. This class defines the following accessors:
Name | Type | Equivalent methods |
---|---|---|
columnsCount | Int | getColumnsCount() |
Name | Return type | Equivalent methods |
---|---|---|
getColumn(String colName) | Object | Columns[getColumnIndex(colName)] . See [getColumn] below. |
getColumnAt(Int col) | Object | Columns[col] . See [getColumn] below. |
[getColumn] The columns become properties of the schema so that the following are equivalent:
Note that if this schema object is part of a more specialized class (such as IliMemoryTable
or IliSQLTable
), it returns an object whose class is a subclass of IliColumn
(such as IliTableColumn
or IliSQLTableColumn
). This is also the case with the getColumnAt()
method.
IliSchema::IliSchema | ( | IlvDisplay * | display | ) |
This constructor initializes a schema object.
Initially, the schema definition is empty.
display | The display. |
IliSchema::IliSchema | ( | IlvDisplay * | display, |
IL_STDPREF istream & | input | ||
) |
This constructor initializes a schema by reading its definition from an input stream.
display | The display. |
input | The input stream. |
void IliSchema::addHook | ( | IliTableHook * | hook | ) |
Adds a hook to the list of hooks of the schema object.
Note that the ownership of the hook object is not transferred to the schema object (that is, when a schema object is deleted, it does not delete the hooks added to it.)
hook | The hook. |
|
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.
IlTrue
if columns can be moved to this schema, and IlFalse
otherwise. Reimplemented in IliSQLTable, and IliMemoryTable.
IlInt IliSchema::appendColumn | ( | const char * | name, |
const IliDatatype * | type, | ||
IlInt | maxlen = -1 |
||
) |
Appends a new column to the schema.
name | The column name. |
type | The column type. |
maxlen | The column maximum length. |
const IliDatatype* IliSchema::asDatatype | ( | ) | const |
Returns the data type that is defined by this schema.
Note that the schema must be completely defined before this member function is called.
Deletes a column.
colno | The column position. |
IlTrue
if successful and IlFalse
if the column position is out of bounds. void IliSchema::endOfBatch | ( | ) |
Used in conjunction with the startOfBatch()
member function to terminate a series of modifications on the schema.
Calls to startOfBatch()
and endOfBatch()
can be nested.
IlvAlignment IliSchema::getColumnAlignment | ( | IlInt | colno | ) | const |
Returns the column alignment.
The default depends on the type of the column.
colno | The column position. |
IlvLeft
, IlvCenter
, or IlvRight
. const char* IliSchema::getColumnDefault | ( | IlInt | colno | ) | const |
Returns the default value for one column.
This is the initial value that is assigned to any gadget connected to this column when the end-user inserts a new row into a conforming table. This value is not the same as the SQL default value that the database uses for an unspecified column, during an insert. The default for this property is the empty character string.
colno | The column position. |
Returns the display width, in pixels, of one column.
The default for this property is -1
.
colno | The column position. |
-1
means that the display width is unspecified. Returns the format of one column.
The default for this property is the default format.
colno | The column position. |
IlInt IliSchema::getColumnIndex | ( | const char * | name | ) | const |
Returns the position of the column.
name | The column name. |
-1
if no such column is found. Returns the position of the column.
Column tokens are automatically assigned to columns at creation time and they do not subsequently change (as opposed to the position of a column, which may change without warning when other columns are inserted or removed).
token | The column token. |
-1
if no such column is found. const char* IliSchema::getColumnLabel | ( | IlInt | colno | ) | const |
Returns the label of one column.
The label of a column is used as a caption for any IliDbField
gadgets that are connected to that column. If this property is empty, the column name will be used as a caption. The default for this property is the empty character string.
colno | The column position. |
const IliInputMask& IliSchema::getColumnMask | ( | IlInt | colno | ) | const |
Returns the input mask of one column.
The default for this property is the default input mask.
colno | The column position. |
Returns the maximum length allowed for one column.
The precise meaning depends on the column type. For example, when the type is IliStringType
, this property restricts the type further, by specifying an upper limit on the length of the character strings. A value of -1
specifies that the length is unlimited. The default is -1
.
colno | The column position. |
const char* IliSchema::getColumnName | ( | IlInt | colno | ) | const |
Returns the name of the column.
colno | The column position. |
0
if the position is out of bounds. IlInt IliSchema::getColumnsCount | ( | ) | const |
Returns the number of columns in the schema.
const char* IliSchema::getColumnTitle | ( | IlInt | colno | ) | const |
Returns the title of one column.
The title of a column is used as a header in any table gadget connected to that table. If this property is empty, the table gadget will use the name of the column as a header. The default for this property is the empty character string.
colno | The column position. |
Returns the token of the column.
Tokens are automatically assigned to columns at creation time.
colno | The column position. |
-1
if no such column exists. const IliDatatype* IliSchema::getColumnType | ( | IlInt | colno | ) | const |
Returns the type of the column.
The default is IliNullType
.
colno | The column position. |
0
if the position is out of bounds. IlvDisplay* IliSchema::getDisplay | ( | ) | const |
Returns the display of the schema object.
const char* IliSchema::getElementTypeName | ( | ) | const |
Returns the type name of the objects in the collection.
const IliSchema* IliSchema::getNestedSchema | ( | const IliAttributePath & | path | ) | const |
Returns the nested schema.
path | The path of the nested schema. |
0
if no such schema exists. IliSchema* IliSchema::getNestedSchema | ( | const IliAttributePath & | path | ) |
Returns the nested schema.
path | The path of the nested schema. |
0
if no such schema exists. const char* IliSchema::getSchemaName | ( | ) | const |
Returns the schema name.
When the schema defines a type that is a collection of objects, this property corresponds to the type name of the collection whereas the element type name (as returned by member function getElementTypeName()
) corresponds to the type of the elements in the collection.
IlBoolean IliSchema::hasHook | ( | IliTableHook * | hook | ) | const |
Returns IlTrue
if the hook is already into the list of hooks of the schema object.
hook | The hook. |
IlTrue
if the hook is already into the list of hooks of the schema object, otherwise returns IlFalse
.
|
virtual |
Inserts a new column in the schema.
colno | The insertion position. |
colname | The column name. |
type | The column type. |
maxlen | The column maximum length. Returns IlTrue if the insertion is successful. |
IlBoolean IliSchema::isACollection | ( | ) | const |
Returns IlTrue
if the schema defines a type that is a collection of objects or values.
IlTrue
if the schema defines a type that is a collection of objects or values. Otherwise, IlFalse
is returned. IlBoolean IliSchema::isASimpleCollection | ( | ) | const |
Returns IlTrue
if the schema is defined as a simple collection type.
The value returned by this member function is meaningful only if the isACollection()
member function returns IlTrue
. This member function returns IlTrue
if the schema is a collection of values instead of a collection of objects. In this case, the schema must have exactly one column. If the schema is not a simple collection, it is a collection of objects and the number of columns is not constrained (except that there must be at least one column.)
IlTrue
if the schema is defined as a simple collection type. Returns IlTrue
if the column allows null values.
The default is IlTrue
.
colno | The column position. |
IlTrue
if the column allows null values. Returns IlTrue
if the column is part of the primary key of the schema.
primary key is a (minimal) set of columns that uniquely identifies a row, in any table that intends to conform to the schema. In other words, in any conforming table there should never be two distinct rows with the same values over the columns of the primary key. Note that it is sometimes possible to define different candidate keys for a schema. In that case, one of these candidate keys should be selected to serve as the primary key. The default for this property is IlFalse
.
colno | The column position. |
IlTrue
if the column is part of the primary key of the schema. Returns IlTrue
if the column is read-only.
The default for this property is IlFalse
.
colno | The column position. |
IlTrue
if the column positioned at colno is read-only. Returns IlTrue
if the column should be visible.
Note that for a column, being invisible is not quite the same as having a display width of zero, since an end-user may resize a visible column at will. The default is IlTrue
.
colno | The column position. |
IlTrue
if the column should be visible. IlBoolean IliSchema::isPrimaryKeyDefined | ( | ) | const |
Returns IlTrue
if the schema has one or more columns defined as being part of the primary key.
IlTrue
if the schema has one or more columns defined as being part of the primary key. Moves a column.
from | The start position. |
to | The destination position. |
IlTrue
if successful. void IliSchema::removeHook | ( | IliTableHook * | hook | ) |
Removes a hook from the list of hooks of the schema object.
hook | The hook. |
void IliSchema::setAsCollection | ( | IlBoolean | flag | ) |
Sets the schema as a collection type.
flag | If IlTrue , this member function defines the schema as a collection type. |
void IliSchema::setAsSimpleCollection | ( | IlBoolean | flag | ) |
Sets the schema as a simple collection type.
flag | If IlTrue , it defines the schema as a simple collection type. |
|
virtual |
Sets the alignment of one column.
colno | The column position. |
align | The alignment. |
|
virtual |
Sets the default value for one column.
colno | The column position. |
val | The default value. It is copied by this member function. |
Sets the display width of one column.
colno | The column position. |
width | The width in pixels. |
Sets the format of the column.
colno | The column position. |
fmt | The format. |
|
virtual |
Sets the label of one column.
colno | The column position. |
label | The column label, it is copied by this member function. |
|
virtual |
Sets the input mask of one column.
colno | The column position. |
mask | The mask. |
Sets the maximum length for one column.
colno | The column position. |
maxlen | The maximum length. |
Reimplemented in IliMemoryTable.
|
virtual |
Sets the name of the column.
colno | The column position. |
colname | The column name, it is copied by this member function. |
Determines if the column positioned at colno is nullable (that is, may contain null values).
colno | The column position. |
nullable | If IlTrue , the column is nullable. |
Reimplemented in IliMemoryTable.
Specifies whether the column is part of the primary key.
colno | The column position. |
partOfKey | If IlTrue , the column is part of key. |
Specifies whether a column is read-only.
colno | The column position. |
readOnly | If IlTrue , the column is read-only. |
|
virtual |
Sets the title of one column.
colno | The column position. |
title | The column title, it is copied by this member function. |
|
virtual |
Sets the type of the column.
colno | The column position. |
type | The column type. |
Reimplemented in IliMemoryTable.
Sets the column visibility.
colno | The column position. |
visible | The column visibility. If IlTrue , the column is visible. |
void IliSchema::setElementTypeName | ( | const char * | name | ) |
Sets the element type name.
name | The type name. |
void IliSchema::setSchemaName | ( | const char * | name | ) |
Sets the schema name.
name | The name. |
void IliSchema::startOfBatch | ( | ) |
Used to start a series of modifications on the schema object.
It allows any connected gadgets to optimize the way they reformat themselves.
|
virtual |
Writes the definition of a schema to an output stream in a form suitable to be read back by the stream-based constructor.
output | The output stream. |
Reimplemented in IliTable, IliSQLTableDef, IliMemoryTable, IliMapTable, and IliStringsTable.
© Copyright 2016, 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.