Skip to content

Commit

Permalink
parse with connection clause
Browse files Browse the repository at this point in the history
  • Loading branch information
kitta65 committed Nov 24, 2024
1 parent 6b9bee6 commit 8936d0e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2051,7 +2051,10 @@ impl Parser {
default.push_node("next_keyword", collate);
create.push_node("default_collate", default);
}
// TODO with connection
if self.get_token(1)?.is("WITH") && self.get_token(2)?.is("CONNECTION") {
self.next_token()?; // -> WITH
create.push_node("with_connection", self.parse_with_connection_clause()?);
}
if self.get_token(1)?.is("OPTIONS") {
self.next_token()?; // OPTIONS
create.push_node("options", self.parse_keyword_with_grouped_exprs(false)?);
Expand Down
7 changes: 7 additions & 0 deletions src/parser/tests/tests_ddl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ what:
Box::new(SuccessTestCase::new(
"\
CREATE EXTERNAL SCHEMA dataset_name
WITH CONNECTION connection_name
",
"\
self: CREATE (CreateSchemaStatement)
Expand All @@ -86,6 +87,12 @@ ident:
self: dataset_name (Identifier)
what:
self: SCHEMA (Keyword)
with_connection:
self: WITH (KeywordSequence)
next_keyword:
self: CONNECTION (KeywordWithExpr)
expr:
self: connection_name (Identifier)
",
0,
)),
Expand Down
2 changes: 2 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,10 +649,12 @@ export type CreateRowAccessPolicyStatement = XXXStatement & {
export type CreateSchemaStatement = XXXStatement & {
node_type: "CreateSchemaStatement";
children: {
external?: NodeChild;
what: NodeChild;
if_not_exists?: NodeVecChild;
ident: NodeChild;
default_collate: NodeChild;
with_connection?: NodeChild;
options?: NodeChild;
};
};
Expand Down

0 comments on commit 8936d0e

Please sign in to comment.