2019-12-01 22:01:05 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Parsers/IParserBase.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
/** Parses queries like
|
|
|
|
* CREATE QUOTA [IF NOT EXISTS | OR REPLACE] name
|
2020-12-02 19:20:47 +00:00
|
|
|
* [KEYED BY {none | user_name | ip_address | forwarded_ip_address | client_key | client_key, user_name | client_key, ip_address} | NOT KEYED]
|
2020-08-08 08:19:48 +00:00
|
|
|
* [FOR [RANDOMIZED] INTERVAL number {second | minute | hour | day | week | month | quarter | year}
|
2020-06-05 17:57:33 +00:00
|
|
|
* {MAX {{queries | errors | result_rows | result_bytes | read_rows | read_bytes | execution_time} = number} [,...] |
|
2020-04-08 03:09:40 +00:00
|
|
|
* NO LIMITS | TRACKING ONLY} [,...]]
|
2019-12-01 22:01:05 +00:00
|
|
|
* [TO {role [,...] | ALL | ALL EXCEPT role [,...]}]
|
|
|
|
*
|
|
|
|
* ALTER QUOTA [IF EXISTS] name
|
|
|
|
* [RENAME TO new_name]
|
2020-12-02 19:20:47 +00:00
|
|
|
* [KEYED BY {none | user_name | ip_address | forwarded_ip_address | client_key | client_key, user_name | client_key, ip_address} | NOT KEYED]
|
2020-08-08 08:19:48 +00:00
|
|
|
* [FOR [RANDOMIZED] INTERVAL number {second | minute | hour | day | week | month | quarter | year}
|
2020-06-05 17:57:33 +00:00
|
|
|
* {MAX {{queries | errors | result_rows | result_bytes | read_rows | read_bytes | execution_time} = number} [,...] |
|
2020-04-08 03:09:40 +00:00
|
|
|
* NO LIMITS | TRACKING ONLY} [,...]]
|
2019-12-01 22:01:05 +00:00
|
|
|
* [TO {role [,...] | ALL | ALL EXCEPT role [,...]}]
|
|
|
|
*/
|
|
|
|
class ParserCreateQuotaQuery : public IParserBase
|
|
|
|
{
|
2020-02-21 19:27:12 +00:00
|
|
|
public:
|
2020-05-30 20:10:45 +00:00
|
|
|
void useAttachMode(bool attach_mode_ = true) { attach_mode = attach_mode_; }
|
2020-02-21 19:27:12 +00:00
|
|
|
|
2019-12-01 22:01:05 +00:00
|
|
|
protected:
|
|
|
|
const char * getName() const override { return "CREATE QUOTA or ALTER QUOTA query"; }
|
|
|
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
2020-02-21 19:27:12 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool attach_mode = false;
|
2019-12-01 22:01:05 +00:00
|
|
|
};
|
|
|
|
}
|