mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-06 15:42:39 +00:00
495c6e03aa
* Replace all Context references with std::weak_ptr * Fix shared context captured by value * Fix build * Fix Context with named sessions * Fix copy context * Fix gcc build * Merge with master and fix build * Fix gcc-9 build
56 lines
1.4 KiB
C++
56 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <Core/Settings.h>
|
|
#include <Poco/Util/Application.h>
|
|
#include <filesystem>
|
|
#include <memory>
|
|
#include <optional>
|
|
#include <loggers/Loggers.h>
|
|
#include <Interpreters/Context.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/// 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(ContextPtr context);
|
|
void applyCmdSettings(ContextPtr context);
|
|
void processQueries();
|
|
void setupUsers();
|
|
void cleanup();
|
|
|
|
protected:
|
|
SharedContextHolder shared_context;
|
|
ContextPtr global_context;
|
|
|
|
/// Settings specified via command line args
|
|
Settings cmd_settings;
|
|
|
|
std::optional<std::filesystem::path> temporary_directory_to_delete;
|
|
};
|
|
|
|
}
|