All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DataSetType.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/dataaccess/dataset/DataSetType.cpp
22 
23  \brief A class that models the description of a dataset.
24 */
25 
26 // TerraLib
27 #include "../../common/STLUtils.h"
28 #include "../../common/Translator.h"
29 #include "../../datatype/Enums.h"
30 #include "../../geometry/GeometryProperty.h"
31 #include "../../raster/RasterProperty.h"
32 #include "../datasource/DataSourceCatalog.h"
33 #include "../Exception.h"
34 #include "CheckConstraint.h"
35 #include "DataSetType.h"
36 #include "ForeignKey.h"
37 #include "Index.h"
38 #include "PrimaryKey.h"
39 #include "Sequence.h"
40 #include "UniqueKey.h"
41 
42 // STL
43 #include <cassert>
44 
45 te::da::DataSetType::DataSetType(const std::string& name, unsigned int id)
46  : CompositeProperty(name, name, te::dt::DATASET_TYPE, id, 0),
47  m_catalog(0),
48  m_pk(0),
49  m_category(te::da::UNKNOWN_DATASET_TYPE)
50 {
51 }
52 
54  : CompositeProperty(rhs),
55  m_catalog(0),
56  m_pk(0),
57  m_title(rhs.m_title),
58  m_category(rhs.m_category)
59 {
60  if(rhs.m_idxs.empty() == false)
61  {
62  const std::size_t size = rhs.m_idxs.size();
63 
64  for(std::size_t i = 0; i < size; ++i)
65  {
66  Index* rhsIdx = rhs.m_idxs[i];
67 
68  Index* idx = new Index(*rhsIdx);
69  idx->setDataSetType(this);
70 
71  const std::vector<te::dt::Property*>& idxProperties = rhsIdx->getProperties();
72 
73  std::vector<te::dt::Property*> properties;
74 
75  const std::size_t idxSize = idxProperties.size();
76 
77  for(std::size_t j = 0; j < idxSize; ++j)
78  {
79  const std::size_t pos = getPropertyPosition(idxProperties[j]->getName());
80  properties.push_back(m_properties[pos]);
81  }
82 
83  idx->setProperties(properties);
84 
85  m_idxs.push_back(idx);
86  }
87  }
88 
89  if(rhs.m_pk)
90  {
91  m_pk = new PrimaryKey(rhs.m_pk->getName(), this);
92 
93  const std::vector<te::dt::Property*>& pkProperties = rhs.m_pk->getProperties();
94 
95  const std::size_t size = pkProperties.size();
96 
97  for(std::size_t i = 0; i < size; ++i)
98  {
99  const std::size_t pos = getPropertyPosition(pkProperties[i]->getName());
100  m_pk->add(m_properties[pos]);
101  }
102 
103 // get associated index
104  if(rhs.m_pk->getAssociatedIndex())
105  {
106  Index* idx = rhs.m_pk->getAssociatedIndex();
107  std::size_t s = m_idxs.size();
108  for(std::size_t i = 0; i<s; ++i)
109  {
110  if(m_idxs[i]->getName()==idx->getName())
111  {
113  break;
114  }
115  }
116  }
117  }
118 
119  if(rhs.m_uniqueKeys.empty() == false)
120  {
121  const std::size_t size = rhs.m_uniqueKeys.size();
122 
123  for(std::size_t i = 0; i < size; ++i)
124  {
125  UniqueKey* rhsUk = rhs.m_uniqueKeys[i];
126 
127  UniqueKey* uk = new UniqueKey(rhsUk->getName(), this);
128 
129  const std::vector<te::dt::Property*>& ukProperties = rhsUk->getProperties();
130 
131  const std::size_t ukSize = ukProperties.size();
132 
133  for(std::size_t j = 0; j < ukSize; ++j)
134  {
135  const std::size_t pos = getPropertyPosition(ukProperties[j]->getName());
136  uk->add(m_properties[pos]);
137  }
138 
139 // get associated index
140  if(rhsUk->getAssociatedIndex())
141  {
142  Index* idx = rhsUk->getAssociatedIndex();
143  std::size_t s = m_idxs.size();
144  for(std::size_t i = 0; i<s; ++i)
145  {
146  if(m_idxs[i]->getName()==idx->getName())
147  {
148  uk->setAssociatedIndex(m_idxs[i]);
149  break;
150  }
151  }
152  }
153  //m_uniqueKeys.push_back(uk);
154  }
155  }
156 
157  if(rhs.m_checkConstraints.empty() == false)
158  {
159  const std::size_t size = rhs.m_checkConstraints.size();
160 
161  for(std::size_t i = 0; i < size; ++i)
162  {
163  CheckConstraint* rhsCk = rhs.m_checkConstraints[i];
164 
165  CheckConstraint* ck = new CheckConstraint(*rhsCk);
166  ck->setDataSetType(this);
167 
168  m_checkConstraints.push_back(ck);
169  }
170  }
171 
172  if(rhs.m_foreignKeys.empty() == false)
173  {
174  const std::size_t size = rhs.m_foreignKeys.size();
175 
176  for(std::size_t i = 0; i < size; ++i)
177  {
178  ForeignKey* rhsFk = rhs.m_foreignKeys[i];
179 
180  ForeignKey* fk = new ForeignKey(rhsFk->getName());
181  fk->setOnDeleteAction(rhsFk->getOnDeleteAction());
182  fk->setOnUpdateAction(rhsFk->getOnUpdateAction());
183  fk->setDataSetType(this);
184 
185  //referenced dataset type and properties
187  const std::vector<te::dt::Property*> refProperties = fk->getReferencedProperties();
188  fk->setReferencedProperties(refProperties);
189 
190  //own properties
191  const std::vector<te::dt::Property*>& fkProperties = rhsFk->getProperties();
192  const std::size_t fkSize = fkProperties.size();
193 
194  for(std::size_t j = 0; j < fkSize; ++j)
195  {
196  const std::size_t pos = getPropertyPosition(fkProperties[j]->getName());
197  fk->add(m_properties[pos]);
198  }
199  m_foreignKeys.push_back(fk);
200  }
201  }
202 }
203 
205 {
206  delete m_pk;
207  te::common::FreeContents(m_foreignKeys);
208  te::common::FreeContents(m_checkConstraints);
209  te::common::FreeContents(m_idxs);
210  te::common::FreeContents(m_uniqueKeys);
211 }
212 
214 {
215  //if(this != &rhs)
216  //{
217  throw Exception(TE_TR("Not implemented yet!"));
218  //}
219 
220  //return *this;
221 }
222 
224 {
225  if(pk == m_pk)
226  return;
227 
228  delete m_pk;
229 
230  if(pk)
231  pk->setDataSetType(this);
232 
233  m_pk = pk;
234 }
235 
237 {
238  assert(c);
239 
240  switch(c->getType())
241  {
242  case te::da::PRIMARY_KEY :
243  setPrimaryKey(static_cast<PrimaryKey*>(c));
244  break;
245 
246  case te::da::FOREIGN_KEY :
247  add(static_cast<ForeignKey*>(c));
248  break;
249 
250  case te::da::UNIQUE_KEY :
251  c->setDataSetType(this);
252  m_uniqueKeys.push_back(static_cast<UniqueKey*>(c));
253  break;
254 
255  case te::da::CHECK :
256  c->setDataSetType(this);
257  m_checkConstraints.push_back(static_cast<CheckConstraint*>(c));
258  break;
259 
260  default:
261  break;
262  }
263 }
264 
266 {
267  assert(c);
268 
269  switch(c->getType())
270  {
271  case te::da::PRIMARY_KEY:
272  setPrimaryKey(0);
273  break;
274 
275  case te::da::FOREIGN_KEY:
276  remove(static_cast<ForeignKey*>(c));
277  break;
278 
279  case te::da::UNIQUE_KEY:
280  remove(static_cast<UniqueKey*>(c));
281  break;
282 
283  case te::da::CHECK:
284  remove(static_cast<CheckConstraint*>(c));
285  break;
286 
287  default:
288  break;
289  }
290 }
291 
292 void te::da::DataSetType::add(const std::vector<UniqueKey*>& uks)
293 {
294  std::size_t size = uks.size();
295 
296  for(std::size_t i = 0; i < size; ++i)
297  add(uks[i]);
298 }
299 
301 {
302  std::size_t size = m_uniqueKeys.size();
303 
304  for(std::size_t i = 0; i < size; ++i)
305  {
306  if(m_uniqueKeys[i]->getName() == name)
307  return m_uniqueKeys[i];
308  }
309 
310  return 0;
311 }
312 
314 {
315  std::size_t size = m_uniqueKeys.size();
316 
317  for(std::size_t i = 0; i < size; ++i)
318  {
319  if(m_uniqueKeys[i] == uk)
320  {
321  m_uniqueKeys.erase(m_uniqueKeys.begin() + i);
322  delete uk;
323  break;
324  }
325  }
326 }
327 
329 {
330  te::common::FreeContents(m_uniqueKeys);
331  m_uniqueKeys.clear();
332 }
333 
334 void te::da::DataSetType::add(const std::vector<CheckConstraint*>& ccs)
335 {
336  std::size_t size = ccs.size();
337 
338  for(std::size_t i = 0; i < size; ++i)
339  add(ccs[i]);
340 }
341 
343 {
344  std::size_t size = m_checkConstraints.size();
345 
346  for(std::size_t i = 0; i < size; ++i)
347  {
348  if(m_checkConstraints[i]->getName() == name)
349  return m_checkConstraints[i];
350  }
351 
352  return 0;
353 }
354 
356 {
357  std::size_t size = m_checkConstraints.size();
358 
359  for(std::size_t i = 0; i < size; ++i)
360  {
361  if(m_checkConstraints[i] == cc)
362  {
363  m_checkConstraints.erase(m_checkConstraints.begin() + i);
364  delete cc;
365  break;
366  }
367  }
368 }
369 
371 {
372  te::common::FreeContents(m_checkConstraints);
373  m_checkConstraints.clear();
374 }
375 
377 {
378  assert(idx);
379  idx->setDataSetType(this);
380  m_idxs.push_back(idx);
381 }
382 
383 void te::da::DataSetType::add(const std::vector<Index*>& idxs)
384 {
385  std::size_t size = idxs.size();
386 
387  for(std::size_t i = 0; i < size; ++i)
388  add(idxs[i]);
389 }
390 
391 te::da::Index* te::da::DataSetType::getIndex(const std::string& name) const
392 {
393  std::size_t size = m_idxs.size();
394 
395  for(std::size_t i = 0; i < size; ++i)
396  if(m_idxs[i]->getName() == name)
397  return m_idxs[i];
398 
399  return 0;
400 }
401 
403 {
404 // is there associated pk?
405  if(m_pk && m_pk->getAssociatedIndex() == idx)
406  {
407  delete m_pk;
408  m_pk = 0;
409  }
410 
411 // is there associated uk?
412  {
413  std::size_t size = m_uniqueKeys.size();
414 
415  for(std::size_t i = 0; i < size; ++i)
416  {
417  if(m_uniqueKeys[i]->getAssociatedIndex() == idx)
418  {
419  delete m_uniqueKeys[i];
420  m_uniqueKeys.erase(m_uniqueKeys.begin() + i);
421  break;
422  }
423  }
424  }
425 
426 // let's find the index to drop it
427  {
428  std::size_t size = m_idxs.size();
429 
430  for(std::size_t i = 0; i < size; ++i)
431  {
432  if(m_idxs[i] == idx)
433  {
434  m_idxs.erase(m_idxs.begin() + i);
435  delete idx;
436  break;
437  }
438  }
439  }
440 }
441 
443 {
444  std::size_t size = m_idxs.size();
445 
446  for(std::size_t i = 0; i < size; ++i)
447  {
448 // is there associated pk?
449  if(m_pk && m_pk->getAssociatedIndex() == m_idxs[i])
450  m_pk->setAssociatedIndex(0);
451 
452 // is there associated uk?
453  std::size_t ssize = m_uniqueKeys.size();
454 
455  for(std::size_t j = 0; j < ssize; ++j)
456  {
457  if(m_uniqueKeys[j]->getAssociatedIndex() == m_idxs[i])
458  m_uniqueKeys[j]->setAssociatedIndex(0);
459  }
460 
461  delete m_idxs[i];
462  }
463 
464  m_idxs.clear();
465 }
466 
468 {
469  std::size_t size = m_foreignKeys.size();
470 
471  for(std::size_t i = 0; i < size; ++i)
472  {
473  if(m_foreignKeys[i]->getName() == name)
474  return m_foreignKeys[i];
475  }
476 
477  return 0;
478 }
479 
481 {
482  assert(fk);
483 
484  if(m_catalog)
485  m_catalog->addRef(fk);
486 
487  fk->setDataSetType(this);
488  m_foreignKeys.push_back(fk);
489 }
490 
492 {
493  assert(fk);
494 
495  if(fk->getDataSetType() != this)
496  throw Exception(TE_TR("The foreign key is not associated to this DataSetType!"));
497 
498  if(m_catalog)
499  m_catalog->removeRef(fk);
500 
501  std::size_t size = m_foreignKeys.size();
502 
503  for(std::size_t i = 0; i < size; ++i)
504  {
505  if(m_foreignKeys[i] == fk)
506  {
507  m_foreignKeys.erase(m_foreignKeys.begin() + i);
508  delete fk;
509  break;
510  }
511  }
512 }
513 
515 {
516 // TODO: Check Constraints...
517 
518 // if the property is associated to the pk, let's remove the pk!
519  if(m_pk && m_pk->has(p))
520  setPrimaryKey(0);
521 
522 // if the property is associated to a uk, let's remove the uk!
523  removeUniqueKeys(p);
524 
525 // if the property is associated to an index, let's remove the index!
526  removeIndexes(p);
527 
528 // if the property takes part of a fk or has dataset types referencing it, let's remove the fks!
529  removeForeignKeys(p);
530 
531 // if the property is the owner of the sequence, let's drop it
532  if(m_catalog)
533  m_catalog->dropDependentSequences(p);
534 
535 // now the property can be removed!
536  CompositeProperty::remove(p);
537 }
538 
540 {
541 }
542 
543 void te::da::DataSetType::replace(Property* p, Property* pp)
544 {
545 // let's replace primary key attributes
546  if(m_pk)
547  m_pk->replace(p, pp);
548 
549 // let's replace unique keys
550  {
551  std::size_t size = m_uniqueKeys.size();
552 
553  for(std::size_t i = 0; i < size; ++i)
554  m_uniqueKeys[i]->replace(p, pp);
555  }
556 
557 // let's replace indexes
558  {
559  std::size_t size = m_idxs.size();
560 
561  for(std::size_t i = 0; i < size; ++i)
562  m_idxs[i]->replace(p, pp);
563  }
564 
565 // if dataset type is associated to the data source catalog, let's fix foreign keys and sequences
566  if(m_catalog)
567  {
568 // replace sequences
569 // TODO: !!in the future try to explorer the catalog index for dt and sequences!!
570  {
571  std::size_t size = m_catalog->getNumberOfSequences();
572 
573  for(std::size_t i = 0; i < size; ++i)
574  if(m_catalog->getSequence(i)->getOwner() == p)
575  m_catalog->getSequence(i)->setOwner(pp);
576  }
577 
578 // replace foreign keys in all datasets
579 // TODO: !!in the future try to explore the catalog index for dt and fk!!
580  {
581  std::size_t size = m_catalog->getNumberOfDataSets();
582 
583  for(std::size_t i = 0; i < size; ++i)
584  {
585  const DataSetTypePtr& dt = m_catalog->getDataSetType(i);
586 
587  std::size_t ssize = dt->getNumberOfForeignKeys();
588 
589  for(std::size_t j = 0; j < ssize; ++j)
590  dt->getForeignKey(j)->replace(p, pp);
591  }
592  }
593  }
594  else
595  {
596 // let's replace foreign key in this dataset
597  std::size_t size = m_foreignKeys.size();
598 
599  for(std::size_t i = 0; i < size; ++i)
600  m_foreignKeys[i]->replace(p, pp);
601  }
602 
603 // and now... to finish... let's replace p by pp in the properties vector
604  {
605  std::size_t size = m_properties.size();
606 
607  for(std::size_t i = 0; i < size; ++i)
608  if(m_properties[i] == p)
609  {
610  m_properties[i] = pp;
611  break;
612  }
613  }
614 }
615 
617 {
618  return new DataSetType(*this);
619 }
620 
622 {
623  std::size_t size = m_uniqueKeys.size();
624  std::size_t i = 0;
625 
626  while(i < size)
627  {
628  if(m_uniqueKeys[i]->has(p))
629  {
630  delete m_uniqueKeys[i];
631  m_uniqueKeys.erase(m_uniqueKeys.begin() + i);
632  --size;
633  }
634  else
635  ++i;
636  }
637 }
638 
640 {
641  std::size_t size = m_idxs.size();
642  std::size_t i = 0;
643 
644  while(i < size)
645  {
646  if(m_idxs[i]->has(p))
647  {
648  delete m_idxs[i];
649  m_idxs.erase(m_idxs.begin() + i);
650  --size;
651  }
652  else
653  ++i;
654  }
655 }
656 
658 {
659 // first of all, let's see if property takes part
660 // in a self foreign key.
661  {
662  std::size_t size = m_foreignKeys.size();
663  std::size_t i = 0;
664 
665  while(i < size)
666  {
667  if(m_foreignKeys[i]->has(p))
668  {
669  if(m_catalog)
670  m_catalog->removeRef(m_foreignKeys[i]);
671 
672  delete m_foreignKeys[i];
673  m_foreignKeys.erase(m_foreignKeys.begin() + i);
674  --size;
675  }
676  else
677  ++i;
678  }
679  }
680 
681 // is there in the catalog another foreign key referencing this attribute?
682  {
683  if(m_catalog == 0)
684  return;
685 
686  std::pair<std::multimap<DataSetType*, ForeignKey*>::const_iterator,
687  std::multimap<DataSetType*, ForeignKey*>::const_iterator> range = m_catalog->getRefFK(this);
688 
689  while(range.first != range.second)
690  {
691  std::multimap<DataSetType*, ForeignKey*>::const_iterator it = range.first; // keep a pointer to current element... maybe we will erase it!
692  ++range.first;
693 
694  if(it->second->isReferenced(p))
695  {
696  DataSetType* fkFT = it->second->getDataSetType();
697  fkFT->remove(it->second);
698  }
699  }
700  }
701 }
702 
703 
void add(te::dt::Property *p)
It adds the property to the list of properties that participates in the unique key.
Definition: UniqueKey.h:124
DataSetType & operator=(const DataSetType &rhs)
Assignment operator not allowed.
virtual void setDataSetType(DataSetType *dt)
It sets the DataSetType associated to the constraint.
Definition: Constraint.h:143
void setDataSetType(DataSetType *dt)
It sets the DataSetType associated to the index.
Definition: Index.h:214
void add(te::dt::Property *p)
It adds a property to the list of properties of the primary key.
Definition: PrimaryKey.h:123
Index * getAssociatedIndex() const
It returns the associated index if one exists.
Definition: UniqueKey.h:131
It describes a primary key (pk) constraint.
boost::shared_ptr< DataSetType > DataSetTypePtr
Definition: DataSetType.h:653
Property * clone() const
It returns a clone of the object.
PrimaryKey * m_pk
The DataSetType primary key.
Definition: DataSetType.h:644
A class that models the description of a dataset.
Definition: DataSetType.h:72
CheckConstraint * getCheckConstraint(std::size_t i) const
It returns the i-th check-constraint associated to the dataset type.
Definition: DataSetType.h:354
void removeIndexes(Property *p)
It removes all indexes related to the given Property.
std::vector< Property * > m_properties
The list of property types that make the CompositeProperty.
A class that describes a check constraint.
#define TE_TR(message)
It marks a string in order to get translated.
Definition: Translator.h:347
void clear()
It clears the DataSetType definition.
std::vector< ForeignKey * > m_foreignKeys
A vector of foreign key constraints.
Definition: DataSetType.h:646
void replace(Property *p, Property *pp)
It replaces the property p by pp and adjust all pointers inclusive in the catalog.
It models a property definition.
Definition: Property.h:59
const std::vector< te::dt::Property * > & getProperties() const
It returns the properties that take part of the primary key.
Definition: PrimaryKey.h:109
Index * getIndex(std::size_t i) const
It returns the i-th index associated to the dataset type.
Definition: DataSetType.h:428
void setReferencedProperties(const std::vector< te::dt::Property * > &properties)
It sets the referenced properties (on the referenced DataSetType) of this foreign key constraint...
Definition: ForeignKey.h:146
It describes an index associated to a DataSetType.
virtual ConstraintType getType() const =0
It returns the constraint type.
void remove(Constraint *c)
It removes the constraint.
void setOnDeleteAction(FKActionType a)
It sets the action to be performed when a referenced element value in the referenced DataSetType is b...
Definition: ForeignKey.h:174
void add(te::dt::Property *p)
It adds a property to the foreign key constraint.
Definition: ForeignKey.h:112
Index * getAssociatedIndex() const
It returns the associated index if one exists.
Definition: PrimaryKey.h:137
It describes a unique key (uk) constraint.
DataSetType * getReferencedDataSetType() const
It returns the referenced DataSetType of this foreign key constraint.
Definition: ForeignKey.h:153
void removeForeignKeys(Property *p)
It removes all foreign keys that p takes part and all foreign keys that references p...
It models a foreign key constraint for a DataSetType.
Definition: ForeignKey.h:50
DataSetType(const std::string &name, unsigned int id=0)
It creates a new DataSetType not associated to any DataSetType or Catalog.
Definition: DataSetType.cpp:45
It describes a unique key (uk) constraint.
Definition: UniqueKey.h:53
void setProperties(const std::vector< te::dt::Property * > &properties)
It sets the properties that take part of the index.
Definition: Index.h:190
void setAssociatedIndex(Index *idx)
It sets the associated index.
Definition: UniqueKey.h:138
std::size_t size() const
It returns the number of properties of the CompositeProperty.
It describes a sequence (a number generator).
A class that describes a check constraint.
It models a foreign key constraint for a DataSetType.
void add(Constraint *c)
It adds a new constraint.
const std::vector< te::dt::Property * > & getProperties() const
It returns the properties that form the unique key.
Definition: UniqueKey.h:110
void removeUniqueKeys(Property *p)
It removes all unique keys related to the given Property.
void setAssociatedIndex(Index *idx)
It sets the associated index.
Definition: PrimaryKey.h:130
void clearUniqueKeys()
It removes all unique keys from the dataset type.
ForeignKey * getForeignKey(std::size_t i) const
It returns the i-th foreign key associated to the dataset type.
Definition: DataSetType.h:480
void setOnUpdateAction(FKActionType a)
It sets the action to be performed when a referenced element value in the referenced DataSetType is b...
Definition: ForeignKey.h:188
const std::vector< te::dt::Property * > & getProperties() const
It returns the properties that take part of the index.
Definition: Index.h:183
A class that models the description of a dataset.
It describes a primary key (pk) constraint.
Definition: PrimaryKey.h:52
std::vector< CheckConstraint * > m_checkConstraints
A vector of check constraints.
Definition: DataSetType.h:647
virtual DataSetType * getDataSetType() const
It returns the DataSetType associated to the constraint.
Definition: Constraint.h:133
std::size_t getPropertyPosition(const std::string &name) const
It returns the property position based on its name.
std::vector< UniqueKey * > m_uniqueKeys
A vector of unique key constraints.
Definition: DataSetType.h:649
FKActionType getOnUpdateAction() const
It returns the action performed when a referenced element value in the referenced DataSetType is bein...
Definition: ForeignKey.h:181
void setReferencedDataSetType(DataSetType *refDt)
It sets the referenced DataSetType of this foreign key constraint.
Definition: ForeignKey.h:160
void clearIndexes()
It removes all indexes from the dataset type.
virtual const std::string & getName() const
It returns the constraint name.
Definition: Constraint.h:119
std::vector< Index * > m_idxs
A vector of indexes.
Definition: DataSetType.h:648
const std::vector< te::dt::Property * > & getProperties() const
It returns the properties that take part of the foreign key constraint.
Definition: ForeignKey.h:103
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map...
Definition: BoostUtils.h:55
const std::vector< te::dt::Property * > & getReferencedProperties() const
It returns the referenced properties (on the referenced DataSetType) of this foreign key constraint...
Definition: ForeignKey.h:128
It describes an index associated to a DataSetType.
Definition: Index.h:54
void setPrimaryKey(PrimaryKey *pk)
It sets the primary key constraint.
UniqueKey * getUniqueKey(std::size_t i) const
It returns the i-th unique key.
Definition: DataSetType.h:294
void clearCheckConstraints()
It removes all check constraints.
FKActionType getOnDeleteAction() const
It returns the action performed when a referenced element value in the referenced DataSetType is bein...
Definition: ForeignKey.h:167
const std::string & getName() const
It returns the property name.
Definition: Property.h:127
const std::string & getName() const
It returns the index name.
Definition: Index.h:155