1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-27 21:01:50 +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

@ -47,65 +47,77 @@ using namespace BRM;
#include "configcpp.h"
int main (int argc, char **argv)
int main (int argc, char** argv)
{
BlockResolutionManager brm;
config::Config *config = config::Config::makeConfig();
int err;
string prefix, currentFilename;
IDBDataFile* currentFile = NULL;
BlockResolutionManager brm;
config::Config* config = config::Config::makeConfig();
int err;
string prefix, currentFilename;
IDBDataFile* currentFile = NULL;
if (argc > 1)
prefix = argv[1];
else {
prefix = config->getConfig("SystemConfig", "DBRMRoot");
if (prefix.length() == 0) {
cerr << "Error: Need a valid Calpont configuation file" << endl;
exit(1);
}
}
if (argc > 1)
prefix = argv[1];
else
{
prefix = config->getConfig("SystemConfig", "DBRMRoot");
idbdatafile::IDBPolicy::configIDBPolicy();
if (prefix.length() == 0)
{
cerr << "Error: Need a valid Calpont configuation file" << endl;
exit(1);
}
}
err = brm.saveState(prefix);
if (err == 0)
cout << "Saved to " << prefix << endl;
else {
cout << "Save failed" << endl;
exit(1);
}
idbdatafile::IDBPolicy::configIDBPolicy();
(void)::umask(0);
err = brm.saveState(prefix);
currentFilename = prefix + "_current";
currentFile = IDBDataFile::open(IDBPolicy::getType(currentFilename.c_str(),
IDBPolicy::WRITEENG),
currentFilename.c_str(),
"wb",
0);
if (err == 0)
cout << "Saved to " << prefix << endl;
else
{
cout << "Save failed" << endl;
exit(1);
}
if (!currentFile) {
cerr << "Error: could not open " << currentFilename << "for writing" << endl;
exit(1);
}
try {
(void)::umask(0);
currentFilename = prefix + "_current";
currentFile = IDBDataFile::open(IDBPolicy::getType(currentFilename.c_str(),
IDBPolicy::WRITEENG),
currentFilename.c_str(),
"wb",
0);
if (!currentFile)
{
cerr << "Error: could not open " << currentFilename << "for writing" << endl;
exit(1);
}
try
{
#ifndef _MSC_VER
prefix += '\n';
prefix += '\n';
#endif
currentFile->write(prefix.c_str(), prefix.length());
}
catch (exception &e) {
cerr << "Error: failed to write to " << currentFilename << ": " << e.what() << endl;
exit(1);
}
try {
delete currentFile;
currentFile = NULL;
}
catch (exception &e) {
cerr << "Error: failed to close " << currentFilename << ": " << e.what() << endl;
exit(1);
}
currentFile->write(prefix.c_str(), prefix.length());
}
catch (exception& e)
{
cerr << "Error: failed to write to " << currentFilename << ": " << e.what() << endl;
exit(1);
}
return 0;
try
{
delete currentFile;
currentFile = NULL;
}
catch (exception& e)
{
cerr << "Error: failed to close " << currentFilename << ": " << e.what() << endl;
exit(1);
}
return 0;
}