@@ -34,6 +34,39 @@ ASTPtr ASTDeclareColumn::clone() const
34
34
return res;
35
35
}
36
36
37
+ static inline bool parseColumnDeclareOptions (IParser::Pos & pos, ASTPtr & node, Expected & expected)
38
+ {
39
+ ParserDeclareOptions p_non_generate_options{
40
+ {
41
+ OptionDescribe (" ZEROFILL" , " zero_fill" , std::make_unique<ParserAlwaysTrue>()),
42
+ OptionDescribe (" SIGNED" , " is_unsigned" , std::make_unique<ParserAlwaysFalse>()),
43
+ OptionDescribe (" UNSIGNED" , " is_unsigned" , std::make_unique<ParserAlwaysTrue>()),
44
+ OptionDescribe (" NULL" , " is_null" , std::make_unique<ParserAlwaysTrue>()),
45
+ OptionDescribe (" NOT NULL" , " is_null" , std::make_unique<ParserAlwaysFalse>()),
46
+ OptionDescribe (" DEFAULT" , " default" , std::make_unique<ParserExpression>()),
47
+ OptionDescribe (" ON UPDATE" , " on_update" , std::make_unique<ParserExpression>()),
48
+ OptionDescribe (" AUTO_INCREMENT" , " auto_increment" , std::make_unique<ParserAlwaysTrue>()),
49
+ OptionDescribe (" UNIQUE" , " unique_key" , std::make_unique<ParserAlwaysTrue>()),
50
+ OptionDescribe (" UNIQUE KEY" , " unique_key" , std::make_unique<ParserAlwaysTrue>()),
51
+ OptionDescribe (" KEY" , " primary_key" , std::make_unique<ParserAlwaysTrue>()),
52
+ OptionDescribe (" PRIMARY KEY" , " primary_key" , std::make_unique<ParserAlwaysTrue>()),
53
+ OptionDescribe (" COMMENT" , " comment" , std::make_unique<ParserStringLiteral>()),
54
+ OptionDescribe (" CHARACTER SET" , " charset_name" , std::make_unique<ParserCharsetName>()),
55
+ OptionDescribe (" COLLATE" , " collate" , std::make_unique<ParserCharsetName>()),
56
+ OptionDescribe (" COLUMN_FORMAT" , " column_format" , std::make_unique<ParserIdentifier>()),
57
+ OptionDescribe (" STORAGE" , " storage" , std::make_unique<ParserIdentifier>()),
58
+ OptionDescribe (" AS" , " generated" , std::make_unique<ParserExpression>()),
59
+ OptionDescribe (" GENERATED ALWAYS AS" , " generated" , std::make_unique<ParserExpression>()),
60
+ OptionDescribe (" STORED" , " is_stored" , std::make_unique<ParserAlwaysTrue>()),
61
+ OptionDescribe (" VIRTUAL" , " is_stored" , std::make_unique<ParserAlwaysFalse>()),
62
+ OptionDescribe (" " , " reference" , std::make_unique<ParserDeclareReference>()),
63
+ OptionDescribe (" " , " constraint" , std::make_unique<ParserDeclareConstraint>()),
64
+ }
65
+ };
66
+
67
+ return p_non_generate_options.parse (pos, node, expected);
68
+ }
69
+
37
70
bool ParserDeclareColumn::parseImpl (Pos & pos, ASTPtr & node, Expected & expected)
38
71
{
39
72
ASTPtr column_name;
@@ -65,37 +98,6 @@ bool ParserDeclareColumn::parseImpl(Pos & pos, ASTPtr & node, Expected & expecte
65
98
node = declare_column;
66
99
return true ;
67
100
}
68
- bool ParserDeclareColumn::parseColumnDeclareOptions (IParser::Pos & pos, ASTPtr & node, Expected & expected)
69
- {
70
- ParserDeclareOptions p_non_generate_options{
71
- {
72
- OptionDescribe (" ZEROFILL" , " zero_fill" , std::make_unique<ParserAlwaysTrue>()),
73
- OptionDescribe (" SIGNED" , " is_unsigned" , std::make_unique<ParserAlwaysFalse>()),
74
- OptionDescribe (" UNSIGNED" , " is_unsigned" , std::make_unique<ParserAlwaysTrue>()),
75
- OptionDescribe (" NULL" , " is_null" , std::make_unique<ParserAlwaysTrue>()),
76
- OptionDescribe (" NOT NULL" , " is_null" , std::make_unique<ParserAlwaysFalse>()),
77
- OptionDescribe (" DEFAULT" , " default" , std::make_unique<ParserExpression>()),
78
- OptionDescribe (" AUTO_INCREMENT" , " auto_increment" , std::make_unique<ParserAlwaysTrue>()),
79
- OptionDescribe (" UNIQUE" , " unique_key" , std::make_unique<ParserAlwaysTrue>()),
80
- OptionDescribe (" UNIQUE KEY" , " unique_key" , std::make_unique<ParserAlwaysTrue>()),
81
- OptionDescribe (" KEY" , " primary_key" , std::make_unique<ParserAlwaysTrue>()),
82
- OptionDescribe (" PRIMARY KEY" , " primary_key" , std::make_unique<ParserAlwaysTrue>()),
83
- OptionDescribe (" COMMENT" , " comment" , std::make_unique<ParserStringLiteral>()),
84
- OptionDescribe (" CHARACTER SET" , " charset_name" , std::make_unique<ParserCharsetName>()),
85
- OptionDescribe (" COLLATE" , " collate" , std::make_unique<ParserCharsetName>()),
86
- OptionDescribe (" COLUMN_FORMAT" , " column_format" , std::make_unique<ParserIdentifier>()),
87
- OptionDescribe (" STORAGE" , " storage" , std::make_unique<ParserIdentifier>()),
88
- OptionDescribe (" AS" , " generated" , std::make_unique<ParserExpression>()),
89
- OptionDescribe (" GENERATED ALWAYS AS" , " generated" , std::make_unique<ParserExpression>()),
90
- OptionDescribe (" STORED" , " is_stored" , std::make_unique<ParserAlwaysTrue>()),
91
- OptionDescribe (" VIRTUAL" , " is_stored" , std::make_unique<ParserAlwaysFalse>()),
92
- OptionDescribe (" " , " reference" , std::make_unique<ParserDeclareReference>()),
93
- OptionDescribe (" " , " constraint" , std::make_unique<ParserDeclareConstraint>()),
94
- }
95
- };
96
-
97
- return p_non_generate_options.parse (pos, node, expected);
98
- }
99
101
100
102
}
101
103
0 commit comments