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,9 +16,9 @@
MA 02110-1301, USA. */
/*******************************************************************************
* $Id$
*
*******************************************************************************/
* $Id$
*
*******************************************************************************/
/*
* we_brmrprtparser.cpp
@ -35,15 +35,12 @@ using namespace std;
namespace WriteEngine
{
BrmReportParser::BrmReportParser(): fRptFile()
BrmReportParser::BrmReportParser() : fRptFile()
{
}
BrmReportParser::~BrmReportParser()
{
}
//------------------------------------------------------------------------------
@ -53,53 +50,52 @@ BrmReportParser::~BrmReportParser()
// Function is limited to records that are no longer than 255 bytes.
// If a record is longer than 255 bytes, the function misbehaves.
//------------------------------------------------------------------------------
bool BrmReportParser::serialize(std::string RptFileName,
messageqcpp::ByteStream& Bs)
bool BrmReportParser::serialize(std::string RptFileName, messageqcpp::ByteStream& Bs)
{
try
{
fRptFile.open(RptFileName.c_str(), ifstream::in);
}
catch (std::exception& ex)
{
cout << "Failed to open BRMRptFile " << RptFileName << endl;
cout << ex.what() << endl;
throw runtime_error(ex.what());
}
try
{
fRptFile.open(RptFileName.c_str(), ifstream::in);
}
catch (std::exception& ex)
{
cout << "Failed to open BRMRptFile " << RptFileName << endl;
cout << ex.what() << endl;
throw runtime_error(ex.what());
}
if (fRptFile.good())
{
char aBuff[10240];
unsigned int aLen = 0;
if (fRptFile.good())
{
char aBuff[10240];
unsigned int aLen = 0;
while (fRptFile.good() && !fRptFile.eof())
while (fRptFile.good() && !fRptFile.eof())
{
fRptFile.getline(aBuff, sizeof(aBuff) - 1);
aLen = fRptFile.gcount();
if ((aLen != (sizeof(aBuff) - 1)) && (aLen > 0))
{
// aBuff[aLen-1] = '\n';
// aBuff[aLen]=0;
// cout << "Data Read " << aBuff <<endl;
if (aBuff[0] != '#') // do not serialize comments
{
fRptFile.getline(aBuff, sizeof(aBuff) - 1);
aLen = fRptFile.gcount();
std::string strData = aBuff;
Bs << strData;
}
}
} // while
if ((aLen != (sizeof(aBuff) - 1)) && (aLen > 0))
{
//aBuff[aLen-1] = '\n';
//aBuff[aLen]=0;
//cout << "Data Read " << aBuff <<endl;
if (aBuff[0] != '#') // do not serialize comments
{
std::string strData = aBuff;
Bs << strData;
}
}
}// while
fRptFile.close();
cout << "Closed File : " << RptFileName << " " << errno << endl;
}
else
{
cout << "Failed to open : " << RptFileName << " " << errno << endl;
return false;
}
fRptFile.close();
cout << "Closed File : " << RptFileName << " " << errno << endl;
}
else
{
cout << "Failed to open : " << RptFileName << " " << errno << endl;
return false;
}
return true;
return true;
}
//------------------------------------------------------------------------------
@ -107,76 +103,70 @@ bool BrmReportParser::serialize(std::string RptFileName,
// Serialization is done in 8192 byte blocks instead of by line or by record,
// so that this function will work for both character and binary files.
//------------------------------------------------------------------------------
bool BrmReportParser::serializeBlocks(std::string RptFileName,
messageqcpp::ByteStream& Bs)
bool BrmReportParser::serializeBlocks(std::string RptFileName, messageqcpp::ByteStream& Bs)
{
try
try
{
fRptFile.open(RptFileName.c_str(), ifstream::in);
}
catch (std::exception& ex)
{
cout << "Failed to open Report File " << RptFileName << endl;
cout << ex.what() << endl;
return false;
}
if (fRptFile.good())
{
char aBuff[8192];
unsigned int aLen = 0;
std::string strBuff;
while (fRptFile.good())
{
fRptFile.open(RptFileName.c_str(), ifstream::in);
}
catch (std::exception& ex)
{
cout << "Failed to open Report File " << RptFileName << endl;
cout << ex.what() << endl;
return false;
fRptFile.read(aBuff, sizeof(aBuff));
aLen = fRptFile.gcount();
if (aLen > 0)
{
strBuff.assign(aBuff, aLen);
Bs << strBuff;
}
}
if (fRptFile.good())
{
char aBuff[8192];
unsigned int aLen = 0;
std::string strBuff;
fRptFile.close();
cout << "Closed Report File : " << RptFileName << endl;
}
else
{
std::ostringstream oss;
oss << "Failed to open Report File " << RptFileName << endl;
cout << oss.str() << endl;
return false;
}
while ( fRptFile.good() )
{
fRptFile.read(aBuff, sizeof(aBuff));
aLen = fRptFile.gcount();
if (aLen > 0)
{
strBuff.assign( aBuff, aLen );
Bs << strBuff;
}
}
fRptFile.close();
cout << "Closed Report File : " << RptFileName << endl;
}
else
{
std::ostringstream oss;
oss << "Failed to open Report File " << RptFileName << endl;
cout << oss.str() << endl;
return false;
}
return true;
return true;
}
void BrmReportParser::unserialize(messageqcpp::ByteStream& Bs)
{
//TODO to be changed. left it here to understand how to implement
/*
ObjectReader::checkType(b, ObjectReader::SIMPLECOLUMN);
ReturnedColumn::unserialize(b); // parent class unserialize
b >> (uint32_t&) fOid;
b >> fData;
b >> reinterpret_cast<ByteStream::doublebyte&>(fReturnAll);
b >> (uint32_t&) fSequence;
*/
// TODO to be changed. left it here to understand how to implement
/*
ObjectReader::checkType(b, ObjectReader::SIMPLECOLUMN);
ReturnedColumn::unserialize(b); // parent class unserialize
b >> (uint32_t&) fOid;
b >> fData;
b >> reinterpret_cast<ByteStream::doublebyte&>(fReturnAll);
b >> (uint32_t&) fSequence;
*/
std::string aStrLine;
while (Bs.length() > 0)
{
Bs >> aStrLine;
cout << aStrLine;
}
std::string aStrLine;
while (Bs.length() > 0)
{
Bs >> aStrLine;
cout << aStrLine;
}
}
} /* namespace WriteEngine */