| 1 | #pragma once | 
|---|
| 2 |  | 
|---|
| 3 | #include <Parsers/IParserBase.h> | 
|---|
| 4 |  | 
|---|
| 5 | namespace DB | 
|---|
| 6 | { | 
|---|
| 7 |  | 
|---|
| 8 | /** CASE construction | 
|---|
| 9 | * Two variants: | 
|---|
| 10 | * 1. CASE expr WHEN val1 THEN res1 [WHEN ...] ELSE resN END | 
|---|
| 11 | * 2. CASE WHEN cond1 THEN res1 [WHEN ...] ELSE resN END | 
|---|
| 12 | * NOTE Until we get full support for NULL values in ClickHouse, ELSE sections are mandatory. | 
|---|
| 13 | */ | 
|---|
| 14 | class ParserCase final : public IParserBase | 
|---|
| 15 | { | 
|---|
| 16 | protected: | 
|---|
| 17 | const char * getName() const override { return "case"; } | 
|---|
| 18 | bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override; | 
|---|
| 19 | }; | 
|---|
| 20 |  | 
|---|
| 21 | } | 
|---|
| 22 |  | 
|---|