1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +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

@ -41,7 +41,7 @@ InsertDMLPackage::InsertDMLPackage()
InsertDMLPackage::InsertDMLPackage( std::string schemaName, std::string tableName,
std::string dmlStatement, int sessionID )
:CalpontDMLPackage( schemaName, tableName, dmlStatement, sessionID )
: CalpontDMLPackage( schemaName, tableName, dmlStatement, sessionID )
{}
InsertDMLPackage::~InsertDMLPackage()
@ -64,10 +64,12 @@ int InsertDMLPackage::write(messageqcpp::ByteStream& bytestream)
bytestream << fSchemaName;
bytestream << (uint8_t)fLogging;
bytestream << (uint8_t)fLogending;
if (fTable != 0)
{
retval = fTable->write(bytestream);
}
bytestream << fTableOid;
bytestream << static_cast<const messageqcpp::ByteStream::byte>(fIsInsertSelect);
bytestream << static_cast<const messageqcpp::ByteStream::byte>(fIsBatchInsert);
@ -108,7 +110,7 @@ int InsertDMLPackage::read(messageqcpp::ByteStream& bytestream)
int InsertDMLPackage::buildFromBuffer(std::string& buffer, int columns, int rows)
{
#ifdef DML_PACKAGE_DEBUG
// cout << "The data buffer received: " << buffer << endl;
// cout << "The data buffer received: " << buffer << endl;
#endif
int retval = 1;
@ -118,6 +120,7 @@ int InsertDMLPackage::buildFromBuffer(std::string& buffer, int columns, int rows
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
boost::char_separator<char> sep(",");
tokenizer tokens(buffer, sep);
for (tokenizer::iterator tok_iter = tokens.begin(); tok_iter != tokens.end(); ++tok_iter)
{
dataList.push_back(StripLeadingWhitespace(*tok_iter));
@ -125,12 +128,14 @@ int InsertDMLPackage::buildFromBuffer(std::string& buffer, int columns, int rows
}
int n = 0;
for (int i=0; i < rows; i++)
for (int i = 0; i < rows; i++)
{
//get a new row
Row *aRowPtr = new Row();
Row* aRowPtr = new Row();
std::string colName;
std::string colValue;
for (int j = 0; j < columns; j++)
{
//Build a column list
@ -144,6 +149,7 @@ int InsertDMLPackage::buildFromBuffer(std::string& buffer, int columns, int rows
DMLColumn* aColumn = new DMLColumn(colName, colValue, false);
(aRowPtr->get_ColumnList()).push_back(aColumn);
}
//build a row list for a table
fTable->get_RowList().push_back(aRowPtr);
}
@ -156,19 +162,21 @@ int InsertDMLPackage::buildFromMysqlBuffer(ColNameList& colNameList, TableValues
int retval = 1;
initializeTable();
Row *aRowPtr = new Row();
Row* aRowPtr = new Row();
std::string colName;
std::vector<std::string> colValList;
for (int j = 0; j < columns; j++)
{
//Build a column list
colName = colNameList[j];
//Build a column list
colName = colNameList[j];
colValList = tableValuesMap[j];
colValList = tableValuesMap[j];
DMLColumn* aColumn = new DMLColumn(colName, colValList, false, 0, nullValues[j]);
(aRowPtr->get_ColumnList()).push_back(aColumn);
DMLColumn* aColumn = new DMLColumn(colName, colValList, false, 0, nullValues[j]);
(aRowPtr->get_ColumnList()).push_back(aColumn);
}
//build a row list for a table
fTable->get_RowList().push_back(aRowPtr);
aRowPtr = NULL;
@ -188,6 +196,7 @@ int InsertDMLPackage::buildFromSqlStatement(SqlStatement& sqlStatement)
initializeTable();
bool isNULL = false;
// only if we don't have a select statement
if (0 == insertStmt.fValuesOrQueryPtr->fQuerySpecPtr)
{
@ -198,16 +207,20 @@ int InsertDMLPackage::buildFromSqlStatement(SqlStatement& sqlStatement)
{
ValuesList valuesList = insertStmt.fValuesOrQueryPtr->fValuesList;
if (columnNameList.size() != valuesList.size())
{
throw logic_error("Column names and values count mismatch!");
}
Row* aRow = new Row();
for (unsigned int i = 0; i < columnNameList.size(); i++)
{
DMLColumn *aColumn = new DMLColumn(columnNameList[i],valuesList[i], isNULL);
DMLColumn* aColumn = new DMLColumn(columnNameList[i], valuesList[i], isNULL);
(aRow->get_ColumnList()).push_back(aColumn);
}
fTable->get_RowList().push_back(aRow);
}
@ -218,9 +231,11 @@ int InsertDMLPackage::buildFromSqlStatement(SqlStatement& sqlStatement)
Row* aRow = new Row();
std::string colName = "";
std::string colValue;
while (iter != valuesList.end())
{
colValue = *iter;
if ( strcasecmp(colValue.c_str(), "NULL") == 0)
{
isNULL = true;
@ -229,11 +244,13 @@ int InsertDMLPackage::buildFromSqlStatement(SqlStatement& sqlStatement)
{
isNULL = false;
}
DMLColumn *aColumn = new DMLColumn(colName,colValue, isNULL);
DMLColumn* aColumn = new DMLColumn(colName, colValue, isNULL);
(aRow->get_ColumnList()).push_back(aColumn);
++iter;
}
fTable->get_RowList().push_back(aRow);
}