1
0
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:
Andrew Hutchings
2017-10-26 17:18:17 +01:00
parent 4985f3456e
commit 01446d1e22
1296 changed files with 403852 additions and 353747 deletions

View File

@ -39,58 +39,61 @@ namespace funcexp
CalpontSystemCatalog::ColType Func_period_add::operationType( FunctionParm& fp, CalpontSystemCatalog::ColType& resultType )
{
return resultType;
return resultType;
}
int64_t Func_period_add::getIntVal(rowgroup::Row& row,
FunctionParm& parm,
bool& isNull,
CalpontSystemCatalog::ColType& op_ct)
FunctionParm& parm,
bool& isNull,
CalpontSystemCatalog::ColType& op_ct)
{
int64_t period = parm[0]->data()->getIntVal(row, isNull);
int64_t period = parm[0]->data()->getIntVal(row, isNull);
if ( period < 10000 ) {
//get first 2 digits of year
time_t now;
now = time(NULL);
struct tm tm;
localtime_r(&now, &tm);
char timestamp[10];
strftime (timestamp, 10, "%Y", &tm);
string Syear = timestamp;
Syear = Syear.substr(0,2);
int topyear = atoi(Syear.c_str());
period = (topyear * 10000) + period;
}
if ( period < 10000 )
{
//get first 2 digits of year
time_t now;
now = time(NULL);
struct tm tm;
localtime_r(&now, &tm);
char timestamp[10];
strftime (timestamp, 10, "%Y", &tm);
string Syear = timestamp;
Syear = Syear.substr(0, 2);
int topyear = atoi(Syear.c_str());
period = (topyear * 10000) + period;
}
int64_t year = period / 100;
int64_t year = period / 100;
int64_t month = period - (year * 100);
int64_t month = period - (year * 100);
int64_t months = parm[1]->data()->getIntVal(row, isNull);
int64_t months = parm[1]->data()->getIntVal(row, isNull);
int64_t yearsAdd = months / 12;
int64_t yearsAdd = months / 12;
int64_t monthsAdd = months - (yearsAdd * 12) ;
int64_t monthsAdd = months - (yearsAdd * 12) ;
year = year + yearsAdd;
month = month + monthsAdd;
year = year + yearsAdd;
month = month + monthsAdd;
if ( month > 12 ) {
year++;
month = month - 12;
}
else
{
if ( month < 1 ) {
year--;
month = month + 12;
}
}
if ( month > 12 )
{
year++;
month = month - 12;
}
else
{
if ( month < 1 )
{
year--;
month = month + 12;
}
}
int64_t value = (year * 100) + month;
return value;
int64_t value = (year * 100) + month;
return value;
}