Skip to content

Commit ab923dd

Browse files
authored
Fix all remaining tests (#61)
1 parent 38880b3 commit ab923dd

File tree

182 files changed

+16543
-4147
lines changed

Some content is hidden

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

182 files changed

+16543
-4147
lines changed

ast/adhoc_table_reference.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package ast
2+
3+
// AdHocTableReference represents a table accessed via OPENDATASOURCE
4+
// Syntax: OPENDATASOURCE('provider', 'connstr').'object'
5+
// Uses AdHocDataSource from execute_statement.go
6+
type AdHocTableReference struct {
7+
DataSource *AdHocDataSource `json:"DataSource,omitempty"`
8+
Object *SchemaObjectNameOrValueExpression `json:"Object,omitempty"`
9+
Alias *Identifier `json:"Alias,omitempty"`
10+
ForPath bool `json:"ForPath"`
11+
}
12+
13+
func (*AdHocTableReference) node() {}
14+
func (*AdHocTableReference) tableReference() {}
15+
16+
// SchemaObjectNameOrValueExpression represents either a schema object name or a value expression
17+
type SchemaObjectNameOrValueExpression struct {
18+
SchemaObjectName *SchemaObjectName `json:"SchemaObjectName,omitempty"`
19+
ValueExpression ScalarExpression `json:"ValueExpression,omitempty"`
20+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package ast
2+
3+
// AlterAuthorizationStatement represents an ALTER AUTHORIZATION statement
4+
type AlterAuthorizationStatement struct {
5+
SecurityTargetObject *SecurityTargetObject
6+
ToSchemaOwner bool
7+
PrincipalName *Identifier
8+
}
9+
10+
func (s *AlterAuthorizationStatement) node() {}
11+
func (s *AlterAuthorizationStatement) statement() {}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package ast
2+
3+
// AlterAvailabilityGroupStatement represents ALTER AVAILABILITY GROUP statement
4+
type AlterAvailabilityGroupStatement struct {
5+
Name *Identifier
6+
StatementType string // "Action", "AddDatabase", "RemoveDatabase", "AddReplica", "ModifyReplica", "RemoveReplica", "Set"
7+
Action AvailabilityGroupAction
8+
Databases []*Identifier
9+
Replicas []*AvailabilityReplica
10+
Options []AvailabilityGroupOption
11+
}
12+
13+
func (s *AlterAvailabilityGroupStatement) node() {}
14+
func (s *AlterAvailabilityGroupStatement) statement() {}
15+
16+
// AvailabilityGroupAction is an interface for availability group actions
17+
type AvailabilityGroupAction interface {
18+
node()
19+
availabilityGroupAction()
20+
}
21+
22+
// AlterAvailabilityGroupAction represents simple actions like JOIN, ONLINE, OFFLINE
23+
type AlterAvailabilityGroupAction struct {
24+
ActionType string // "Join", "ForceFailoverAllowDataLoss", "Online", "Offline"
25+
}
26+
27+
func (a *AlterAvailabilityGroupAction) node() {}
28+
func (a *AlterAvailabilityGroupAction) availabilityGroupAction() {}
29+
30+
// AlterAvailabilityGroupFailoverAction represents FAILOVER action with options
31+
type AlterAvailabilityGroupFailoverAction struct {
32+
ActionType string // "Failover"
33+
Options []*AlterAvailabilityGroupFailoverOption
34+
}
35+
36+
func (a *AlterAvailabilityGroupFailoverAction) node() {}
37+
func (a *AlterAvailabilityGroupFailoverAction) availabilityGroupAction() {}
38+
39+
// AlterAvailabilityGroupFailoverOption represents an option for failover action
40+
type AlterAvailabilityGroupFailoverOption struct {
41+
OptionKind string // "Target"
42+
Value ScalarExpression // StringLiteral for target server
43+
}
44+
45+
func (o *AlterAvailabilityGroupFailoverOption) node() {}

ast/alter_database_set_statement.go

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,58 @@ func (l *LiteralDatabaseOption) node() {}
115115
func (l *LiteralDatabaseOption) databaseOption() {}
116116
func (l *LiteralDatabaseOption) createDatabaseOption() {}
117117

118+
// AutomaticTuningDatabaseOption represents AUTOMATIC_TUNING option
119+
type AutomaticTuningDatabaseOption struct {
120+
OptionKind string // "AutomaticTuning"
121+
AutomaticTuningState string // "Inherit", "Custom", "Auto", "NotSet"
122+
Options []AutomaticTuningOption // Sub-options like CREATE_INDEX, DROP_INDEX, etc.
123+
}
124+
125+
func (a *AutomaticTuningDatabaseOption) node() {}
126+
func (a *AutomaticTuningDatabaseOption) databaseOption() {}
127+
128+
// AutomaticTuningOption is an interface for automatic tuning sub-options
129+
type AutomaticTuningOption interface {
130+
Node
131+
automaticTuningOption()
132+
}
133+
134+
// AutomaticTuningCreateIndexOption represents CREATE_INDEX option
135+
type AutomaticTuningCreateIndexOption struct {
136+
OptionKind string // "Create_Index"
137+
Value string // "On", "Off", "Default"
138+
}
139+
140+
func (a *AutomaticTuningCreateIndexOption) node() {}
141+
func (a *AutomaticTuningCreateIndexOption) automaticTuningOption() {}
142+
143+
// AutomaticTuningDropIndexOption represents DROP_INDEX option
144+
type AutomaticTuningDropIndexOption struct {
145+
OptionKind string // "Drop_Index"
146+
Value string // "On", "Off", "Default"
147+
}
148+
149+
func (a *AutomaticTuningDropIndexOption) node() {}
150+
func (a *AutomaticTuningDropIndexOption) automaticTuningOption() {}
151+
152+
// AutomaticTuningForceLastGoodPlanOption represents FORCE_LAST_GOOD_PLAN option
153+
type AutomaticTuningForceLastGoodPlanOption struct {
154+
OptionKind string // "Force_Last_Good_Plan"
155+
Value string // "On", "Off", "Default"
156+
}
157+
158+
func (a *AutomaticTuningForceLastGoodPlanOption) node() {}
159+
func (a *AutomaticTuningForceLastGoodPlanOption) automaticTuningOption() {}
160+
161+
// AutomaticTuningMaintainIndexOption represents MAINTAIN_INDEX option
162+
type AutomaticTuningMaintainIndexOption struct {
163+
OptionKind string // "Maintain_Index"
164+
Value string // "On", "Off", "Default"
165+
}
166+
167+
func (a *AutomaticTuningMaintainIndexOption) node() {}
168+
func (a *AutomaticTuningMaintainIndexOption) automaticTuningOption() {}
169+
118170
// ElasticPoolSpecification represents SERVICE_OBJECTIVE = ELASTIC_POOL(name = poolname)
119171
type ElasticPoolSpecification struct {
120172
ElasticPoolName *Identifier
@@ -377,3 +429,184 @@ type GenericDatabaseOption struct {
377429

378430
func (g *GenericDatabaseOption) node() {}
379431
func (g *GenericDatabaseOption) databaseOption() {}
432+
433+
// HadrDatabaseOption represents ALTER DATABASE SET HADR {SUSPEND|RESUME|OFF}
434+
type HadrDatabaseOption struct {
435+
HadrOption string // "Suspend", "Resume", "Off"
436+
OptionKind string // "Hadr"
437+
}
438+
439+
func (h *HadrDatabaseOption) node() {}
440+
func (h *HadrDatabaseOption) databaseOption() {}
441+
442+
// HadrAvailabilityGroupDatabaseOption represents ALTER DATABASE SET HADR AVAILABILITY GROUP = name
443+
type HadrAvailabilityGroupDatabaseOption struct {
444+
GroupName *Identifier
445+
HadrOption string // "AvailabilityGroup"
446+
OptionKind string // "Hadr"
447+
}
448+
449+
func (h *HadrAvailabilityGroupDatabaseOption) node() {}
450+
func (h *HadrAvailabilityGroupDatabaseOption) databaseOption() {}
451+
452+
// TargetRecoveryTimeDatabaseOption represents TARGET_RECOVERY_TIME database option
453+
type TargetRecoveryTimeDatabaseOption struct {
454+
OptionKind string // "TargetRecoveryTime"
455+
RecoveryTime ScalarExpression // Integer literal
456+
Unit string // "Seconds" or "Minutes"
457+
}
458+
459+
func (t *TargetRecoveryTimeDatabaseOption) node() {}
460+
func (t *TargetRecoveryTimeDatabaseOption) databaseOption() {}
461+
462+
// QueryStoreDatabaseOption represents QUERY_STORE database option
463+
type QueryStoreDatabaseOption struct {
464+
OptionKind string // "QueryStore"
465+
OptionState string // "On", "Off", "NotSet"
466+
Clear bool // QUERY_STORE CLEAR [ALL]
467+
ClearAll bool // QUERY_STORE CLEAR ALL
468+
Options []QueryStoreOption // Sub-options
469+
}
470+
471+
func (q *QueryStoreDatabaseOption) node() {}
472+
func (q *QueryStoreDatabaseOption) databaseOption() {}
473+
474+
// QueryStoreOption is an interface for query store sub-options
475+
type QueryStoreOption interface {
476+
Node
477+
queryStoreOption()
478+
}
479+
480+
// QueryStoreDesiredStateOption represents DESIRED_STATE option
481+
type QueryStoreDesiredStateOption struct {
482+
OptionKind string // "Desired_State"
483+
Value string // "ReadOnly", "ReadWrite", "Off"
484+
OperationModeSpecified bool // Whether OPERATION_MODE was explicitly specified
485+
}
486+
487+
func (q *QueryStoreDesiredStateOption) node() {}
488+
func (q *QueryStoreDesiredStateOption) queryStoreOption() {}
489+
490+
// QueryStoreCapturePolicyOption represents QUERY_CAPTURE_MODE option
491+
type QueryStoreCapturePolicyOption struct {
492+
OptionKind string // "Query_Capture_Mode"
493+
Value string // "ALL", "AUTO", "NONE", "CUSTOM"
494+
}
495+
496+
func (q *QueryStoreCapturePolicyOption) node() {}
497+
func (q *QueryStoreCapturePolicyOption) queryStoreOption() {}
498+
499+
// QueryStoreSizeCleanupPolicyOption represents SIZE_BASED_CLEANUP_MODE option
500+
type QueryStoreSizeCleanupPolicyOption struct {
501+
OptionKind string // "Size_Based_Cleanup_Mode"
502+
Value string // "OFF", "AUTO"
503+
}
504+
505+
func (q *QueryStoreSizeCleanupPolicyOption) node() {}
506+
func (q *QueryStoreSizeCleanupPolicyOption) queryStoreOption() {}
507+
508+
// QueryStoreIntervalLengthOption represents INTERVAL_LENGTH_MINUTES option
509+
type QueryStoreIntervalLengthOption struct {
510+
OptionKind string // "Interval_Length_Minutes"
511+
StatsIntervalLength ScalarExpression // Integer literal
512+
}
513+
514+
func (q *QueryStoreIntervalLengthOption) node() {}
515+
func (q *QueryStoreIntervalLengthOption) queryStoreOption() {}
516+
517+
// QueryStoreMaxStorageSizeOption represents MAX_STORAGE_SIZE_MB option
518+
type QueryStoreMaxStorageSizeOption struct {
519+
OptionKind string // "Current_Storage_Size_MB" (note: uses Current_Storage_Size_MB as OptionKind)
520+
MaxQdsSize ScalarExpression // Integer literal
521+
}
522+
523+
func (q *QueryStoreMaxStorageSizeOption) node() {}
524+
func (q *QueryStoreMaxStorageSizeOption) queryStoreOption() {}
525+
526+
// QueryStoreMaxPlansPerQueryOption represents MAX_PLANS_PER_QUERY option
527+
type QueryStoreMaxPlansPerQueryOption struct {
528+
OptionKind string // "Max_Plans_Per_Query"
529+
MaxPlansPerQuery ScalarExpression // Integer literal
530+
}
531+
532+
func (q *QueryStoreMaxPlansPerQueryOption) node() {}
533+
func (q *QueryStoreMaxPlansPerQueryOption) queryStoreOption() {}
534+
535+
// QueryStoreTimeCleanupPolicyOption represents STALE_QUERY_THRESHOLD_DAYS option (in CLEANUP_POLICY)
536+
type QueryStoreTimeCleanupPolicyOption struct {
537+
OptionKind string // "Stale_Query_Threshold_Days"
538+
StaleQueryThreshold ScalarExpression // Integer literal
539+
}
540+
541+
func (q *QueryStoreTimeCleanupPolicyOption) node() {}
542+
func (q *QueryStoreTimeCleanupPolicyOption) queryStoreOption() {}
543+
544+
// QueryStoreWaitStatsCaptureOption represents WAIT_STATS_CAPTURE_MODE option
545+
type QueryStoreWaitStatsCaptureOption struct {
546+
OptionKind string // "Wait_Stats_Capture_Mode"
547+
OptionState string // "On", "Off"
548+
}
549+
550+
func (q *QueryStoreWaitStatsCaptureOption) node() {}
551+
func (q *QueryStoreWaitStatsCaptureOption) queryStoreOption() {}
552+
553+
// QueryStoreDataFlushIntervalOption represents FLUSH_INTERVAL_SECONDS/DATA_FLUSH_INTERVAL_SECONDS option
554+
type QueryStoreDataFlushIntervalOption struct {
555+
OptionKind string // "Flush_Interval_Seconds"
556+
FlushInterval ScalarExpression // Integer literal
557+
}
558+
559+
func (q *QueryStoreDataFlushIntervalOption) node() {}
560+
func (q *QueryStoreDataFlushIntervalOption) queryStoreOption() {}
561+
562+
// AlterDatabaseScopedConfigurationSetStatement represents ALTER DATABASE SCOPED CONFIGURATION SET statement
563+
type AlterDatabaseScopedConfigurationSetStatement struct {
564+
Secondary bool
565+
Option DatabaseConfigurationSetOption
566+
}
567+
568+
func (a *AlterDatabaseScopedConfigurationSetStatement) node() {}
569+
func (a *AlterDatabaseScopedConfigurationSetStatement) statement() {}
570+
571+
// DatabaseConfigurationSetOption is an interface for scoped configuration options
572+
type DatabaseConfigurationSetOption interface {
573+
Node
574+
databaseConfigurationSetOption()
575+
}
576+
577+
// MaxDopConfigurationOption represents MAXDOP configuration option
578+
type MaxDopConfigurationOption struct {
579+
OptionKind string // "MaxDop"
580+
Value ScalarExpression // Integer value
581+
Primary bool // true if set to PRIMARY
582+
}
583+
584+
func (m *MaxDopConfigurationOption) node() {}
585+
func (m *MaxDopConfigurationOption) databaseConfigurationSetOption() {}
586+
587+
// OnOffPrimaryConfigurationOption represents ON/OFF/PRIMARY configuration option
588+
type OnOffPrimaryConfigurationOption struct {
589+
OptionKind string // "LegacyCardinalityEstimate", "ParameterSniffing", "QueryOptimizerHotFixes"
590+
OptionState string // "On", "Off", "Primary"
591+
}
592+
593+
func (o *OnOffPrimaryConfigurationOption) node() {}
594+
func (o *OnOffPrimaryConfigurationOption) databaseConfigurationSetOption() {}
595+
596+
// GenericConfigurationOption represents a generic configuration option
597+
type GenericConfigurationOption struct {
598+
OptionKind string // "MaxDop"
599+
GenericOptionKind *Identifier // The custom option name
600+
GenericOptionState *IdentifierOrScalarExpression // The value (identifier or scalar)
601+
}
602+
603+
func (g *GenericConfigurationOption) node() {}
604+
func (g *GenericConfigurationOption) databaseConfigurationSetOption() {}
605+
606+
// IdentifierOrScalarExpression represents either an identifier or a scalar expression
607+
type IdentifierOrScalarExpression struct {
608+
Identifier *Identifier
609+
ScalarExpression ScalarExpression
610+
}
611+
612+
func (i *IdentifierOrScalarExpression) node() {}

ast/alter_index_statement.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,29 @@ type SelectiveXmlIndexPromotedPath struct {
2020
Name *Identifier
2121
Path *StringLiteral
2222
XQueryDataType *StringLiteral
23+
SQLDataType *SqlDataTypeReference
2324
MaxLength *IntegerLiteral
2425
IsSingleton bool
2526
}
2627

2728
func (s *SelectiveXmlIndexPromotedPath) node() {}
2829

30+
// CreateSelectiveXmlIndexStatement represents CREATE SELECTIVE XML INDEX statement
31+
type CreateSelectiveXmlIndexStatement struct {
32+
Name *Identifier
33+
OnName *SchemaObjectName
34+
XmlColumn *Identifier
35+
IsSecondary bool
36+
UsingXmlIndexName *Identifier // For secondary indexes
37+
PathName *Identifier // For secondary indexes
38+
PromotedPaths []*SelectiveXmlIndexPromotedPath
39+
XmlNamespaces *XmlNamespaces
40+
IndexOptions []IndexOption
41+
}
42+
43+
func (s *CreateSelectiveXmlIndexStatement) statement() {}
44+
func (s *CreateSelectiveXmlIndexStatement) node() {}
45+
2946
// XmlNamespaces represents a WITH XMLNAMESPACES clause
3047
type XmlNamespaces struct {
3148
XmlNamespacesElements []XmlNamespacesElement

0 commit comments

Comments
 (0)