mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 13:02:00 +00:00
Fix set SQL_SELECT_LIMIT
This commit is contained in:
parent
e80a700cff
commit
0dda5b67c4
@ -66,6 +66,7 @@ static const size_t SSL_REQUEST_PAYLOAD_SIZE = 32;
|
||||
static String selectEmptyReplacementQuery(const String & query);
|
||||
static String showTableStatusReplacementQuery(const String & query);
|
||||
static String killConnectionIdReplacementQuery(const String & query);
|
||||
static String selectLimitReplacementQuery(const String & query);
|
||||
|
||||
MySQLHandler::MySQLHandler(IServer & server_, const Poco::Net::StreamSocket & socket_,
|
||||
bool ssl_enabled, size_t connection_id_)
|
||||
@ -83,6 +84,7 @@ MySQLHandler::MySQLHandler(IServer & server_, const Poco::Net::StreamSocket & so
|
||||
replacements.emplace("KILL QUERY", killConnectionIdReplacementQuery);
|
||||
replacements.emplace("SHOW TABLE STATUS LIKE", showTableStatusReplacementQuery);
|
||||
replacements.emplace("SHOW VARIABLES", selectEmptyReplacementQuery);
|
||||
replacements.emplace("SET SQL_SELECT_LIMIT", selectLimitReplacementQuery);
|
||||
}
|
||||
|
||||
void MySQLHandler::run()
|
||||
@ -461,6 +463,14 @@ static String showTableStatusReplacementQuery(const String & query)
|
||||
return query;
|
||||
}
|
||||
|
||||
static String selectLimitReplacementQuery(const String & query)
|
||||
{
|
||||
const String prefix = "SET SQL_SELECT_LIMIT";
|
||||
if (query.starts_with(prefix))
|
||||
return "SET limit" + std::string(query.data() + prefix.length());
|
||||
return query;
|
||||
}
|
||||
|
||||
/// Replace "KILL QUERY [connection_id]" into "KILL QUERY WHERE query_id = 'mysql:[connection_id]'".
|
||||
static String killConnectionIdReplacementQuery(const String & query)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user