mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 02:52:13 +00:00
Merge pull request #8760 from kreuzerkrieg/GCCSuggestOverride
Add GCC warning to suggest virtual function override
This commit is contained in:
commit
5e7f80c664
@ -177,7 +177,7 @@ elseif (COMPILER_GCC)
|
|||||||
# Warn for suspicious length parameters to certain string and memory built-in functions if the argument uses sizeof
|
# Warn for suspicious length parameters to certain string and memory built-in functions if the argument uses sizeof
|
||||||
add_cxx_compile_options(-Wsizeof-pointer-memaccess)
|
add_cxx_compile_options(-Wsizeof-pointer-memaccess)
|
||||||
# Warn about overriding virtual functions that are not marked with the override keyword
|
# Warn about overriding virtual functions that are not marked with the override keyword
|
||||||
# add_cxx_compile_options(-Wsuggest-override)
|
add_cxx_compile_options(-Wsuggest-override)
|
||||||
# Warn whenever a switch statement has an index of boolean type and the case values are outside the range of a boolean type
|
# Warn whenever a switch statement has an index of boolean type and the case values are outside the range of a boolean type
|
||||||
add_cxx_compile_options(-Wswitch-bool)
|
add_cxx_compile_options(-Wswitch-bool)
|
||||||
# Warn if a self-comparison always evaluates to true or false
|
# Warn if a self-comparison always evaluates to true or false
|
||||||
|
@ -101,7 +101,7 @@ public:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void initialize(Poco::Util::Application & self [[maybe_unused]])
|
void initialize(Poco::Util::Application & self [[maybe_unused]]) override
|
||||||
{
|
{
|
||||||
std::string home_path;
|
std::string home_path;
|
||||||
const char * home_path_cstr = getenv("HOME");
|
const char * home_path_cstr = getenv("HOME");
|
||||||
@ -111,7 +111,7 @@ public:
|
|||||||
configReadClient(config(), home_path);
|
configReadClient(config(), home_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(const std::vector<std::string> &)
|
int main(const std::vector<std::string> &) override
|
||||||
{
|
{
|
||||||
if (!json_path.empty() && Poco::File(json_path).exists()) /// Clear file with previous results
|
if (!json_path.empty() && Poco::File(json_path).exists()) /// Clear file with previous results
|
||||||
Poco::File(json_path).remove();
|
Poco::File(json_path).remove();
|
||||||
@ -492,7 +492,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
~Benchmark()
|
~Benchmark() override
|
||||||
{
|
{
|
||||||
shutdown = true;
|
shutdown = true;
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ private:
|
|||||||
|
|
||||||
ConnectionParameters connection_parameters;
|
ConnectionParameters connection_parameters;
|
||||||
|
|
||||||
void initialize(Poco::Util::Application & self)
|
void initialize(Poco::Util::Application & self) override
|
||||||
{
|
{
|
||||||
Poco::Util::Application::initialize(self);
|
Poco::Util::Application::initialize(self);
|
||||||
|
|
||||||
@ -233,7 +233,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(const std::vector<std::string> & /*args*/)
|
int main(const std::vector<std::string> & /*args*/) override
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -111,7 +111,7 @@ public:
|
|||||||
server_display_name = server.config().getString("display_name", getFQDNOrHostName());
|
server_display_name = server.config().getString("display_name", getFQDNOrHostName());
|
||||||
}
|
}
|
||||||
|
|
||||||
void run();
|
void run() override;
|
||||||
|
|
||||||
/// This method is called right before the query execution.
|
/// This method is called right before the query execution.
|
||||||
virtual void customizeContext(DB::Context & /*context*/) {}
|
virtual void customizeContext(DB::Context & /*context*/) {}
|
||||||
|
@ -99,7 +99,7 @@ class ExternalTablesHandler : public Poco::Net::PartHandler, BaseExternalTable
|
|||||||
public:
|
public:
|
||||||
ExternalTablesHandler(Context & context_, const Poco::Net::NameValueCollection & params_) : context(context_), params(params_) {}
|
ExternalTablesHandler(Context & context_, const Poco::Net::NameValueCollection & params_) : context(context_), params(params_) {}
|
||||||
|
|
||||||
void handlePart(const Poco::Net::MessageHeader & header, std::istream & stream);
|
void handlePart(const Poco::Net::MessageHeader & header, std::istream & stream) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Context & context;
|
Context & context;
|
||||||
|
@ -60,7 +60,7 @@ std::ostream & operator<<(std::ostream & ostr, const TypesTestCase & test_case)
|
|||||||
class TypeTest : public ::testing::TestWithParam<TypesTestCase>
|
class TypeTest : public ::testing::TestWithParam<TypesTestCase>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void SetUp()
|
void SetUp() override
|
||||||
{
|
{
|
||||||
const auto & p = GetParam();
|
const auto & p = GetParam();
|
||||||
from_types = typesFromString(p.from_types);
|
from_types = typesFromString(p.from_types);
|
||||||
|
@ -56,13 +56,13 @@ public:
|
|||||||
|
|
||||||
DatabaseTablesSnapshotIterator(Tables && tables_) : tables(tables_), it(tables.begin()) {}
|
DatabaseTablesSnapshotIterator(Tables && tables_) : tables(tables_), it(tables.begin()) {}
|
||||||
|
|
||||||
void next() { ++it; }
|
void next() override { ++it; }
|
||||||
|
|
||||||
bool isValid() const { return it != tables.end(); }
|
bool isValid() const override { return it != tables.end(); }
|
||||||
|
|
||||||
const String & name() const { return it->first; }
|
const String & name() const override { return it->first; }
|
||||||
|
|
||||||
const StoragePtr & table() const { return it->second; }
|
const StoragePtr & table() const override { return it->second; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Copies list of dictionaries and iterates through such snapshot.
|
/// Copies list of dictionaries and iterates through such snapshot.
|
||||||
|
@ -5,6 +5,10 @@
|
|||||||
#include <IO/ReadHelpers.h>
|
#include <IO/ReadHelpers.h>
|
||||||
#include <IO/WriteHelpers.h>
|
#include <IO/WriteHelpers.h>
|
||||||
|
|
||||||
|
#if !__clang__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||||
|
#endif
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
DB::DiskPtr createDisk();
|
DB::DiskPtr createDisk();
|
||||||
|
@ -121,6 +121,11 @@ struct NumericArraySource : public ArraySourceImpl<NumericArraySource<T>>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !__clang__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wsuggest-override"
|
||||||
|
#endif
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
struct ConstSource : public Base
|
struct ConstSource : public Base
|
||||||
{
|
{
|
||||||
@ -199,6 +204,10 @@ struct ConstSource : public Base
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !__clang__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
struct StringSource
|
struct StringSource
|
||||||
{
|
{
|
||||||
using Slice = NumericArraySlice<UInt8>;
|
using Slice = NumericArraySlice<UInt8>;
|
||||||
|
@ -29,7 +29,7 @@ public:
|
|||||||
size_t buffer_size_ = DBMS_DEFAULT_BUFFER_SIZE);
|
size_t buffer_size_ = DBMS_DEFAULT_BUFFER_SIZE);
|
||||||
|
|
||||||
/// Receives response from the server after sending all data.
|
/// Receives response from the server after sending all data.
|
||||||
void finalize();
|
void finalize() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,8 @@ namespace DB
|
|||||||
class ParserArray : public IParserBase
|
class ParserArray : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "array"; }
|
const char * getName() const override { return "array"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -22,8 +22,8 @@ protected:
|
|||||||
class ParserParenthesisExpression : public IParserBase
|
class ParserParenthesisExpression : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "parenthesized expression"; }
|
const char * getName() const override { return "parenthesized expression"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -32,8 +32,8 @@ protected:
|
|||||||
class ParserSubquery : public IParserBase
|
class ParserSubquery : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "SELECT subquery"; }
|
const char * getName() const override { return "SELECT subquery"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -42,8 +42,8 @@ protected:
|
|||||||
class ParserIdentifier : public IParserBase
|
class ParserIdentifier : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "identifier"; }
|
const char * getName() const override { return "identifier"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -52,16 +52,16 @@ protected:
|
|||||||
class ParserCompoundIdentifier : public IParserBase
|
class ParserCompoundIdentifier : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "compound identifier"; }
|
const char * getName() const override { return "compound identifier"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Just *
|
/// Just *
|
||||||
class ParserAsterisk : public IParserBase
|
class ParserAsterisk : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "asterisk"; }
|
const char * getName() const override { return "asterisk"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Something like t.* or db.table.*
|
/** Something like t.* or db.table.*
|
||||||
@ -69,8 +69,8 @@ protected:
|
|||||||
class ParserQualifiedAsterisk : public IParserBase
|
class ParserQualifiedAsterisk : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "qualified asterisk"; }
|
const char * getName() const override { return "qualified asterisk"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** COLUMNS('<regular expression>')
|
/** COLUMNS('<regular expression>')
|
||||||
@ -78,8 +78,8 @@ protected:
|
|||||||
class ParserColumnsMatcher : public IParserBase
|
class ParserColumnsMatcher : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "COLUMNS matcher"; }
|
const char * getName() const override { return "COLUMNS matcher"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** A function, for example, f(x, y + 1, g(z)).
|
/** A function, for example, f(x, y + 1, g(z)).
|
||||||
@ -93,16 +93,16 @@ class ParserFunction : public IParserBase
|
|||||||
public:
|
public:
|
||||||
ParserFunction(bool allow_function_parameters_ = true) : allow_function_parameters(allow_function_parameters_) {}
|
ParserFunction(bool allow_function_parameters_ = true) : allow_function_parameters(allow_function_parameters_) {}
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "function"; }
|
const char * getName() const override { return "function"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
bool allow_function_parameters;
|
bool allow_function_parameters;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ParserCodecDeclarationList : public IParserBase
|
class ParserCodecDeclarationList : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "codec declaration list"; }
|
const char * getName() const override { return "codec declaration list"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Parse compression codec
|
/** Parse compression codec
|
||||||
@ -111,8 +111,8 @@ protected:
|
|||||||
class ParserCodec : public IParserBase
|
class ParserCodec : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "codec"; }
|
const char * getName() const override { return "codec"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ParserCastExpression : public IParserBase
|
class ParserCastExpression : public IParserBase
|
||||||
@ -176,8 +176,8 @@ protected:
|
|||||||
class ParserNull : public IParserBase
|
class ParserNull : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "NULL"; }
|
const char * getName() const override { return "NULL"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -186,8 +186,8 @@ protected:
|
|||||||
class ParserNumber : public IParserBase
|
class ParserNumber : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "number"; }
|
const char * getName() const override { return "number"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Unsigned integer, used in right hand side of tuple access operator (x.1).
|
/** Unsigned integer, used in right hand side of tuple access operator (x.1).
|
||||||
@ -195,8 +195,8 @@ protected:
|
|||||||
class ParserUnsignedInteger : public IParserBase
|
class ParserUnsignedInteger : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "unsigned integer"; }
|
const char * getName() const override { return "unsigned integer"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -205,8 +205,8 @@ protected:
|
|||||||
class ParserStringLiteral : public IParserBase
|
class ParserStringLiteral : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "string literal"; }
|
const char * getName() const override { return "string literal"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -219,8 +219,8 @@ protected:
|
|||||||
class ParserArrayOfLiterals : public IParserBase
|
class ParserArrayOfLiterals : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "array"; }
|
const char * getName() const override { return "array"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -229,8 +229,8 @@ protected:
|
|||||||
class ParserLiteral : public IParserBase
|
class ParserLiteral : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "literal"; }
|
const char * getName() const override { return "literal"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -246,8 +246,8 @@ private:
|
|||||||
|
|
||||||
bool allow_alias_without_as_keyword;
|
bool allow_alias_without_as_keyword;
|
||||||
|
|
||||||
const char * getName() const { return "alias"; }
|
const char * getName() const override { return "alias"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -257,8 +257,8 @@ private:
|
|||||||
class ParserSubstitution : public IParserBase
|
class ParserSubstitution : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "substitution"; }
|
const char * getName() const override { return "substitution"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -267,8 +267,8 @@ protected:
|
|||||||
class ParserExpressionElement : public IParserBase
|
class ParserExpressionElement : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "element of expression"; }
|
const char * getName() const override { return "element of expression"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -283,8 +283,8 @@ protected:
|
|||||||
ParserPtr elem_parser;
|
ParserPtr elem_parser;
|
||||||
bool allow_alias_without_as_keyword;
|
bool allow_alias_without_as_keyword;
|
||||||
|
|
||||||
const char * getName() const { return "element of expression with optional alias"; }
|
const char * getName() const override { return "element of expression with optional alias"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -296,8 +296,8 @@ protected:
|
|||||||
class ParserOrderByElement : public IParserBase
|
class ParserOrderByElement : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "element of ORDER BY expression"; }
|
const char * getName() const override { return "element of ORDER BY expression"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Parser for function with arguments like KEY VALUE (space separated)
|
/** Parser for function with arguments like KEY VALUE (space separated)
|
||||||
@ -316,8 +316,8 @@ protected:
|
|||||||
class ParserIdentifierWithOptionalParameters : public IParserBase
|
class ParserIdentifierWithOptionalParameters : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "identifier with optional parameters"; }
|
const char * getName() const override{ return "identifier with optional parameters"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Element of TTL expression - same as expression element, but in addition,
|
/** Element of TTL expression - same as expression element, but in addition,
|
||||||
@ -326,8 +326,8 @@ protected:
|
|||||||
class ParserTTLElement : public IParserBase
|
class ParserTTLElement : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "element of TTL expression"; }
|
const char * getName() const override { return "element of TTL expression"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,8 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "list of elements"; }
|
const char * getName() const override { return "list of elements"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
private:
|
private:
|
||||||
ParserPtr elem_parser;
|
ParserPtr elem_parser;
|
||||||
ParserPtr separator_parser;
|
ParserPtr separator_parser;
|
||||||
@ -63,9 +63,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "list, delimited by binary operators"; }
|
const char * getName() const override { return "list, delimited by binary operators"; }
|
||||||
|
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -86,9 +86,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "list, delimited by operator of variable arity"; }
|
const char * getName() const override { return "list, delimited by operator of variable arity"; }
|
||||||
|
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -110,8 +110,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "expression with prefix unary operator"; }
|
const char * getName() const override { return "expression with prefix unary operator"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -121,9 +121,9 @@ private:
|
|||||||
static const char * operators[];
|
static const char * operators[];
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "array element expression"; }
|
const char * getName() const override{ return "array element expression"; }
|
||||||
|
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -133,9 +133,9 @@ private:
|
|||||||
static const char * operators[];
|
static const char * operators[];
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "tuple element expression"; }
|
const char * getName() const override { return "tuple element expression"; }
|
||||||
|
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -146,9 +146,9 @@ private:
|
|||||||
ParserPrefixUnaryOperatorExpression operator_parser {operators, std::make_unique<ParserTupleElementExpression>()};
|
ParserPrefixUnaryOperatorExpression operator_parser {operators, std::make_unique<ParserTupleElementExpression>()};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "unary minus expression"; }
|
const char * getName() const override { return "unary minus expression"; }
|
||||||
|
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -159,9 +159,9 @@ private:
|
|||||||
ParserLeftAssociativeBinaryOperatorList operator_parser {operators, std::make_unique<ParserUnaryMinusExpression>()};
|
ParserLeftAssociativeBinaryOperatorList operator_parser {operators, std::make_unique<ParserUnaryMinusExpression>()};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "multiplicative expression"; }
|
const char * getName() const override{ return "multiplicative expression"; }
|
||||||
|
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override
|
||||||
{
|
{
|
||||||
return operator_parser.parse(pos, node, expected);
|
return operator_parser.parse(pos, node, expected);
|
||||||
}
|
}
|
||||||
@ -174,8 +174,8 @@ class ParserIntervalOperatorExpression : public IParserBase
|
|||||||
protected:
|
protected:
|
||||||
ParserMultiplicativeExpression next_parser;
|
ParserMultiplicativeExpression next_parser;
|
||||||
|
|
||||||
const char * getName() const { return "INTERVAL operator expression"; }
|
const char * getName() const override{ return "INTERVAL operator expression"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -186,9 +186,9 @@ private:
|
|||||||
ParserLeftAssociativeBinaryOperatorList operator_parser {operators, std::make_unique<ParserIntervalOperatorExpression>()};
|
ParserLeftAssociativeBinaryOperatorList operator_parser {operators, std::make_unique<ParserIntervalOperatorExpression>()};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "additive expression"; }
|
const char * getName() const override{ return "additive expression"; }
|
||||||
|
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override
|
||||||
{
|
{
|
||||||
return operator_parser.parse(pos, node, expected);
|
return operator_parser.parse(pos, node, expected);
|
||||||
}
|
}
|
||||||
@ -200,9 +200,9 @@ class ParserConcatExpression : public IParserBase
|
|||||||
ParserVariableArityOperatorList operator_parser {"||", "concat", std::make_unique<ParserAdditiveExpression>()};
|
ParserVariableArityOperatorList operator_parser {"||", "concat", std::make_unique<ParserAdditiveExpression>()};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "string concatenation expression"; }
|
const char * getName() const override { return "string concatenation expression"; }
|
||||||
|
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override
|
||||||
{
|
{
|
||||||
return operator_parser.parse(pos, node, expected);
|
return operator_parser.parse(pos, node, expected);
|
||||||
}
|
}
|
||||||
@ -215,9 +215,9 @@ private:
|
|||||||
ParserConcatExpression elem_parser;
|
ParserConcatExpression elem_parser;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "BETWEEN expression"; }
|
const char * getName() const override { return "BETWEEN expression"; }
|
||||||
|
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -228,9 +228,9 @@ private:
|
|||||||
ParserLeftAssociativeBinaryOperatorList operator_parser {operators, std::make_unique<ParserBetweenExpression>()};
|
ParserLeftAssociativeBinaryOperatorList operator_parser {operators, std::make_unique<ParserBetweenExpression>()};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "comparison expression"; }
|
const char * getName() const override{ return "comparison expression"; }
|
||||||
|
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override
|
||||||
{
|
{
|
||||||
return operator_parser.parse(pos, node, expected);
|
return operator_parser.parse(pos, node, expected);
|
||||||
}
|
}
|
||||||
@ -257,9 +257,9 @@ private:
|
|||||||
ParserPrefixUnaryOperatorExpression operator_parser {operators, std::make_unique<ParserNullityChecking>()};
|
ParserPrefixUnaryOperatorExpression operator_parser {operators, std::make_unique<ParserNullityChecking>()};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "logical-NOT expression"; }
|
const char * getName() const override{ return "logical-NOT expression"; }
|
||||||
|
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override
|
||||||
{
|
{
|
||||||
return operator_parser.parse(pos, node, expected);
|
return operator_parser.parse(pos, node, expected);
|
||||||
}
|
}
|
||||||
@ -272,9 +272,9 @@ private:
|
|||||||
ParserVariableArityOperatorList operator_parser {"AND", "and", std::make_unique<ParserLogicalNotExpression>()};
|
ParserVariableArityOperatorList operator_parser {"AND", "and", std::make_unique<ParserLogicalNotExpression>()};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "logical-AND expression"; }
|
const char * getName() const override { return "logical-AND expression"; }
|
||||||
|
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override
|
||||||
{
|
{
|
||||||
return operator_parser.parse(pos, node, expected);
|
return operator_parser.parse(pos, node, expected);
|
||||||
}
|
}
|
||||||
@ -287,9 +287,9 @@ private:
|
|||||||
ParserVariableArityOperatorList operator_parser {"OR", "or", std::make_unique<ParserLogicalAndExpression>()};
|
ParserVariableArityOperatorList operator_parser {"OR", "or", std::make_unique<ParserLogicalAndExpression>()};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "logical-OR expression"; }
|
const char * getName() const override { return "logical-OR expression"; }
|
||||||
|
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override
|
||||||
{
|
{
|
||||||
return operator_parser.parse(pos, node, expected);
|
return operator_parser.parse(pos, node, expected);
|
||||||
}
|
}
|
||||||
@ -305,9 +305,9 @@ private:
|
|||||||
ParserLogicalOrExpression elem_parser;
|
ParserLogicalOrExpression elem_parser;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "expression with ternary operator"; }
|
const char * getName() const override { return "expression with ternary operator"; }
|
||||||
|
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -317,9 +317,9 @@ private:
|
|||||||
ParserTernaryOperatorExpression elem_parser;
|
ParserTernaryOperatorExpression elem_parser;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "lambda expression"; }
|
const char * getName() const override { return "lambda expression"; }
|
||||||
|
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -333,9 +333,9 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
ParserPtr impl;
|
ParserPtr impl;
|
||||||
|
|
||||||
const char * getName() const { return "expression with optional alias"; }
|
const char * getName() const override { return "expression with optional alias"; }
|
||||||
|
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override
|
||||||
{
|
{
|
||||||
return impl->parse(pos, node, expected);
|
return impl->parse(pos, node, expected);
|
||||||
}
|
}
|
||||||
@ -352,8 +352,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
bool allow_alias_without_as_keyword;
|
bool allow_alias_without_as_keyword;
|
||||||
|
|
||||||
const char * getName() const { return "list of expressions"; }
|
const char * getName() const override { return "list of expressions"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -365,16 +365,16 @@ public:
|
|||||||
private:
|
private:
|
||||||
ParserExpressionList nested_parser;
|
ParserExpressionList nested_parser;
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "not empty list of expressions"; }
|
const char * getName() const override { return "not empty list of expressions"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class ParserOrderByExpressionList : public IParserBase
|
class ParserOrderByExpressionList : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "order by expression"; }
|
const char * getName() const override { return "order by expression"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -399,8 +399,8 @@ protected:
|
|||||||
class ParserTTLExpressionList : public IParserBase
|
class ParserTTLExpressionList : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "ttl expression"; }
|
const char * getName() const override { return "ttl expression"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool parse(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parse(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) = 0;
|
virtual bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) = 0;
|
||||||
|
@ -27,16 +27,16 @@ namespace DB
|
|||||||
class ParserAlterQuery : public IParserBase
|
class ParserAlterQuery : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "ALTER query"; }
|
const char * getName() const override{ return "ALTER query"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class ParserAlterCommandList : public IParserBase
|
class ParserAlterCommandList : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "a list of ALTER commands"; }
|
const char * getName() const override{ return "a list of ALTER commands"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool is_live_view;
|
bool is_live_view;
|
||||||
@ -48,8 +48,8 @@ public:
|
|||||||
class ParserAlterCommand : public IParserBase
|
class ParserAlterCommand : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "ALTER command"; }
|
const char * getName() const override{ return "ALTER command"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool is_live_view;
|
bool is_live_view;
|
||||||
@ -62,8 +62,8 @@ public:
|
|||||||
class ParserAssignment : public IParserBase
|
class ParserAssignment : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "column assignment"; }
|
const char * getName() const override{ return "column assignment"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,8 @@ namespace DB
|
|||||||
class ParserCheckQuery : public IParserBase
|
class ParserCheckQuery : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "ALTER query"; }
|
const char * getName() const override{ return "ALTER query"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@ namespace DB
|
|||||||
class ParserNestedTable : public IParserBase
|
class ParserNestedTable : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "nested table"; }
|
const char * getName() const override { return "nested table"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -33,16 +33,16 @@ protected:
|
|||||||
class ParserIdentifierWithParameters : public IParserBase
|
class ParserIdentifierWithParameters : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "identifier with parameters"; }
|
const char * getName() const override { return "identifier with parameters"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename NameParser>
|
template <typename NameParser>
|
||||||
class IParserNameTypePair : public IParserBase
|
class IParserNameTypePair : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "name and type pair"; }
|
const char * getName() const override{ return "name and type pair"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** The name and type are separated by a space. For example, URL String. */
|
/** The name and type are separated by a space. For example, URL String. */
|
||||||
@ -75,16 +75,16 @@ bool IParserNameTypePair<NameParser>::parseImpl(Pos & pos, ASTPtr & node, Expect
|
|||||||
class ParserNameTypePairList : public IParserBase
|
class ParserNameTypePairList : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "name and type pair list"; }
|
const char * getName() const override { return "name and type pair list"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** List of table names. */
|
/** List of table names. */
|
||||||
class ParserNameList : public IParserBase
|
class ParserNameList : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "name list"; }
|
const char * getName() const override { return "name list"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -99,9 +99,9 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
using ASTDeclarePtr = std::shared_ptr<ASTColumnDeclaration>;
|
using ASTDeclarePtr = std::shared_ptr<ASTColumnDeclaration>;
|
||||||
|
|
||||||
const char * getName() const { return "column declaration"; }
|
const char * getName() const override{ return "column declaration"; }
|
||||||
|
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
|
|
||||||
bool require_type = true;
|
bool require_type = true;
|
||||||
};
|
};
|
||||||
@ -224,8 +224,8 @@ bool IParserColumnDeclaration<NameParser>::parseImpl(Pos & pos, ASTPtr & node, E
|
|||||||
class ParserColumnDeclarationList : public IParserBase
|
class ParserColumnDeclarationList : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "column declaration list"; }
|
const char * getName() const override { return "column declaration list"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -284,8 +284,8 @@ protected:
|
|||||||
class ParserStorage : public IParserBase
|
class ParserStorage : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "storage definition"; }
|
const char * getName() const override { return "storage definition"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Query like this:
|
/** Query like this:
|
||||||
@ -308,32 +308,32 @@ protected:
|
|||||||
class ParserCreateTableQuery : public IParserBase
|
class ParserCreateTableQuery : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "CREATE TABLE or ATTACH TABLE query"; }
|
const char * getName() const override { return "CREATE TABLE or ATTACH TABLE query"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// CREATE|ATTACH LIVE VIEW [IF NOT EXISTS] [db.]name [TO [db.]name] AS SELECT ...
|
/// CREATE|ATTACH LIVE VIEW [IF NOT EXISTS] [db.]name [TO [db.]name] AS SELECT ...
|
||||||
class ParserCreateLiveViewQuery : public IParserBase
|
class ParserCreateLiveViewQuery : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "CREATE LIVE VIEW query"; }
|
const char * getName() const override { return "CREATE LIVE VIEW query"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// CREATE|ATTACH DATABASE db [ENGINE = engine]
|
/// CREATE|ATTACH DATABASE db [ENGINE = engine]
|
||||||
class ParserCreateDatabaseQuery : public IParserBase
|
class ParserCreateDatabaseQuery : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "CREATE DATABASE query"; }
|
const char * getName() const override { return "CREATE DATABASE query"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// CREATE[OR REPLACE]|ATTACH [[MATERIALIZED] VIEW] | [VIEW]] [IF NOT EXISTS] [db.]name [TO [db.]name] [ENGINE = engine] [POPULATE] AS SELECT ...
|
/// CREATE[OR REPLACE]|ATTACH [[MATERIALIZED] VIEW] | [VIEW]] [IF NOT EXISTS] [db.]name [TO [db.]name] [ENGINE = engine] [POPULATE] AS SELECT ...
|
||||||
class ParserCreateViewQuery : public IParserBase
|
class ParserCreateViewQuery : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "CREATE VIEW query"; }
|
const char * getName() const override { return "CREATE VIEW query"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Parses complete dictionary create query. Uses ParserDictionary and
|
/// Parses complete dictionary create query. Uses ParserDictionary and
|
||||||
@ -372,8 +372,8 @@ protected:
|
|||||||
class ParserCreateQuery : public IParserBase
|
class ParserCreateQuery : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "CREATE TABLE or ATTACH TABLE query"; }
|
const char * getName() const override { return "CREATE TABLE or ATTACH TABLE query"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,8 @@ namespace DB
|
|||||||
class ParserDescribeTableQuery : public IParserBase
|
class ParserDescribeTableQuery : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "DESCRIBE query"; }
|
const char * getName() const override { return "DESCRIBE query"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,8 @@ protected:
|
|||||||
class ParserDictionaryAttributeDeclarationList : public IParserBase
|
class ParserDictionaryAttributeDeclarationList : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "attribute declaration list"; }
|
const char * getName() const override{ return "attribute declaration list"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@ namespace DB
|
|||||||
class ParserDropQuery : public IParserBase
|
class ParserDropQuery : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "DROP query"; }
|
const char * getName() const override{ return "DROP query"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
|
|
||||||
bool parseDropQuery(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseDropQuery(Pos & pos, ASTPtr & node, Expected & expected);
|
||||||
bool parseDetachQuery(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseDetachQuery(Pos & pos, ASTPtr & node, Expected & expected);
|
||||||
|
@ -12,8 +12,8 @@ namespace DB
|
|||||||
class ParserOptimizeQuery : public IParserBase
|
class ParserOptimizeQuery : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "OPTIMIZE query"; }
|
const char * getName() const override { return "OPTIMIZE query"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,8 @@ namespace DB
|
|||||||
class ParserRenameQuery : public IParserBase
|
class ParserRenameQuery : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "RENAME query"; }
|
const char * getName() const override{ return "RENAME query"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,8 @@ namespace DB
|
|||||||
class ParserRoleList : public IParserBase
|
class ParserRoleList : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "RoleList"; }
|
const char * getName() const override { return "RoleList"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@ namespace DB
|
|||||||
class ParserSampleRatio : public IParserBase
|
class ParserSampleRatio : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "Sample ratio or offset"; }
|
const char * getName() const override { return "Sample ratio or offset"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,9 @@ namespace DB
|
|||||||
class ParserShowProcesslistQuery : public IParserBase
|
class ParserShowProcesslistQuery : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "SHOW PROCESSLIST query"; }
|
const char * getName() const override { return "SHOW PROCESSLIST query"; }
|
||||||
|
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override
|
||||||
{
|
{
|
||||||
auto query = std::make_shared<ASTShowProcesslistQuery>();
|
auto query = std::make_shared<ASTShowProcesslistQuery>();
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ namespace DB
|
|||||||
class ParserShowTablesQuery : public IParserBase
|
class ParserShowTablesQuery : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "SHOW [TEMPORARY] TABLES|DATABASES [[NOT] LIKE 'str'] [LIMIT expr]"; }
|
const char * getName() const override { return "SHOW [TEMPORARY] TABLES|DATABASES [[NOT] LIKE 'str'] [LIMIT expr]"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,8 @@ namespace DB
|
|||||||
class ParserTablesInSelectQuery : public IParserBase
|
class ParserTablesInSelectQuery : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "table, table function, subquery or list of joined tables"; }
|
const char * getName() const override { return "table, table function, subquery or list of joined tables"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -22,8 +22,8 @@ public:
|
|||||||
ParserTablesInSelectQueryElement(bool is_first_) : is_first(is_first_) {}
|
ParserTablesInSelectQueryElement(bool is_first_) : is_first(is_first_) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "table, table function, subquery or list of joined tables"; }
|
const char * getName() const override { return "table, table function, subquery or list of joined tables"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool is_first;
|
bool is_first;
|
||||||
@ -33,16 +33,16 @@ private:
|
|||||||
class ParserTableExpression : public IParserBase
|
class ParserTableExpression : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "table or subquery or table function"; }
|
const char * getName() const override { return "table or subquery or table function"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class ParserArrayJoin : public IParserBase
|
class ParserArrayJoin : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "array join"; }
|
const char * getName() const override { return "array join"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ namespace DB
|
|||||||
class ParserUseQuery : public IParserBase
|
class ParserUseQuery : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "USE query"; }
|
const char * getName() const override{ return "USE query"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,8 @@ namespace DB
|
|||||||
class ParserWatchQuery : public IParserBase
|
class ParserWatchQuery : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
const char * getName() const { return "WATCH query"; }
|
const char * getName() const override { return "WATCH query"; }
|
||||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected);
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
class KillingErrorHandler : public Poco::ErrorHandler
|
class KillingErrorHandler : public Poco::ErrorHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void exception(const Poco::Exception &) { std::terminate(); }
|
void exception(const Poco::Exception &) override { std::terminate(); }
|
||||||
void exception(const std::exception &) { std::terminate(); }
|
void exception(const std::exception &) override { std::terminate(); }
|
||||||
void exception() { std::terminate(); }
|
void exception() override { std::terminate(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -23,9 +23,9 @@ public:
|
|||||||
class ServerErrorHandler : public Poco::ErrorHandler
|
class ServerErrorHandler : public Poco::ErrorHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void exception(const Poco::Exception &) { logException(); }
|
void exception(const Poco::Exception &) override { logException(); }
|
||||||
void exception(const std::exception &) { logException(); }
|
void exception(const std::exception &) override { logException(); }
|
||||||
void exception() { logException(); }
|
void exception() override { logException(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Logger * log = &Logger::get("ServerErrorHandler");
|
Logger * log = &Logger::get("ServerErrorHandler");
|
||||||
|
@ -1,49 +1,46 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <mysqlxx/Types.h>
|
|
||||||
#include <Poco/Exception.h>
|
#include <Poco/Exception.h>
|
||||||
|
#include <mysqlxx/Types.h>
|
||||||
|
|
||||||
|
|
||||||
namespace mysqlxx
|
namespace mysqlxx
|
||||||
{
|
{
|
||||||
|
/// Common exception class for MySQL library. Functions code() and errnum() return error numbers from MySQL, for details see mysqld_error.h
|
||||||
/** Общий класс исключений, которые могут быть выкинуты функциями из библиотеки.
|
|
||||||
* Функции code() и errnum() возвращают номер ошибки MySQL. (см. mysqld_error.h)
|
|
||||||
*/
|
|
||||||
struct Exception : public Poco::Exception
|
struct Exception : public Poco::Exception
|
||||||
{
|
{
|
||||||
Exception(const std::string & msg, int code = 0) : Poco::Exception(msg, code) {}
|
Exception(const std::string & msg, int code = 0) : Poco::Exception(msg, code) {}
|
||||||
int errnum() const { return code(); }
|
int errnum() const { return code(); }
|
||||||
const char * name() const throw() { return "mysqlxx::Exception"; }
|
const char * name() const throw() override { return "mysqlxx::Exception"; }
|
||||||
const char * className() const throw() { return "mysqlxx::Exception"; }
|
const char * className() const throw() override { return "mysqlxx::Exception"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/// Не удалось соединиться с сервером.
|
/// Cannot connect to MySQL server
|
||||||
struct ConnectionFailed : public Exception
|
struct ConnectionFailed : public Exception
|
||||||
{
|
{
|
||||||
ConnectionFailed(const std::string & msg, int code = 0) : Exception(msg, code) {}
|
ConnectionFailed(const std::string & msg, int code = 0) : Exception(msg, code) {}
|
||||||
const char * name() const throw() { return "mysqlxx::ConnectionFailed"; }
|
const char * name() const throw() override { return "mysqlxx::ConnectionFailed"; }
|
||||||
const char * className() const throw() { return "mysqlxx::ConnectionFailed"; }
|
const char * className() const throw() override { return "mysqlxx::ConnectionFailed"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/// Запрос содержит ошибку.
|
/// Erroneous query.
|
||||||
struct BadQuery : public Exception
|
struct BadQuery : public Exception
|
||||||
{
|
{
|
||||||
BadQuery(const std::string & msg, int code = 0) : Exception(msg, code) {}
|
BadQuery(const std::string & msg, int code = 0) : Exception(msg, code) {}
|
||||||
const char * name() const throw() { return "mysqlxx::BadQuery"; }
|
const char * name() const throw() override { return "mysqlxx::BadQuery"; }
|
||||||
const char * className() const throw() { return "mysqlxx::BadQuery"; }
|
const char * className() const throw() override { return "mysqlxx::BadQuery"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/// Невозможно распарсить значение.
|
/// Value parsing failure
|
||||||
struct CannotParseValue : public Exception
|
struct CannotParseValue : public Exception
|
||||||
{
|
{
|
||||||
CannotParseValue(const std::string & msg, int code = 0) : Exception(msg, code) {}
|
CannotParseValue(const std::string & msg, int code = 0) : Exception(msg, code) {}
|
||||||
const char * name() const throw() { return "mysqlxx::CannotParseValue"; }
|
const char * name() const throw() override { return "mysqlxx::CannotParseValue"; }
|
||||||
const char * className() const throw() { return "mysqlxx::CannotParseValue"; }
|
const char * className() const throw() override { return "mysqlxx::CannotParseValue"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user