You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
Reformat all code to coding standard
This commit is contained in:
@ -28,120 +28,133 @@
|
||||
#include "ddlpkg.h"
|
||||
#undef DDLPKG_DLLEXPORT
|
||||
|
||||
namespace ddlpackage {
|
||||
namespace ddlpackage
|
||||
{
|
||||
|
||||
using namespace std;
|
||||
using namespace std;
|
||||
|
||||
ColumnDef::~ColumnDef()
|
||||
{
|
||||
delete fType;
|
||||
delete fDefaultValue;
|
||||
ColumnConstraintList::iterator 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)
|
||||
{
|
||||
if(constraints) {
|
||||
fConstraints = *constraints;
|
||||
delete constraints;
|
||||
}
|
||||
if ( comment )
|
||||
fComment = comment;
|
||||
}
|
||||
ColumnDef::~ColumnDef()
|
||||
{
|
||||
delete fType;
|
||||
delete fDefaultValue;
|
||||
ColumnConstraintList::iterator 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)
|
||||
{
|
||||
if (constraints)
|
||||
{
|
||||
fConstraints = *constraints;
|
||||
delete constraints;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
ostream& operator<<(ostream& os, const ColumnDef& column)
|
||||
{
|
||||
os << "Column: " << column.fName << " " << *column.fType;
|
||||
|
||||
if (column.fDefaultValue)
|
||||
{
|
||||
os << " def=";
|
||||
|
||||
if (column.fDefaultValue->fNull)
|
||||
os << "NULL";
|
||||
else
|
||||
os << column.fDefaultValue->fValue;
|
||||
}
|
||||
|
||||
os << endl << " " << column.fConstraints.size()
|
||||
<< " constraints ";
|
||||
|
||||
ColumnConstraintList::const_iterator itr;
|
||||
|
||||
for (itr = column.fConstraints.begin();
|
||||
itr != column.fConstraints.end();
|
||||
++itr)
|
||||
{
|
||||
ColumnConstraintDef* con = *itr;
|
||||
os << *con;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
ostream& operator<<(ostream& os, const ColumnConstraintDef& con)
|
||||
{
|
||||
os << " Constraint: "
|
||||
<< con.fName << " "
|
||||
<< ConstraintString[con.fConstraintType] << " "
|
||||
<< "defer=" << con.fDeferrable << " "
|
||||
<< ConstraintAttrStrings[con.fCheckTime] << " ";
|
||||
|
||||
if (!con.fCheck.empty())
|
||||
os << "check=" << "\"" << con.fCheck << "\"";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const ColumnDefList& clist)
|
||||
{
|
||||
ColumnDefList::const_iterator itr;
|
||||
|
||||
for (itr = clist.begin(); itr != clist.end(); ++itr)
|
||||
{
|
||||
os << **itr;
|
||||
}
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
ColumnDefaultValue::ColumnDefaultValue(const char* value) :
|
||||
fNull(false)
|
||||
{
|
||||
if (0 == value)
|
||||
fNull = true;
|
||||
else
|
||||
fValue = value;
|
||||
}
|
||||
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const ColumnDefaultValue& defaultValue)
|
||||
{
|
||||
os << " def=";
|
||||
|
||||
if (defaultValue.fNull)
|
||||
os << "NULL";
|
||||
else
|
||||
os << defaultValue.fValue;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
ostream &operator<<(ostream& os, const ColumnDef &column)
|
||||
{
|
||||
os << "Column: " << column.fName << " " << *column.fType;
|
||||
|
||||
if(column.fDefaultValue) {
|
||||
os << " def=";
|
||||
|
||||
if (column.fDefaultValue->fNull)
|
||||
os << "NULL";
|
||||
else
|
||||
os << column.fDefaultValue->fValue;
|
||||
}
|
||||
|
||||
os << endl << " " << column.fConstraints.size()
|
||||
<< " constraints ";
|
||||
|
||||
ColumnConstraintList::const_iterator itr;
|
||||
for(itr = column.fConstraints.begin();
|
||||
itr != column.fConstraints.end();
|
||||
++itr) {
|
||||
ColumnConstraintDef *con = *itr;
|
||||
os << *con;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
ostream &operator<<(ostream& os, const ColumnConstraintDef &con)
|
||||
{
|
||||
os << " Constraint: "
|
||||
<< con.fName << " "
|
||||
<< ConstraintString[con.fConstraintType] << " "
|
||||
<< "defer=" << con.fDeferrable << " "
|
||||
<< ConstraintAttrStrings[con.fCheckTime] << " ";
|
||||
if(!con.fCheck.empty())
|
||||
os << "check=" << "\"" << con.fCheck << "\"";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream& os, const ColumnDefList &clist)
|
||||
{
|
||||
ColumnDefList::const_iterator itr;
|
||||
for(itr = clist.begin(); itr != clist.end(); ++itr){
|
||||
os << **itr;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
ColumnDefaultValue::ColumnDefaultValue(const char *value) :
|
||||
fNull(false)
|
||||
{
|
||||
if(0 == value)
|
||||
fNull = true;
|
||||
else
|
||||
fValue = value;
|
||||
}
|
||||
|
||||
|
||||
std::ostream &operator<<(std::ostream& os, const ColumnDefaultValue &defaultValue)
|
||||
{
|
||||
os << " def=";
|
||||
|
||||
if (defaultValue.fNull)
|
||||
os << "NULL";
|
||||
else
|
||||
os << defaultValue.fValue;
|
||||
return os;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user