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

Private Attributes

DataSetTypem_dt
 The associated DataSetType.
 
unsigned int m_id
 An identification number for the constraint.
 
Indexm_index
 A pointer to an associated index.
 
std::string m_name
 The constraint name.
 
std::vector< te::dt::Property * > m_properties
 The properties that take part of primary key constraint.
 

Detailed Description

It describes a unique key (uk) constraint.

See also
DataSetType, Index, PrimaryKey, ForeignKey, DataSetTypeCheckRestriction

Definition at line 49 of file UniqueKey.h.

Constructor & Destructor Documentation

◆ UniqueKey() [1/3]

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!

Referenced by operator=(), and UniqueKey().

◆ UniqueKey() [2/3]

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!

◆ UniqueKey() [3/3]

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

Copy constructor.

The new object will not have an associated DataSetType.

Parameters
rhsRight-hand-side instance.

References UniqueKey().

◆ ~UniqueKey()

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

Destructor.

Member Function Documentation

◆ add()

void te::da::UniqueKey::add ( const 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 113 of file UniqueKey.h.

References te::dt::Property::clone(), and m_properties.

◆ clone()

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.

References te::da::Constraint::Constraint().

◆ getAssociatedIndex()

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 120 of file UniqueKey.h.

References m_index.

◆ getDataSetType()

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.

References m_dt.

◆ getId()

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.

References m_id.

◆ getName()

virtual const std::string & te::da::Constraint::getName ( ) const
inlinevirtualinherited

It returns the constraint name.

Returns
The constraint name.

Definition at line 119 of file Constraint.h.

References m_name.

◆ getProperties()

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

It returns the properties that form the unique key.

Returns
The properties that form the unique key.

Definition at line 106 of file UniqueKey.h.

References m_properties.

◆ getType()

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 153 of file UniqueKey.h.

References te::da::UNIQUE_KEY.

◆ has()

bool te::da::UniqueKey::has ( const std::string & propertyName) const

It verifies if Property is associated to the unique key.

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

◆ operator=()

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.

References UniqueKey().

◆ replace()

void te::da::UniqueKey::replace ( const std::string & propName,
const te::dt::Property * pp )

◆ setAssociatedIndex()

void te::da::UniqueKey::setAssociatedIndex ( const Index * idx)

It sets the associated index.

Parameters
idxA index associated to the unique key.

◆ setDataSetType()

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.

References m_dt.

◆ setId()

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.

References m_id.

◆ setName()

virtual void te::da::Constraint::setName ( const std::string & name)
inlinevirtualinherited

It sets the constraint name.

Parameters
nameThe constraint name.

Definition at line 126 of file Constraint.h.

References m_name.

Member Data Documentation

◆ m_dt

DataSetType* te::da::Constraint::m_dt
privateinherited

The associated DataSetType.

Definition at line 166 of file Constraint.h.

Referenced by getDataSetType(), and setDataSetType().

◆ m_id

unsigned int te::da::Constraint::m_id
privateinherited

An identification number for the constraint.

Definition at line 165 of file Constraint.h.

Referenced by getId(), and setId().

◆ m_index

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

A pointer to an associated index.

Definition at line 166 of file UniqueKey.h.

Referenced by getAssociatedIndex().

◆ m_name

std::string te::da::Constraint::m_name
privateinherited

The constraint name.

Definition at line 167 of file Constraint.h.

Referenced by getName(), and setName().

◆ m_properties

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

The properties that take part of primary key constraint.

Definition at line 167 of file UniqueKey.h.

Referenced by add(), and getProperties().


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