1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

clang format apply

This commit is contained in:
Leonid Fedorov
2022-01-21 16:43:49 +00:00
parent 6b6411229f
commit 04752ec546
1376 changed files with 393460 additions and 412662 deletions

View File

@ -16,10 +16,10 @@
MA 02110-1301, USA. */
/***********************************************************************
* $Id: columndef.cpp 9210 2013-01-21 14:10:42Z rdempsey $
*
*
***********************************************************************/
* $Id: columndef.cpp 9210 2013-01-21 14:10:42Z rdempsey $
*
*
***********************************************************************/
#include <iostream>
#include <iomanip>
@ -30,131 +30,113 @@
namespace ddlpackage
{
using namespace std;
ColumnDef::~ColumnDef()
{
delete fType;
delete fDefaultValue;
ColumnConstraintList::iterator itr;
delete fType;
delete fDefaultValue;
ColumnConstraintList::iterator itr;
for (itr = fConstraints.begin(); itr != fConstraints.end(); ++itr)
{
delete *itr;
}
for (itr = fConstraints.begin(); itr != fConstraints.end(); ++itr)
{
delete *itr;
}
}
ColumnDef::ColumnDef(const char* name, ColumnType* columnType, ColumnConstraintList* constraints,
ColumnDefaultValue* defaultValue, const char* comment ) :
SchemaObject(name),
fType(columnType),
fDefaultValue(defaultValue)
ColumnDefaultValue* defaultValue, const char* comment)
: SchemaObject(name), fType(columnType), fDefaultValue(defaultValue)
{
if (constraints)
{
fConstraints = *constraints;
delete constraints;
}
if (constraints)
{
fConstraints = *constraints;
delete constraints;
}
if ( comment )
fComment = comment;
if (comment)
fComment = comment;
}
ostream& operator<<(ostream& os, const ColumnType& columnType)
{
os << setw(12) << left << DDLDatatypeString[columnType.fType]
<< "["
<< "L=" << setw(2) << columnType.fLength << ","
<< "P=" << setw(2) << columnType.fPrecision << ","
<< "S=" << setw(2) << columnType.fScale << ","
<< "T=" << setw(2) << columnType.fWithTimezone
<< "]";
return os;
os << setw(12) << left << DDLDatatypeString[columnType.fType] << "["
<< "L=" << setw(2) << columnType.fLength << ","
<< "P=" << setw(2) << columnType.fPrecision << ","
<< "S=" << setw(2) << columnType.fScale << ","
<< "T=" << setw(2) << columnType.fWithTimezone << "]";
return os;
}
ostream& operator<<(ostream& os, const ColumnDef& column)
{
os << "Column: " << column.fName << " " << *column.fType;
os << "Column: " << column.fName << " " << *column.fType;
if (column.fDefaultValue)
{
os << " def=";
if (column.fDefaultValue)
{
os << " def=";
if (column.fDefaultValue->fNull)
os << "NULL";
else
os << column.fDefaultValue->fValue;
}
if (column.fDefaultValue->fNull)
os << "NULL";
else
os << column.fDefaultValue->fValue;
}
os << endl << " " << column.fConstraints.size()
<< " constraints ";
os << endl << " " << column.fConstraints.size() << " constraints ";
ColumnConstraintList::const_iterator itr;
ColumnConstraintList::const_iterator itr;
for (itr = column.fConstraints.begin();
itr != column.fConstraints.end();
++itr)
{
ColumnConstraintDef* con = *itr;
os << *con;
}
for (itr = column.fConstraints.begin(); itr != column.fConstraints.end(); ++itr)
{
ColumnConstraintDef* con = *itr;
os << *con;
}
return os;
return os;
}
ostream& operator<<(ostream& os, const ColumnConstraintDef& con)
{
os << " Constraint: "
<< con.fName << " "
<< ConstraintString[con.fConstraintType] << " "
<< "defer=" << con.fDeferrable << " "
<< ConstraintAttrStrings[con.fCheckTime] << " ";
os << " Constraint: " << con.fName << " " << ConstraintString[con.fConstraintType] << " "
<< "defer=" << con.fDeferrable << " " << ConstraintAttrStrings[con.fCheckTime] << " ";
if (!con.fCheck.empty())
os << "check=" << "\"" << con.fCheck << "\"";
if (!con.fCheck.empty())
os << "check="
<< "\"" << con.fCheck << "\"";
return os;
return os;
}
std::ostream& operator<<(std::ostream& os, const ColumnDefList& clist)
{
ColumnDefList::const_iterator itr;
ColumnDefList::const_iterator itr;
for (itr = clist.begin(); itr != clist.end(); ++itr)
{
os << **itr;
}
for (itr = clist.begin(); itr != clist.end(); ++itr)
{
os << **itr;
}
return os;
return os;
}
ColumnDefaultValue::ColumnDefaultValue(const char* value) :
fNull(false)
ColumnDefaultValue::ColumnDefaultValue(const char* value) : fNull(false)
{
if (0 == value)
fNull = true;
else
fValue = value;
if (0 == value)
fNull = true;
else
fValue = value;
}
std::ostream& operator<<(std::ostream& os, const ColumnDefaultValue& defaultValue)
{
os << " def=";
os << " def=";
if (defaultValue.fNull)
os << "NULL";
else
os << defaultValue.fValue;
if (defaultValue.fNull)
os << "NULL";
else
os << defaultValue.fValue;
return os;
return os;
}
}
} // namespace ddlpackage