mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Merge pull request #25972 from kssenii/mysql-protocol-fix
mysql protocol: fix sql_select_limit
This commit is contained in:
commit
eca877ff39
@ -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