Skip to content

Commit 29e8add

Browse files
authored
Add support for more DROP statements and enable 2 more tests (#13)
1 parent 73aa6f6 commit 29e8add

964 files changed

Lines changed: 2180 additions & 1006 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ast/backup_statement.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,16 @@ type BackupOption struct {
1616
OptionKind string // Compression, NoCompression, StopOnError, ContinueAfterError, etc.
1717
Value ScalarExpression
1818
}
19+
20+
// BackupCertificateStatement represents a BACKUP CERTIFICATE statement
21+
type BackupCertificateStatement struct {
22+
Name *Identifier
23+
File ScalarExpression
24+
PrivateKeyPath ScalarExpression
25+
EncryptionPassword ScalarExpression
26+
DecryptionPassword ScalarExpression
27+
ActiveForBeginDialog string // "NotSet", "Active", "Inactive"
28+
}
29+
30+
func (s *BackupCertificateStatement) statement() {}
31+
func (s *BackupCertificateStatement) node() {}

ast/create_simple_statements.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,20 @@ type CreateFulltextIndexStatement struct {
120120
func (s *CreateFulltextIndexStatement) node() {}
121121
func (s *CreateFulltextIndexStatement) statement() {}
122122

123+
// PartitionParameterType represents the parameter type in a partition function.
124+
type PartitionParameterType struct {
125+
DataType *SqlDataTypeReference `json:"DataType,omitempty"`
126+
Collation *Identifier `json:"Collation,omitempty"`
127+
}
128+
129+
func (p *PartitionParameterType) node() {}
130+
123131
// CreatePartitionFunctionStatement represents a CREATE PARTITION FUNCTION statement.
124132
type CreatePartitionFunctionStatement struct {
125-
Name *Identifier `json:"Name,omitempty"`
133+
Name *Identifier `json:"Name,omitempty"`
134+
ParameterType *PartitionParameterType `json:"ParameterType,omitempty"`
135+
Range string `json:"Range,omitempty"` // "Left" or "Right"
136+
BoundaryValues []ScalarExpression `json:"BoundaryValues,omitempty"`
126137
}
127138

128139
func (s *CreatePartitionFunctionStatement) node() {}

ast/drop_statements.go

Lines changed: 123 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ func (s *DropIndexStatement) node() {}
6666

6767
// DropIndexClause represents a single index to drop
6868
type DropIndexClause struct {
69-
Index *SchemaObjectName
70-
// Could have additional options like ON table, WITH options
69+
Index *SchemaObjectName // For backwards-compatible syntax: table.index
70+
IndexName *Identifier // For new syntax: index ON table
71+
Object *SchemaObjectName // Table name for ON clause syntax
7172
}
7273

7374
// DropStatisticsStatement represents a DROP STATISTICS statement
@@ -98,9 +99,127 @@ func (s *DropRuleStatement) node() {}
9899

99100
// DropSchemaStatement represents a DROP SCHEMA statement
100101
type DropSchemaStatement struct {
101-
IsIfExists bool
102-
Schema *SchemaObjectName
102+
IsIfExists bool
103+
Schema *SchemaObjectName
104+
DropBehavior string // "None", "Cascade", "Restrict"
103105
}
104106

105107
func (s *DropSchemaStatement) statement() {}
106108
func (s *DropSchemaStatement) node() {}
109+
110+
// DropSecurityPolicyStatement represents a DROP SECURITY POLICY statement
111+
type DropSecurityPolicyStatement struct {
112+
IsIfExists bool
113+
Objects []*SchemaObjectName
114+
}
115+
116+
func (s *DropSecurityPolicyStatement) statement() {}
117+
func (s *DropSecurityPolicyStatement) node() {}
118+
119+
// DropExternalDataSourceStatement represents a DROP EXTERNAL DATA SOURCE statement
120+
type DropExternalDataSourceStatement struct {
121+
IsIfExists bool
122+
Name *Identifier
123+
}
124+
125+
func (s *DropExternalDataSourceStatement) statement() {}
126+
func (s *DropExternalDataSourceStatement) node() {}
127+
128+
// DropExternalFileFormatStatement represents a DROP EXTERNAL FILE FORMAT statement
129+
type DropExternalFileFormatStatement struct {
130+
IsIfExists bool
131+
Name *Identifier
132+
}
133+
134+
func (s *DropExternalFileFormatStatement) statement() {}
135+
func (s *DropExternalFileFormatStatement) node() {}
136+
137+
// DropExternalTableStatement represents a DROP EXTERNAL TABLE statement
138+
type DropExternalTableStatement struct {
139+
IsIfExists bool
140+
Objects []*SchemaObjectName
141+
}
142+
143+
func (s *DropExternalTableStatement) statement() {}
144+
func (s *DropExternalTableStatement) node() {}
145+
146+
// DropExternalResourcePoolStatement represents a DROP EXTERNAL RESOURCE POOL statement
147+
type DropExternalResourcePoolStatement struct {
148+
IsIfExists bool
149+
Name *Identifier
150+
}
151+
152+
func (s *DropExternalResourcePoolStatement) statement() {}
153+
func (s *DropExternalResourcePoolStatement) node() {}
154+
155+
// DropWorkloadGroupStatement represents a DROP WORKLOAD GROUP statement
156+
type DropWorkloadGroupStatement struct {
157+
IsIfExists bool
158+
Name *Identifier
159+
}
160+
161+
func (s *DropWorkloadGroupStatement) statement() {}
162+
func (s *DropWorkloadGroupStatement) node() {}
163+
164+
// DropWorkloadClassifierStatement represents a DROP WORKLOAD CLASSIFIER statement
165+
type DropWorkloadClassifierStatement struct {
166+
IsIfExists bool
167+
Name *Identifier
168+
}
169+
170+
func (s *DropWorkloadClassifierStatement) statement() {}
171+
func (s *DropWorkloadClassifierStatement) node() {}
172+
173+
// DropTypeStatement represents a DROP TYPE statement
174+
type DropTypeStatement struct {
175+
IsIfExists bool
176+
Name *SchemaObjectName
177+
}
178+
179+
func (s *DropTypeStatement) statement() {}
180+
func (s *DropTypeStatement) node() {}
181+
182+
// DropAggregateStatement represents a DROP AGGREGATE statement
183+
type DropAggregateStatement struct {
184+
IsIfExists bool
185+
Objects []*SchemaObjectName
186+
}
187+
188+
func (s *DropAggregateStatement) statement() {}
189+
func (s *DropAggregateStatement) node() {}
190+
191+
// DropSynonymStatement represents a DROP SYNONYM statement
192+
type DropSynonymStatement struct {
193+
IsIfExists bool
194+
Objects []*SchemaObjectName
195+
}
196+
197+
func (s *DropSynonymStatement) statement() {}
198+
func (s *DropSynonymStatement) node() {}
199+
200+
// DropUserStatement represents a DROP USER statement
201+
type DropUserStatement struct {
202+
IsIfExists bool
203+
Name *Identifier
204+
}
205+
206+
func (s *DropUserStatement) statement() {}
207+
func (s *DropUserStatement) node() {}
208+
209+
// DropRoleStatement represents a DROP ROLE statement
210+
type DropRoleStatement struct {
211+
IsIfExists bool
212+
Name *Identifier
213+
}
214+
215+
func (s *DropRoleStatement) statement() {}
216+
func (s *DropRoleStatement) node() {}
217+
218+
// DropAssemblyStatement represents a DROP ASSEMBLY statement
219+
type DropAssemblyStatement struct {
220+
IsIfExists bool
221+
Objects []*SchemaObjectName
222+
}
223+
224+
func (s *DropAssemblyStatement) statement() {}
225+
func (s *DropAssemblyStatement) node() {}

ast/set_variable_statement.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,26 @@ package ast
22

33
// SetVariableStatement represents a SET @var = value statement.
44
type SetVariableStatement struct {
5-
Variable *VariableReference `json:"Variable,omitempty"`
6-
Expression ScalarExpression `json:"Expression,omitempty"`
7-
CursorDefinition *CursorDefinition `json:"CursorDefinition,omitempty"`
8-
AssignmentKind string `json:"AssignmentKind,omitempty"`
9-
SeparatorType string `json:"SeparatorType,omitempty"`
5+
Variable *VariableReference `json:"Variable,omitempty"`
6+
Expression ScalarExpression `json:"Expression,omitempty"`
7+
CursorDefinition *CursorDefinition `json:"CursorDefinition,omitempty"`
8+
AssignmentKind string `json:"AssignmentKind,omitempty"`
9+
SeparatorType string `json:"SeparatorType,omitempty"`
10+
FunctionCallExists bool `json:"FunctionCallExists,omitempty"`
1011
}
1112

1213
func (s *SetVariableStatement) node() {}
1314
func (s *SetVariableStatement) statement() {}
1415

1516
// CursorDefinition represents a cursor definition.
1617
type CursorDefinition struct {
17-
Select QueryExpression `json:"Select,omitempty"`
18+
Options []*CursorOption `json:"Options,omitempty"`
19+
Select QueryExpression `json:"Select,omitempty"`
1820
}
21+
22+
// CursorOption represents a cursor option like SCROLL or DYNAMIC.
23+
type CursorOption struct {
24+
OptionKind string `json:"OptionKind,omitempty"`
25+
}
26+
27+
func (o *CursorOption) node() {}

0 commit comments

Comments
 (0)