rwlogo
Rogue Wave Views 5.5.1

Rogue Wave Views
Data Access Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IliSQLTableDef Class Reference

Schema class. More...

#include <ilviews/dataccess/tbldef.h>

Inheritance diagram for IliSQLTableDef:
IliSchema IliRefCounted

List of all members.

Public Member Functions

 IliSQLTableDef (IlvDisplay *display, IL_STDPREF istream &input)
 This constructor initializes an SQL table definition by reading from an input stream.
 IliSQLTableDef (const IliSQLTableDef &)
 This is the copy constructor of class IliSQLTableDef.
 IliSQLTableDef (IlvDisplay *display)
 This constructor initializes an SQL table definition.
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.
IlInt getCandidateKeysCount () const
 Returns the number of candidate keys.
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.
IlInt getColumnPrecision (IlInt colno) const
 Returns the precision of one column.
IlInt getColumnScale (IlInt colno) const
 Returns the scale of the column.
const char * getColumnSQLDefault (IlInt colno) const
 Returns the SQL default value of one column.
const char * getColumnSQLType (IlInt colno) const
 Returns the name of the SQL type for one column.
IlInt getCreateStatementsCount (IliSQLSession *session) const
 Returns the number of SQL statements needed to create the table defined by the IliSQLTableDef object.
IlInt getForeignKeysCount () const
 Returns the number of foreign keys defined for the object.
const IliSQLTableRefgetForeignKeyTable (IlInt fkno) const
 Returns the foreign table reference of the foreign key.
const IliSQLTableRefgetTableRef () const
 Returns SQL table reference of the SQL table definition.
void insertCandidateKey (IlInt ckno)
 Inserts a new candidate key.
void insertForeignKey (IlInt fkno, const IliSQLTableRef &ref)
 Inserts a new foreign key.
IlBoolean isABaseTable () const
 Returns IlTrue if the SQL table definition is a base table on the remote database.
IlBoolean isAView () const
 Returns IlTrue if the SQL table definition is a view on the remote database.
IlBoolean isColumnPartOfCandidateKey (IlInt colno, IlInt ckno) const
 Returns IlTrue if the column is part of one candidate key.
IlBoolean isColumnPartOfForeignKey (IlInt colno, IlInt fkno) const
 Returns IlTrue if the column is part of the foreign key.
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.
void normalizeKeys ()
 Removes any redundant candidate key.
void removeCandidateKey (IlInt ckno)
 Removes the candidate key at position ckno.
void removeForeignKey (IlInt fkno)
 Removes the foreign key.
void setAsView (IlBoolean f)
 Determines if the SQL table definition is a view on the remote database.
void setColumnForeignColumn (IlInt colno, IlInt fkno, const char *name)
 Sets the name of the foreign column, referenced by the foreign key.
void setColumnPartOfCandidateKey (IlInt colno, IlInt ckno, IlBoolean f)
 Specifies if the column is part of one candidate key.
void setColumnPartOfForeignKey (IlInt colno, IlInt fkno, IlBoolean f)
 Specifies if the column is part of the foreign key.
void setColumnPrecision (IlInt colno, IlInt precision)
 Sets the precision of one column.
void setColumnScale (IlInt colno, IlInt scale)
 Sets the scale of the column.
void setColumnSQLDefault (IlInt colno, const char *def)
 Sets the SQL default value of one column.
void setColumnSQLType (IlInt colno, const char *type)
 Sets the SQL type name of one column.
void setForeignKeyTable (IlInt fkno, const IliSQLTableRef &)
 Sets the foreign table reference of the foreign key.
void setTableRef (const IliSQLTableRef &ref)
 Sets the SQL table reference.
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.

Friends

class IliSQLSession

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:
display The display.
IliSQLTableDef::IliSQLTableDef ( IlvDisplay display,
IL_STDPREF istream &  input 
)

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

Parameters:
display The display.
input The 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:
ref The 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:
colno The column position.
fkno The 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:
colno The column position.
Returns:
The precision.
IlInt IliSQLTableDef::getColumnScale ( IlInt  colno  )  const

Returns the scale of the column.

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

Returns the SQL default value of one column.

Parameters:
colno The 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:
colno The 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:
session The 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:
fkno The 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:
ckno The position.
void IliSQLTableDef::insertForeignKey ( IlInt  fkno,
const IliSQLTableRef ref 
)

Inserts a new foreign key.

Parameters:
fkno The insertion position.
ref The 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:
colno The column position.
ckno The 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:
colno The column position.
fkno The 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:
session The session which is connected to the remote database.
index The statements are to be written.
stmt The SQL statements.
msg The 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:
ckno The position.
void IliSQLTableDef::removeForeignKey ( IlInt  fkno  ) 

Removes the foreign key.

Parameters:
fkno The position.
void IliSQLTableDef::setAsView ( IlBoolean  f  ) 

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

Parameters:
f If 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:
colno The column position.
fkno The foreign key position.
name The column name.
void IliSQLTableDef::setColumnPartOfCandidateKey ( IlInt  colno,
IlInt  ckno,
IlBoolean  f 
)

Specifies if the column is part of one candidate key.

Parameters:
colno The column position.
ckno The key position.
f If 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:
colno The column position.
fkno The foreign key position.
f If IlTrue, the column is part of the foreign key.
void IliSQLTableDef::setColumnPrecision ( IlInt  colno,
IlInt  precision 
)

Sets the precision of one column.

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

Sets the scale of the column.

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

Sets the SQL default value of one column.

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

Sets the SQL type name of one column.

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

Sets the foreign table reference of the foreign key.

Parameters:
fkno The foreign key position.
ref The foreign key parameters.
void IliSQLTableDef::setTableRef ( const IliSQLTableRef ref  ) 

Sets the SQL table reference.

Parameters:
ref The 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:
output The output stream.

Reimplemented from IliSchema.


© 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.