rwlogo

Rogue Wave Views
Data Access Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

List of all members | Public Member Functions | Friends
IliSQLTableDef Class Reference

Schema class. More...

#include <ilviews/dataccess/tbldef.h>

Inheritance diagram for IliSQLTableDef:
IliSchema IliRefCounted

Public Member Functions

 IliSQLTableDef (IlvDisplay *display)
 This constructor initializes an SQL table definition. More...
 
 IliSQLTableDef (const IliSQLTableDef &)
 This is the copy constructor of class IliSQLTableDef.
 
 IliSQLTableDef (IlvDisplay *display, IL_STDPREF istream &input)
 This constructor initializes an SQL table definition by reading from an input stream. More...
 
void appendCandidateKey ()
 Appends a new candidate key at the end of all existing candidate keys.
 
void appendForeignKey (const IliSQLTableRef &ref)
 Appends a new foreign key at the end of the existing foreign keys. More...
 
IlInt getCandidateKeysCount () const
 Returns the number of candidate keys. More...
 
const char * getColumnForeignColumn (IlInt colno, IlInt fkno) const
 Returns the name of the foreign table column, which the column corresponds to, in the foreign key. More...
 
IlInt getColumnPrecision (IlInt colno) const
 Returns the precision of one column. More...
 
IlInt getColumnScale (IlInt colno) const
 Returns the scale of the column. More...
 
const char * getColumnSQLDefault (IlInt colno) const
 Returns the SQL default value of one column. More...
 
const char * getColumnSQLType (IlInt colno) const
 Returns the name of the SQL type for one column. More...
 
IlInt getCreateStatementsCount (IliSQLSession *session) const
 Returns the number of SQL statements needed to create the table defined by the IliSQLTableDef object. More...
 
IlInt getForeignKeysCount () const
 Returns the number of foreign keys defined for the object. More...
 
const IliSQLTableRefgetForeignKeyTable (IlInt fkno) const
 Returns the foreign table reference of the foreign key. More...
 
const IliSQLTableRefgetTableRef () const
 Returns SQL table reference of the SQL table definition. More...
 
void insertCandidateKey (IlInt ckno)
 Inserts a new candidate key. More...
 
void insertForeignKey (IlInt fkno, const IliSQLTableRef &ref)
 Inserts a new foreign key. More...
 
IlBoolean isABaseTable () const
 Returns IlTrue if the SQL table definition is a base table on the remote database. More...
 
IlBoolean isAView () const
 Returns IlTrue if the SQL table definition is a view on the remote database. More...
 
IlBoolean isColumnPartOfCandidateKey (IlInt colno, IlInt ckno) const
 Returns IlTrue if the column is part of one candidate key. More...
 
IlBoolean isColumnPartOfForeignKey (IlInt colno, IlInt fkno) const
 Returns IlTrue if the column is part of the foreign key. More...
 
IlBoolean makeCreateStatement (IliSQLSession *session, IlInt index, IliString &stmt, IliErrorMessage &msg) const
 Writes one of the SQL statements needed to create the table on the remote database. More...
 
void normalizeKeys ()
 Removes any redundant candidate key. More...
 
void removeCandidateKey (IlInt ckno)
 Removes the candidate key at position ckno. More...
 
void removeForeignKey (IlInt fkno)
 Removes the foreign key. More...
 
void setAsView (IlBoolean f)
 Determines if the SQL table definition is a view on the remote database. More...
 
void setColumnForeignColumn (IlInt colno, IlInt fkno, const char *name)
 Sets the name of the foreign column, referenced by the foreign key. More...
 
void setColumnPartOfCandidateKey (IlInt colno, IlInt ckno, IlBoolean f)
 Specifies if the column is part of one candidate key. More...
 
void setColumnPartOfForeignKey (IlInt colno, IlInt fkno, IlBoolean f)
 Specifies if the column is part of the foreign key. More...
 
void setColumnPrecision (IlInt colno, IlInt precision)
 Sets the precision of one column. More...
 
void setColumnScale (IlInt colno, IlInt scale)
 Sets the scale of the column. More...
 
void setColumnSQLDefault (IlInt colno, const char *def)
 Sets the SQL default value of one column. More...
 
void setColumnSQLType (IlInt colno, const char *type)
 Sets the SQL type name of one column. More...
 
void setForeignKeyTable (IlInt fkno, const IliSQLTableRef &)
 Sets the foreign table reference of the foreign key. More...
 
void setTableRef (const IliSQLTableRef &ref)
 Sets the SQL table reference. More...
 
virtual void write (IL_STDPREF ostream &output) const
 Writes the definition of an IliSQLTableDef object to an output stream, in a form suitable for reading back with the stream-based constructor. More...
 
- Public Member Functions inherited from IliSchema
 IliSchema (IlvDisplay *)
 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 IliDatatypeasDatatype () 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 IliFormatgetColumnFormat (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 IliInputMaskgetColumnMask (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 IliDatatypegetColumnType (IlInt colno) const
 Returns the type of the column. More...
 
IlvDisplaygetDisplay () 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 IliSchemagetNestedSchema (const IliAttributePath &path) const
 Returns the nested schema. More...
 
IliSchemagetNestedSchema (const IliAttributePath &path)
 Returns the nested schema. More...
 
const char * getSchemaName () const
 Returns the schema name. More...
 
IlBoolean hasHook (IliTableHook *hook) const
 Returns True 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...
 
- 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 IliSQLSession
 

Additional Inherited Members

- Protected Member Functions inherited from IliRefCounted
virtual ~IliRefCounted ()
 This is the virtual destructor of the IliRefCounted class. More...
 

Detailed Description

Schema class.

Library: dataccess

The IliSQLTableDef class defines the structure of a table stored in a remote relational database. Note that the IliSQLTableDef class does not encapsulate the notion of rows, it only defines the schema of an SQL table.

See Also
IliErrorMessage, IliSQLSession, IliSQLTableRef, IliString

Constructor & Destructor Documentation

IliSQLTableDef::IliSQLTableDef ( IlvDisplay display)

This constructor initializes an SQL table definition.

Initially, this object is empty.

Parameters
displayThe display.
IliSQLTableDef::IliSQLTableDef ( IlvDisplay display,
IL_STDPREF istream &  input 
)

This constructor initializes an SQL table definition by reading from an input stream.

Parameters
displayThe display.
inputThe input stream.

Member Function Documentation

void IliSQLTableDef::appendForeignKey ( const IliSQLTableRef ref)

Appends a new foreign key at the end of the existing foreign keys.

Parameters
refThe foreign key parameters.
IlInt IliSQLTableDef::getCandidateKeysCount ( ) const

Returns the number of candidate keys.

Returns
The number of candidate keys.
const char* IliSQLTableDef::getColumnForeignColumn ( IlInt  colno,
IlInt  fkno 
) const

Returns the name of the foreign table column, which the column corresponds to, in the foreign key.

Parameters
colnoThe column position.
fknoThe foreign key position.
Returns
The name of the foreign table column, which the column corresponds to, in the foreign key.
IlInt IliSQLTableDef::getColumnPrecision ( IlInt  colno) const

Returns the precision of one column.

Parameters
colnoThe column position.
Returns
The precision.
IlInt IliSQLTableDef::getColumnScale ( IlInt  colno) const

Returns the scale of the column.

Parameters
colnoThe column position.
Returns
The scale.
const char* IliSQLTableDef::getColumnSQLDefault ( IlInt  colno) const

Returns the SQL default value of one column.

Parameters
colnoThe column position.
Returns
The SQL default value of the column.
const char* IliSQLTableDef::getColumnSQLType ( IlInt  colno) const

Returns the name of the SQL type for one column.

The SQL type name is dependent on the database system that the table is stored on.

Parameters
colnoThe column position.
Returns
The name of the SQL type for the column or NULL if the position is out of bounds.
IlInt IliSQLTableDef::getCreateStatementsCount ( IliSQLSession session) const

Returns the number of SQL statements needed to create the table defined by the IliSQLTableDef object.

Parameters
sessionThe session which is connected to the remote database.
Returns
The number of SQL statements needed to create the table defined by the IliSQLTableDef object.
IlInt IliSQLTableDef::getForeignKeysCount ( ) const

Returns the number of foreign keys defined for the object.

Returns
The number of foreign keys defined for the object.
const IliSQLTableRef& IliSQLTableDef::getForeignKeyTable ( IlInt  fkno) const

Returns the foreign table reference of the foreign key.

Parameters
fknoThe position.
Returns
The foreign table reference of the foreign key.
const IliSQLTableRef& IliSQLTableDef::getTableRef ( ) const

Returns SQL table reference of the SQL table definition.

An SQL table reference specifies the name of a table, along with the name of the owner of the table.

Returns
SQL table reference of the SQL table definition.
void IliSQLTableDef::insertCandidateKey ( IlInt  ckno)

Inserts a new candidate key.

Parameters
cknoThe position.
void IliSQLTableDef::insertForeignKey ( IlInt  fkno,
const IliSQLTableRef ref 
)

Inserts a new foreign key.

Parameters
fknoThe insertion position.
refThe foreign key parameters.
IlBoolean IliSQLTableDef::isABaseTable ( ) const

Returns IlTrue if the SQL table definition is a base table on the remote database.

Returns
IlTrue if the SQL table definition is a base table on the remote database.
IlBoolean IliSQLTableDef::isAView ( ) const

Returns IlTrue if the SQL table definition is a view on the remote database.

Returns
IlTrue if the SQL table definition is a view on the remote database.
IlBoolean IliSQLTableDef::isColumnPartOfCandidateKey ( IlInt  colno,
IlInt  ckno 
) const

Returns IlTrue if the column is part of one candidate key.

Parameters
colnoThe column position.
cknoThe key position.
Returns
IlTrue if the column is part of the candidate key.
IlBoolean IliSQLTableDef::isColumnPartOfForeignKey ( IlInt  colno,
IlInt  fkno 
) const

Returns IlTrue if the column is part of the foreign key.

Parameters
colnoThe column position.
fknoThe foreign key position.
Returns
IlTrue if the column is part of the foreign key.
IlBoolean IliSQLTableDef::makeCreateStatement ( IliSQLSession session,
IlInt  index,
IliString stmt,
IliErrorMessage msg 
) const

Writes one of the SQL statements needed to create the table on the remote database.

Parameters
sessionThe session which is connected to the remote database.
indexThe statements are to be written.
stmtThe SQL statements.
msgThe error message if an error occurs.
Returns
IlTrue if successful.
void IliSQLTableDef::normalizeKeys ( )

Removes any redundant candidate key.

This member function will optimize the set of the candidate keys and the primary key of the object to ensure that:

  • if the object has any candidate keys, the primary key is defined,
  • no candidate key is a superset of any other candidate key, or of the primary key.

It also selects the smallest candidate key to serve as a primary key.

void IliSQLTableDef::removeCandidateKey ( IlInt  ckno)

Removes the candidate key at position ckno.

Parameters
cknoThe position.
void IliSQLTableDef::removeForeignKey ( IlInt  fkno)

Removes the foreign key.

Parameters
fknoThe position.
void IliSQLTableDef::setAsView ( IlBoolean  f)

Determines if the SQL table definition is a view on the remote database.

Parameters
fIf IlTrue, the SQL table definition is a view on the remote database.
void IliSQLTableDef::setColumnForeignColumn ( IlInt  colno,
IlInt  fkno,
const char *  name 
)

Sets the name of the foreign column, referenced by the foreign key.

The name is set to a copy.

Parameters
colnoThe column position.
fknoThe foreign key position.
nameThe column name.
void IliSQLTableDef::setColumnPartOfCandidateKey ( IlInt  colno,
IlInt  ckno,
IlBoolean  f 
)

Specifies if the column is part of one candidate key.

Parameters
colnoThe column position.
cknoThe key position.
fIf IlTrue, the column is part of the candidate key.
void IliSQLTableDef::setColumnPartOfForeignKey ( IlInt  colno,
IlInt  fkno,
IlBoolean  f 
)

Specifies if the column is part of the foreign key.

Parameters
colnoThe column position.
fknoThe foreign key position.
fIf IlTrue, the column is part of the foreign key.
void IliSQLTableDef::setColumnPrecision ( IlInt  colno,
IlInt  precision 
)

Sets the precision of one column.

Parameters
colnoThe column position.
precisionThe precision.
void IliSQLTableDef::setColumnScale ( IlInt  colno,
IlInt  scale 
)

Sets the scale of the column.

Parameters
colnoThe column position.
scaleThe scale.
void IliSQLTableDef::setColumnSQLDefault ( IlInt  colno,
const char *  def 
)

Sets the SQL default value of one column.

Parameters
colnoThe column position.
defThe SQL default.
void IliSQLTableDef::setColumnSQLType ( IlInt  colno,
const char *  type 
)

Sets the SQL type name of one column.

Parameters
colnoThe column position.
typeThe SQL type.
void IliSQLTableDef::setForeignKeyTable ( IlInt  fkno,
const IliSQLTableRef  
)

Sets the foreign table reference of the foreign key.

Parameters
fknoThe foreign key position.
refThe foreign key parameters.
void IliSQLTableDef::setTableRef ( const IliSQLTableRef ref)

Sets the SQL table reference.

Parameters
refThe new SQL table reference.
virtual void IliSQLTableDef::write ( IL_STDPREF ostream &  output) const
virtual

Writes the definition of an IliSQLTableDef object to an output stream, in a form suitable for reading back with the stream-based constructor.

Parameters
outputThe output stream.

Reimplemented from IliSchema.


© Copyright 2014, 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.