All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
te::da::UniqueKey Class Reference

It describes a unique key (uk) constraint. More...

#include <UniqueKey.h>

Inheritance diagram for te::da::UniqueKey:
te::da::Constraint

Public Member Functions

void add (te::dt::Property *p)
 It adds the property to the list of properties that participates in the unique key. More...
 
Constraintclone ()
 It returns a clone of the object. More...
 
IndexgetAssociatedIndex () const
 It returns the associated index if one exists. More...
 
virtual DataSetTypegetDataSetType () const
 It returns the DataSetType associated to the constraint. More...
 
virtual unsigned int getId () const
 It returns the constraint identifier. More...
 
virtual const std::string & getName () const
 It returns the constraint name. More...
 
const std::vector
< te::dt::Property * > & 
getProperties () const
 It returns the properties that form the unique key. More...
 
ConstraintType getType () const
 It returns the constraint type: UNIQUEKEY. More...
 
bool has (const te::dt::Property *p) const
 It verifies if Property is associated to the unique key. More...
 
UniqueKeyoperator= (const UniqueKey &rhs)
 Assignment operator. More...
 
void replace (te::dt::Property *p, te::dt::Property *pp)
 
void setAssociatedIndex (Index *idx)
 It sets the associated index. More...
 
virtual void setDataSetType (DataSetType *dt)
 It sets the DataSetType associated to the constraint. More...
 
virtual void setId (unsigned int id)
 It sets the constraint identifier. More...
 
virtual void setName (const std::string &name)
 It sets the constraint name. More...
 
void setProperties (const std::vector< te::dt::Property * > &properties)
 It sets the properties that form the unique key. More...
 
 UniqueKey (DataSetType *dt=0, unsigned int id=0)
 Constructor. More...
 
 UniqueKey (const std::string &name, DataSetType *dt=0, unsigned int id=0)
 Constructor. More...
 
 UniqueKey (const UniqueKey &rhs)
 Copy constructor. More...
 
 ~UniqueKey ()
 Destructor. More...
 

Private Attributes

Indexm_index
 A pointer to an associated index. More...
 
std::vector< te::dt::Property * > m_properties
 The properties that are part of the unique key constraint. More...
 

Detailed Description

It describes a unique key (uk) constraint.

See also
DataSetType, Index, PrimaryKey, ForeignKey, DataSetTypeCheckRestriction

Definition at line 53 of file UniqueKey.h.

Constructor & Destructor Documentation

te::da::UniqueKey::UniqueKey ( DataSetType dt = 0,
unsigned int  id = 0 
)

Constructor.

Parameters
dtThe DataSetType associated to this uk.
idThe uk identifier.
Postcondition
If dt is provided, the uk will belong to the given DataSetType.
Warning
The identifier value (id) may be used by data source implementations. So, don't rely on its value!

Definition at line 31 of file UniqueKey.cpp.

References te::da::DataSetType::add().

te::da::UniqueKey::UniqueKey ( const std::string &  name,
DataSetType dt = 0,
unsigned int  id = 0 
)

Constructor.

Parameters
nameThe unique key (uk) constraint name.
dtThe DataSetType associated to this uk.
idThe uk identifier.
Postcondition
If dt is provided, the uk will belong to the given DataSetType.
Warning
The identifier value (id) may be used by data source implementations. So, don't rely on its value!

Definition at line 39 of file UniqueKey.cpp.

References te::da::DataSetType::add().

te::da::UniqueKey::UniqueKey ( const UniqueKey rhs)

Copy constructor.

The new object will not have an associated DataSetType.

Parameters
rhsRight-hand-side instance.

Definition at line 47 of file UniqueKey.cpp.

te::da::UniqueKey::~UniqueKey ( )
inline

Destructor.

Definition at line 92 of file UniqueKey.h.

Member Function Documentation

void te::da::UniqueKey::add ( te::dt::Property p)
inline

It adds the property to the list of properties that participates in the unique key.

Parameters
pThe Property that will take part of the unique key.

Definition at line 124 of file UniqueKey.h.

Referenced by te::da::DataSetType::DataSetType(), te::qt::widgets::UniqueKeyConstraintWidget::getConstraint(), and te::ado::Transactor::getUniqueKeys().

te::da::Constraint * te::da::UniqueKey::clone ( )
virtual

It returns a clone of the object.

The new object will not have an associated DataSetType.

Returns
A clone of the object.

Implements te::da::Constraint.

Definition at line 91 of file UniqueKey.cpp.

Index* te::da::UniqueKey::getAssociatedIndex ( ) const
inline

It returns the associated index if one exists.

Returns
An associated index if one exists.

Definition at line 131 of file UniqueKey.h.

Referenced by te::da::DataSetType::DataSetType().

virtual DataSetType* te::da::Constraint::getDataSetType ( ) const
inlinevirtualinherited

It returns the DataSetType associated to the constraint.

Returns
The DataSetType associated to the constraint.

Definition at line 133 of file Constraint.h.

Referenced by te::da::DataSourceCatalog::dropDependentFKs(), and te::da::DataSetType::remove().

virtual unsigned int te::da::Constraint::getId ( ) const
inlinevirtualinherited

It returns the constraint identifier.

Returns
A number that identifies the constraint.
Warning
The identifier value (id) may be used by data source implementations. So, don't rely on its value!

Definition at line 103 of file Constraint.h.

const std::vector<te::dt::Property*>& te::da::UniqueKey::getProperties ( ) const
inline
ConstraintType te::da::UniqueKey::getType ( ) const
inlinevirtual

It returns the constraint type: UNIQUEKEY.

Returns
The constraint type UNIQUEKEY.

Implements te::da::Constraint.

Definition at line 164 of file UniqueKey.h.

References te::da::UNIQUE_KEY.

bool te::da::UniqueKey::has ( const te::dt::Property p) const

It verifies if Property is associated to the unique key.

Parameters
pThe Property to be verified.
Returns
True if Property is associated to the unique key, false otherwise.

Definition at line 68 of file UniqueKey.cpp.

te::da::UniqueKey & te::da::UniqueKey::operator= ( const UniqueKey rhs)

Assignment operator.

The new object will not have an assigned DataSetType.

Parameters
rhsRight-hand-side instance.
Returns
A reference to this.

Definition at line 54 of file UniqueKey.cpp.

References m_index, m_properties, and te::da::Constraint::operator=().

void te::da::UniqueKey::replace ( te::dt::Property p,
te::dt::Property pp 
)

Definition at line 79 of file UniqueKey.cpp.

void te::da::UniqueKey::setAssociatedIndex ( Index idx)
inline

It sets the associated index.

Parameters
idxA index associated to the unique key.

Definition at line 138 of file UniqueKey.h.

Referenced by te::pgis::Transactor::createDataSet(), te::da::DataSetType::DataSetType(), te::sqlite::DataSourceCatalogLoader::getIndex(), te::pgis::Transactor::getIndexes(), and te::pgis::Transactor::getUniqueKey().

virtual void te::da::Constraint::setDataSetType ( DataSetType dt)
inlinevirtualinherited

It sets the DataSetType associated to the constraint.

Parameters
dtThe DataSetType associated to this constraint.
Warning
Take care when calling this method. If the constraint belongs to a DataSetType, remember to detach it from the DataSetType before calling this method.

Definition at line 143 of file Constraint.h.

Referenced by te::da::DataSetType::add(), te::da::DataSetType::DataSetType(), and te::da::DataSetType::setPrimaryKey().

virtual void te::da::Constraint::setId ( unsigned int  id)
inlinevirtualinherited

It sets the constraint identifier.

Parameters
idA number that identifies the constraint.
Warning
The identifier value (id) may be used by data source implementations. So, don't rely on its value!

Definition at line 112 of file Constraint.h.

Referenced by te::pgis::Transactor::getCheckConstraint(), and te::pgis::Transactor::getConstraints().

void te::da::UniqueKey::setProperties ( const std::vector< te::dt::Property * > &  properties)
inline

It sets the properties that form the unique key.

Parameters
propertiesThe properties that form the unique key.

Definition at line 117 of file UniqueKey.h.

Referenced by te::ado::Convert2Terralib().

Member Data Documentation

Index* te::da::UniqueKey::m_index
private

A pointer to an associated index.

Definition at line 177 of file UniqueKey.h.

Referenced by operator=().

std::vector<te::dt::Property*> te::da::UniqueKey::m_properties
private

The properties that are part of the unique key constraint.

Definition at line 178 of file UniqueKey.h.

Referenced by operator=().


The documentation for this class was generated from the following files: