Added constraints getter and setter to IStorage

This commit is contained in:
Gleb Novikov 2019-05-19 09:08:25 +03:00
parent 19d099f90a
commit 773849a43d
2 changed files with 15 additions and 0 deletions

View File

@ -47,6 +47,16 @@ void IStorage::setIndices(IndicesDescription indices_)
indices = std::move(indices_);
}
const ConstraintsDescription & IStorage::getConstraints() const
{
return constraints;
}
void IStorage::setConstraints(ConstraintsDescription constraints_)
{
constraints = std::move(constraints_);
}
NameAndTypePair IStorage::getColumn(const String & column_name) const
{
/// By default, we assume that there are no virtual columns in the storage.

View File

@ -11,6 +11,7 @@
#include <Common/ActionLock.h>
#include <Common/Exception.h>
#include <Common/RWLock.h>
#include <Storages/ConstraintsDescription.h>
#include <optional>
#include <shared_mutex>
@ -88,6 +89,9 @@ public: /// thread-unsafe part. lockStructure must be acquired
const IndicesDescription & getIndices() const;
void setIndices(IndicesDescription indices_);
const ConstraintsDescription & getConstraints() const;
void setConstraints(ConstraintsDescription constraints_);
/// NOTE: these methods should include virtual columns,
/// but should NOT include ALIAS columns (they are treated separately).
virtual NameAndTypePair getColumn(const String & column_name) const;
@ -115,6 +119,7 @@ public: /// thread-unsafe part. lockStructure must be acquired
private:
ColumnsDescription columns;
IndicesDescription indices;
ConstraintsDescription constraints;
public:
/// Acquire this lock if you need the table structure to remain constant during the execution of