| 1 | #pragma once |
| 2 | |
| 3 | #include <Parsers/IParserBase.h> |
| 4 | |
| 5 | |
| 6 | namespace DB |
| 7 | { |
| 8 | |
| 9 | |
| 10 | /** Cases: |
| 11 | * |
| 12 | * Normal case: |
| 13 | * INSERT INTO [db.]table (c1, c2, c3) VALUES (v11, v12, v13), (v21, v22, v23), ... |
| 14 | * INSERT INTO [db.]table VALUES (v11, v12, v13), (v21, v22, v23), ... |
| 15 | * |
| 16 | * Insert of data in an arbitrary format. |
| 17 | * The data itself comes after LF(line feed), if it exists, or after all the whitespace characters, otherwise. |
| 18 | * INSERT INTO [db.]table (c1, c2, c3) FORMAT format \n ... |
| 19 | * INSERT INTO [db.]table FORMAT format \n ... |
| 20 | * |
| 21 | * Insert the result of the SELECT query. |
| 22 | * INSERT INTO [db.]table (c1, c2, c3) SELECT ... |
| 23 | * INSERT INTO [db.]table SELECT ... |
| 24 | */ |
| 25 | class ParserInsertQuery : public IParserBase |
| 26 | { |
| 27 | private: |
| 28 | const char * end; |
| 29 | |
| 30 | const char * getName() const override { return "INSERT query" ; } |
| 31 | bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override; |
| 32 | public: |
| 33 | ParserInsertQuery(const char * end_) : end(end_) {} |
| 34 | }; |
| 35 | |
| 36 | } |
| 37 | |