Skip to content

Commit

Permalink
add param default value
Browse files Browse the repository at this point in the history
  • Loading branch information
自凡 committed Nov 30, 2022
1 parent ea10d4b commit 2058813
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 20 deletions.
8 changes: 4 additions & 4 deletions include/MetaInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ class IColMeta : public UserDataInterface {
virtual void setValuesOfEnumSet(std::vector<const char*>& v);
virtual void setValuesOfEnumSet(const char** v, size_t size);

virtual void setGenerated(bool Generated);
virtual void setHiddenRowKey();
virtual void setGenerated(bool generated = true);
virtual void setHiddenRowKey(bool hiddenRowKey = true);
virtual bool isHiddenRowKey();
virtual void setPartitioned();
virtual void setPartitioned(bool partitioned = true);
virtual bool isPartitioned();
virtual void setDependent();
virtual void setDependent(bool dependent = true);
virtual bool isDependent();

public:
Expand Down
31 changes: 21 additions & 10 deletions src/MetaInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,34 +406,45 @@ void IColMeta::setFlag(unsigned char flag)
{
m_col->m_colMetaHeader->m_flag = flag;
}
void IColMeta::setGenerated(bool Generated)
void IColMeta::setGenerated(bool generated)
{
if (Generated) {
if (generated) {
m_col->m_colMetaHeader->m_flag |= COL_FLAG_GENERATED;
} else {
// 0xffff - COL_FLAG_GENERATED to binary 0b11111110
m_col->m_colMetaHeader->m_flag &= (0xffff - COL_FLAG_GENERATED);
m_col->m_colMetaHeader->m_flag &= ~COL_FLAG_GENERATED;
}
}
void IColMeta::setHiddenRowKey()
void IColMeta::setHiddenRowKey(bool hiddenRowKey)
{
m_col->m_colMetaHeader->m_flag |= COL_FLAG_HIDDEN_ROWKEY;
if (hiddenRowKey) {
m_col->m_colMetaHeader->m_flag |= COL_FLAG_HIDDEN_ROWKEY;
} else {
m_col->m_colMetaHeader->m_flag &= ~COL_FLAG_HIDDEN_ROWKEY;
}
}
bool IColMeta::isHiddenRowKey()
{
return m_col->m_colMetaHeader->m_flag & COL_FLAG_HIDDEN_ROWKEY;
}
void IColMeta::setPartitioned()
void IColMeta::setPartitioned(bool partitioned)
{
m_col->m_colMetaHeader->m_flag |= COL_FLAG_PARTITIONED;
if (partitioned) {
m_col->m_colMetaHeader->m_flag |= COL_FLAG_PARTITIONED;
} else{
m_col->m_colMetaHeader->m_flag &= ~COL_FLAG_PARTITIONED;
}
}
bool IColMeta::isPartitioned()
{
return m_col->m_colMetaHeader->m_flag & COL_FLAG_PARTITIONED;
}
void IColMeta::setDependent()
void IColMeta::setDependent(bool dependent)
{
m_col->m_colMetaHeader->m_flag |= COL_FLAG_DEPENDENT;
if (dependent) {
m_col->m_colMetaHeader->m_flag |= COL_FLAG_DEPENDENT;
} else {
m_col->m_colMetaHeader->m_flag &= ~COL_FLAG_DEPENDENT;
}
}
bool IColMeta::isDependent()
{
Expand Down
9 changes: 6 additions & 3 deletions unittest/lrTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ IColMeta* createColMeta(const char* name, int type, int length)
colMeta->setEncoding(ENC);
colMeta->setGenerated(false);
colMeta->setGenerated(true);
colMeta->setHiddenRowKey();
colMeta->setPartitioned();
colMeta->setDependent();
colMeta->setHiddenRowKey(false);
colMeta->setHiddenRowKey(true);
colMeta->setPartitioned(false);
colMeta->setPartitioned(true);
colMeta->setDependent(false);
colMeta->setDependent(true);
colMeta->setOriginType("varchar");
colMeta->setPrecision(5);
colMeta->setScale(3);
Expand Down
9 changes: 6 additions & 3 deletions unittest/memoryleakTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ IColMeta* createColMeta(const char* name, int type, int length)
colMeta->setEncoding(ENC);
colMeta->setGenerated(false);
colMeta->setGenerated(true);
colMeta->setHiddenRowKey();
colMeta->setPartitioned();
colMeta->setDependent();
colMeta->setHiddenRowKey(false);
colMeta->setHiddenRowKey(true);
colMeta->setPartitioned(false);
colMeta->setPartitioned(true);
colMeta->setDependent(false);
colMeta->setDependent(true);
colMeta->setOriginType("varchar");
colMeta->setPrecision(5);
colMeta->setScale(4);
Expand Down

0 comments on commit 2058813

Please sign in to comment.