Instances of the class IldRelation
represent the relations (tables or views) in a database.
More...
#include <ildblink/ildrel.h>
Public Member Functions | |
virtual | ~IldRelation () |
This destructor is invoked when the current IldRelation object is destroyed. More... | |
short | getColIndex (const char *name) const |
Get a column index from its name. More... | |
const char * | getColName (IlUShort index) const |
Get the name of a column. More... | |
IlUInt | getColSize (IlUShort index) const |
Get the column value size. More... | |
const char * | getColSQLType (IlUShort index) const |
Get a column SQL type name. More... | |
IldColumnType | getColType (IlUShort index) const |
Get a column type. More... | |
IldColumn * | getColumn (const char *colName) const |
Get a column by name. More... | |
IldColumn * | getColumn (IlUShort index) const |
Get a column by index. More... | |
IlUShort | getCount () const |
Get the number of columns. More... | |
IldFKey ** | getForeignKeys () |
Get the foreign keys. More... | |
IldTableIndex ** | getIndexes () |
Get the indexes of the relation. More... | |
IldKey * | getPrimaryKey () |
Search the database schema for the primary key of the table. More... | |
IldKey * | getSpecialColumns () |
Search the database schema for special columns in the table. More... | |
IlBoolean | isColNullable (IlUShort index) const |
Tell if a column can be null. More... | |
Public Member Functions inherited from IldSchemaEntity | |
virtual | ~IldSchemaEntity () |
This virtual destructor is invoked when any instance of a subclass from IldSchemaEntity is being destroyed. More... | |
IldDbms * | getDbms () const |
Get the attached to connection object. More... | |
IldEntityType | getEntityType () const |
Get the type of the entity. More... | |
IlInt | getId () const |
get the identifier of the entity. More... | |
const char * | getName () const |
Get the name of the entity. More... | |
const char * | getOwner () const |
Get the owner of the entity. More... | |
Instances of the class IldRelation
represent the relations (tables or views) in a database.
Library: dbkernel
Most of the functional interface of this class consists of accessors to the characteristics of a relation. These characteristics are the name and owner of the relation, and the name, type, and size of the relation fields.
this->getDbms()->isErrorRaised()
.As the result of an SQL query, a given field may become part of a tuple. Such a field has the same characteristics as the column of a tuple; that is, a name, a type, and a size. It has an additional property: whether or not it can contain null
values. This property is referred to as the nullability of the field.
|
virtual |
This destructor is invoked when the current IldRelation
object is destroyed.
The destructor also updates the IldDbms
object that the relation is attached to.
short IldRelation::getColIndex | ( | const char * | name | ) | const |
Get a column index from its name.
name | The column name. |
The name argument must not be null or empty.
This member function can raise the following error:
ILD_BAD_COLUMN_NAME
ILD_OUT_OF_RANGE
The error is raised on the session if the object has been attached, otherwise, the error is not raised.
In case of error, whether attached to a session or not, a value of 0
is returned if the column name was not given; a value of -1
if no column with such a name could be found.
const char* IldRelation::getColName | ( | IlUShort | index | ) | const |
Get the name of a column.
index | The column index. |
It returns a constant character string. Your application must not deallocate this string because DB Link takes care of destroying it with the current object.
This member function can raise the following error:
ILD_OUT_OF_RANGE
The error is raised on the session if the object has been attached, otherwise, the error is not raised.
When the function raises the error, its return value is a null
object.
Get the column value size.
index | Teh column index. |
This information is useful when you are formatting the values in fields of character-string type.
This member function can raise the following error:
ILD_OUT_OF_RANGE
The error is raised on the session if the object has been attached, otherwise, the error is not raised.
In case of error, the value 0
is returned.
const char* IldRelation::getColSQLType | ( | IlUShort | index | ) | const |
Get a column SQL type name.
index | The column index. |
This member function can raise the following error:
ILD_OUT_OF_RANGE
The error is raised on the session if the object has been attached, otherwise, the error is not raised.
In case of error, whether attached to a session or not, a null
pointer is returned.
IldColumnType IldRelation::getColType | ( | IlUShort | index | ) | const |
Get a column type.
index | The column index. |
The member function returns one of the enumerated values of IldColumnType
.
This member function can raise the following error:
ILD_OUT_OF_RANGE
The error is raised on the session if the object has been attached, otherwise, the error is not raised.
In case of error, whether attached to a session or not, a value of IldUnknwonType
is returned.
IldColumn* IldRelation::getColumn | ( | const char * | colName | ) | const |
Get a column by name.
colName | The column name. |
The argument colName must not be a null pointer or an empty string.
This member function can raise the following errors:
ILD_BAD_COLUMN_NAME
ILD_OUT_OF_RANGE
The error is raised on the session if the object has been attached, otherwise, the error is not raised.
In case of error, whether atached to a session or not, a null
object is returned.
Get a column by index.
index | The column index. |
This member function can raise the following error:
ILD_BAD_COLUMN_INDEX
The error is raised on the session if the object has been attached, otherwise, the error is not raised.
If the position is not possible, that is it is bigger than the number of columns in the relation, a null
object is returned.
IlUShort IldRelation::getCount | ( | ) | const |
Get the number of columns.
IldFKey** IldRelation::getForeignKeys | ( | ) |
Get the foreign keys.
null
-terminated array of IldFKey
objects.If none exist, the function returns a null
pointer. The application must not delete the array nor the objects in it.
The foreign key descriptors are not created when the IldRelation
object is created, but rather when this function is called for the first time.
If an error is raised during the retrieval of keys, it is reported to the attached IldDbms
object.
If the relation is not attached to a session, this function does nothing and returns a null
object.
IldTableIndex** IldRelation::getIndexes | ( | ) |
Get the indexes of the relation.
null
-terminated array of IldTableIndex
objects.If none exist, the function returns a null
pointer. The application must not delete the array nor the objects in it.
The index descriptors are not created when the IldRelation
object is created, but rather when this function is called for the first time.
If an error is raised during the retrieval of indexes, it is reported to the attached IldDbms
object.
If the relation is not attached to a session, this function does nothing and returns a null
object.
IldKey* IldRelation::getPrimaryKey | ( | ) |
Search the database schema for the primary key of the table.
null
otherwise.If there is a primary key, it is returned as an object of the class IldKey
. If none exists, it returns a null
pointer. The returned object must not be deallocated.
The primary key descriptor is not created when the IldRelation
object is created, but rather when this function is called for the first time.
If an error is raised during key retrieval, it is reported to the attached IldDbms
object. If the relation is not attached to a session, this function does nothing and returns a null
object.
IldKey* IldRelation::getSpecialColumns | ( | ) |
Search the database schema for special columns in the table.
IldKey
object.The special-column descriptor is not created when the IldRelation
object is created, but rather when this function is called for the first time.
If an error is raised during key retrieval, it is reported to the attached IldDbms
object.
If the relation is not attached to a session, this function does nothing and returns a null
object.
Tell if a column can be null.
index | The column index. |
IlTrue
if the column located at the position indicated by index in the relation can contain null
values. Otherwise, it returns IlFalse
.This member function can raise the following error:
ILD_OUT_OF_RANGE
The error is raised on the session if the object has been attached, otherwise, the error is not raised.
In case of error, the value IlFalse
is returned.