Skip to content

Commit 3656485

Browse files
authored
Add parser features and enable 8 more tests (#16)
1 parent f2edbc4 commit 3656485

File tree

34 files changed

+1001
-36
lines changed

34 files changed

+1001
-36
lines changed

ast/alter_database_set_statement.go

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ func (a *AlterDatabaseAddFileStatement) statement() {}
4545

4646
// AlterDatabaseAddFileGroupStatement represents ALTER DATABASE ... ADD FILEGROUP statement
4747
type AlterDatabaseAddFileGroupStatement struct {
48-
DatabaseName *Identifier
49-
FileGroupName *Identifier
48+
DatabaseName *Identifier
49+
FileGroupName *Identifier
50+
ContainsFileStream bool
51+
ContainsMemoryOptimizedData bool
52+
UseCurrent bool
5053
}
5154

5255
func (a *AlterDatabaseAddFileGroupStatement) node() {}
@@ -62,8 +65,11 @@ func (a *AlterDatabaseModifyFileStatement) statement() {}
6265

6366
// AlterDatabaseModifyFileGroupStatement represents ALTER DATABASE ... MODIFY FILEGROUP statement
6467
type AlterDatabaseModifyFileGroupStatement struct {
65-
DatabaseName *Identifier
66-
FileGroupName *Identifier
68+
DatabaseName *Identifier
69+
FileGroupName *Identifier
70+
MakeDefault bool
71+
UpdatabilityOption string // "ReadOnly", "ReadWrite", "ReadOnlyOld", "ReadWriteOld", or ""
72+
NewFileGroupName *Identifier
6773
}
6874

6975
func (a *AlterDatabaseModifyFileGroupStatement) node() {}
@@ -95,3 +101,20 @@ type AlterDatabaseRemoveFileGroupStatement struct {
95101

96102
func (a *AlterDatabaseRemoveFileGroupStatement) node() {}
97103
func (a *AlterDatabaseRemoveFileGroupStatement) statement() {}
104+
105+
// AlterDatabaseScopedConfigurationClearStatement represents ALTER DATABASE SCOPED CONFIGURATION CLEAR statement
106+
type AlterDatabaseScopedConfigurationClearStatement struct {
107+
Option *DatabaseConfigurationClearOption
108+
Secondary bool
109+
}
110+
111+
func (a *AlterDatabaseScopedConfigurationClearStatement) node() {}
112+
func (a *AlterDatabaseScopedConfigurationClearStatement) statement() {}
113+
114+
// DatabaseConfigurationClearOption represents a CLEAR option
115+
type DatabaseConfigurationClearOption struct {
116+
OptionKind string // "ProcedureCache"
117+
PlanHandle ScalarExpression // Optional binary plan handle
118+
}
119+
120+
func (d *DatabaseConfigurationClearOption) node() {}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package ast
2+
3+
type AlterResourceGovernorStatement struct {
4+
Command string
5+
ClassifierFunction *SchemaObjectName
6+
}
7+
8+
func (s *AlterResourceGovernorStatement) node() {}
9+
func (s *AlterResourceGovernorStatement) statement() {}

ast/alter_simple_statements.go

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ func (s *AlterServiceStatement) statement() {}
3434

3535
// AlterCertificateStatement represents an ALTER CERTIFICATE statement.
3636
type AlterCertificateStatement struct {
37-
Name *Identifier `json:"Name,omitempty"`
37+
Name *Identifier `json:"Name,omitempty"`
38+
Kind string `json:"Kind,omitempty"` // RemovePrivateKey, WithActiveForBeginDialog, WithPrivateKey, RemoveAttestedOption, AttestedBy
39+
ActiveForBeginDialog string `json:"ActiveForBeginDialog,omitempty"` // NotSet, On, Off
40+
PrivateKeyPath *StringLiteral `json:"PrivateKeyPath,omitempty"`
41+
DecryptionPassword *StringLiteral `json:"DecryptionPassword,omitempty"`
42+
EncryptionPassword *StringLiteral `json:"EncryptionPassword,omitempty"`
43+
AttestedBy *StringLiteral `json:"AttestedBy,omitempty"`
3844
}
3945

4046
func (s *AlterCertificateStatement) node() {}
@@ -86,12 +92,20 @@ func (s *AlterPartitionFunctionStatement) statement() {}
8692

8793
// AlterFulltextCatalogStatement represents an ALTER FULLTEXT CATALOG statement.
8894
type AlterFulltextCatalogStatement struct {
89-
Name *Identifier `json:"Name,omitempty"`
95+
Name *Identifier `json:"Name,omitempty"`
96+
Action string `json:"Action,omitempty"` // Rebuild, Reorganize, AsDefault
97+
Options []*OnOffFullTextCatalogOption `json:"Options,omitempty"`
9098
}
9199

92100
func (s *AlterFulltextCatalogStatement) node() {}
93101
func (s *AlterFulltextCatalogStatement) statement() {}
94102

103+
// OnOffFullTextCatalogOption represents an option for ALTER FULLTEXT CATALOG
104+
type OnOffFullTextCatalogOption struct {
105+
OptionKind string `json:"OptionKind,omitempty"` // AccentSensitivity
106+
OptionState string `json:"OptionState,omitempty"` // On, Off
107+
}
108+
95109
// AlterFulltextIndexStatement represents an ALTER FULLTEXT INDEX statement.
96110
type AlterFulltextIndexStatement struct {
97111
OnName *SchemaObjectName `json:"OnName,omitempty"`
@@ -117,3 +131,14 @@ type AlterServiceMasterKeyStatement struct {
117131

118132
func (s *AlterServiceMasterKeyStatement) node() {}
119133
func (s *AlterServiceMasterKeyStatement) statement() {}
134+
135+
// RenameEntityStatement represents a RENAME statement (Azure SQL DW/Synapse).
136+
type RenameEntityStatement struct {
137+
RenameEntityType string `json:"RenameEntityType,omitempty"` // Object, Database
138+
SeparatorType string `json:"SeparatorType,omitempty"` // DoubleColon (only when :: is used)
139+
OldName *SchemaObjectName `json:"OldName,omitempty"`
140+
NewName *Identifier `json:"NewName,omitempty"`
141+
}
142+
143+
func (s *RenameEntityStatement) node() {}
144+
func (s *RenameEntityStatement) statement() {}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package ast
2+
3+
// CreateCryptographicProviderStatement represents CREATE CRYPTOGRAPHIC PROVIDER statement
4+
type CreateCryptographicProviderStatement struct {
5+
Name *Identifier
6+
File ScalarExpression
7+
}
8+
9+
func (s *CreateCryptographicProviderStatement) node() {}
10+
func (s *CreateCryptographicProviderStatement) statement() {}
11+
12+
// AlterCryptographicProviderStatement represents ALTER CRYPTOGRAPHIC PROVIDER statement
13+
type AlterCryptographicProviderStatement struct {
14+
Name *Identifier
15+
Option string // "None", "Enable", "Disable"
16+
File ScalarExpression
17+
}
18+
19+
func (s *AlterCryptographicProviderStatement) node() {}
20+
func (s *AlterCryptographicProviderStatement) statement() {}
21+
22+
// DropCryptographicProviderStatement represents DROP CRYPTOGRAPHIC PROVIDER statement
23+
type DropCryptographicProviderStatement struct {
24+
Name *Identifier
25+
IsIfExists bool
26+
}
27+
28+
func (s *DropCryptographicProviderStatement) node() {}
29+
func (s *DropCryptographicProviderStatement) statement() {}

ast/federation_statements.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package ast
2+
3+
// CreateFederationStatement represents CREATE FEDERATION statement
4+
type CreateFederationStatement struct {
5+
Name *Identifier
6+
DistributionName *Identifier
7+
DataType DataTypeReference
8+
}
9+
10+
func (s *CreateFederationStatement) node() {}
11+
func (s *CreateFederationStatement) statement() {}
12+
13+
// AlterFederationStatement represents ALTER FEDERATION statement
14+
type AlterFederationStatement struct {
15+
Name *Identifier
16+
Kind string // "Split", "DropLow", "DropHigh"
17+
DistributionName *Identifier
18+
Boundary ScalarExpression
19+
}
20+
21+
func (s *AlterFederationStatement) node() {}
22+
func (s *AlterFederationStatement) statement() {}

ast/use_federation_statement.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package ast
2+
3+
// UseFederationStatement represents USE FEDERATION statement
4+
type UseFederationStatement struct {
5+
FederationName *Identifier
6+
DistributionName *Identifier
7+
Value ScalarExpression
8+
Filtering bool
9+
}
10+
11+
func (s *UseFederationStatement) node() {}
12+
func (s *UseFederationStatement) statement() {}

0 commit comments

Comments
 (0)