ClickHouse/dbms/programs/local/LocalServer.h
proller 09f3d68f6e Use logging in clickhouse-local. Use config options in command line in clickhouse-client (#5540)
* Try fix macos server run

* Doc macos build
 # Please enter the commit message for your changes. Lines starting

* CLICKHOUSE-3957 start wip

* tests wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* fix

* fix

* Making logger for clickhouse-local

* fixes

* wip

* wip

* wip

* wip

* clean

*      cf

* wip

* fix

* Update CMakeLists.txt

* Update argsToConfig.h

* Update argsToConfig.cpp

* Update ExtendedLogChannel.h

* Update OwnPatternFormatter.cpp
2019-06-14 17:00:37 +03:00

55 lines
1.3 KiB
C++

#pragma once
#include <Core/Settings.h>
#include <Poco/Util/Application.h>
#include <memory>
#include <loggers/Loggers.h>
namespace DB
{
class Context;
/// Lightweight Application for clickhouse-local
/// No networking, no extra configs and working directories, no pid and status files, no dictionaries, no logging.
/// Quiet mode by default
class LocalServer : public Poco::Util::Application, public Loggers
{
public:
LocalServer();
void initialize(Poco::Util::Application & self) override;
int main(const std::vector<std::string> & args) override;
void init(int argc, char ** argv);
~LocalServer() override;
private:
/** Composes CREATE subquery based on passed arguments (--structure --file --table and --input-format)
* This query will be executed first, before queries passed through --query argument
* Returns empty string if it cannot compose that query.
*/
std::string getInitialCreateTableQuery();
void tryInitPath();
void applyCmdOptions();
void applyCmdSettings();
void attachSystemTables();
void processQueries();
void setupUsers();
std::string getHelpHeader() const;
std::string getHelpFooter() const;
protected:
std::unique_ptr<Context> context;
/// Settings specified via command line args
Settings cmd_settings;
};
}