Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
37da6c3
Add Graph DB and MERGE statement parsing support
claude Jan 1, 2026
ffb9032
Add missing BULK INSERT option kind mappings
claude Jan 1, 2026
3b6f7d9
Add INCREMENTAL statistics parsing and RESAMPLE ON PARTITIONS support
claude Jan 1, 2026
c454860
Add selective XML index path parsing for ALTER INDEX FOR clause
claude Jan 1, 2026
5c221d5
Add TRUSTWORTHY, ENABLE_BROKER options for CREATE DATABASE
claude Jan 1, 2026
7074428
Add WAIT_AT_LOW_PRIORITY parsing for ALTER TABLE SWITCH
claude Jan 1, 2026
c69043b
Add CREATE/ALTER QUEUE parsing with ACTIVATION options
claude Jan 1, 2026
032aed6
Add OPTIMIZE_FOR_SEQUENTIAL_KEY support for UNIQUE constraints
claude Jan 1, 2026
52c0a7f
Add comprehensive SERVER AUDIT statement support
claude Jan 1, 2026
5184819
Add MAX_DURATION option support for CREATE INDEX
claude Jan 1, 2026
1be5aa2
Add FOR JSON clause parsing support
claude Jan 1, 2026
686cb2b
Add comprehensive CREATE XML INDEX parsing support
claude Jan 1, 2026
89e0207
Add BooleanScalarPlaceholder for parenthesized scalar expressions
claude Jan 1, 2026
855cfe9
Add REMOTE_DATA_ARCHIVE database option parsing
claude Jan 1, 2026
7e7f4bc
Add comprehensive SET statement parsing support
claude Jan 1, 2026
bcefd17
Add COMPATIBILITY_LEVEL and CHANGE_TRACKING database options
claude Jan 1, 2026
a46f00b
Add OFFSET clause and derived table parsing support
claude Jan 1, 2026
620ce6b
Add ROLLUP, CUBE, and composite grouping specification support
claude Jan 1, 2026
4002266
Enable GroupByClauseTests140 tests (same as 130 version)
claude Jan 1, 2026
a282ea8
Add FILETABLE support for CREATE/ALTER TABLE statements
claude Jan 1, 2026
f07bc3e
Enable GroupByClauseTests150 and Baselines150_GroupByClauseTests150 t…
claude Jan 1, 2026
d71c181
Add CREATE EXTERNAL LANGUAGE statement parsing
claude Jan 1, 2026
cf71f6a
Add ALTER EXTERNAL LANGUAGE statement parsing
claude Jan 1, 2026
b1e2884
Add AT TIME ZONE expression parsing
claude Jan 1, 2026
936ba6d
Add EXTERNAL resource pool support for ALTER WORKLOAD GROUP
claude Jan 1, 2026
8d6e114
Add ALTER FULLTEXT INDEX statement parsing
claude Jan 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions ast/alter_database_set_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ type DelayedDurabilityDatabaseOption struct {
func (d *DelayedDurabilityDatabaseOption) node() {}
func (d *DelayedDurabilityDatabaseOption) databaseOption() {}

// AutoCreateStatisticsDatabaseOption represents AUTO_CREATE_STATISTICS option with optional INCREMENTAL
type AutoCreateStatisticsDatabaseOption struct {
OptionKind string // "AutoCreateStatistics"
OptionState string // "On" or "Off"
HasIncremental bool // Whether INCREMENTAL is specified
IncrementalState string // "On" or "Off"
}

func (a *AutoCreateStatisticsDatabaseOption) node() {}
func (a *AutoCreateStatisticsDatabaseOption) databaseOption() {}

// IdentifierDatabaseOption represents a database option with an identifier value
type IdentifierDatabaseOption struct {
OptionKind string `json:"OptionKind,omitempty"` // "CatalogCollation"
Expand All @@ -64,6 +75,14 @@ func (o *OnOffDatabaseOption) createDatabaseOption() {}
func (i *IdentifierDatabaseOption) createDatabaseOption() {}
func (d *DelayedDurabilityDatabaseOption) createDatabaseOption() {}

// SimpleDatabaseOption represents a simple database option with just OptionKind (e.g., ENABLE_BROKER)
type SimpleDatabaseOption struct {
OptionKind string `json:"OptionKind,omitempty"`
}

func (d *SimpleDatabaseOption) node() {}
func (d *SimpleDatabaseOption) createDatabaseOption() {}

// MaxSizeDatabaseOption represents a MAXSIZE option.
type MaxSizeDatabaseOption struct {
OptionKind string `json:"OptionKind,omitempty"`
Expand Down Expand Up @@ -173,3 +192,79 @@ type DatabaseConfigurationClearOption struct {
}

func (d *DatabaseConfigurationClearOption) node() {}

// RemoteDataArchiveDatabaseOption represents REMOTE_DATA_ARCHIVE database option
type RemoteDataArchiveDatabaseOption struct {
OptionKind string // "RemoteDataArchive"
OptionState string // "On", "Off", "NotSet"
Settings []RemoteDataArchiveDbSetting // Settings like SERVER, CREDENTIAL, FEDERATED_SERVICE_ACCOUNT
}

func (r *RemoteDataArchiveDatabaseOption) node() {}
func (r *RemoteDataArchiveDatabaseOption) databaseOption() {}

// RemoteDataArchiveDbSetting is an interface for Remote Data Archive settings
type RemoteDataArchiveDbSetting interface {
Node
remoteDataArchiveDbSetting()
}

// RemoteDataArchiveDbServerSetting represents the SERVER setting
type RemoteDataArchiveDbServerSetting struct {
SettingKind string // "Server"
Server ScalarExpression // The server string literal
}

func (r *RemoteDataArchiveDbServerSetting) node() {}
func (r *RemoteDataArchiveDbServerSetting) remoteDataArchiveDbSetting() {}

// RemoteDataArchiveDbCredentialSetting represents the CREDENTIAL setting
type RemoteDataArchiveDbCredentialSetting struct {
SettingKind string // "Credential"
Credential *Identifier // The credential name
}

func (r *RemoteDataArchiveDbCredentialSetting) node() {}
func (r *RemoteDataArchiveDbCredentialSetting) remoteDataArchiveDbSetting() {}

// RemoteDataArchiveDbFederatedServiceAccountSetting represents the FEDERATED_SERVICE_ACCOUNT setting
type RemoteDataArchiveDbFederatedServiceAccountSetting struct {
SettingKind string // "FederatedServiceAccount"
IsOn bool // true for ON, false for OFF
}

func (r *RemoteDataArchiveDbFederatedServiceAccountSetting) node() {}
func (r *RemoteDataArchiveDbFederatedServiceAccountSetting) remoteDataArchiveDbSetting() {}

// ChangeTrackingDatabaseOption represents the CHANGE_TRACKING database option
type ChangeTrackingDatabaseOption struct {
OptionKind string // "ChangeTracking"
OptionState string // "On", "Off", "NotSet"
Details []ChangeTrackingOptionDetail // AUTO_CLEANUP, CHANGE_RETENTION
}

func (c *ChangeTrackingDatabaseOption) node() {}
func (c *ChangeTrackingDatabaseOption) databaseOption() {}

// ChangeTrackingOptionDetail is an interface for change tracking option details
type ChangeTrackingOptionDetail interface {
Node
changeTrackingOptionDetail()
}

// AutoCleanupChangeTrackingOptionDetail represents AUTO_CLEANUP option
type AutoCleanupChangeTrackingOptionDetail struct {
IsOn bool
}

func (a *AutoCleanupChangeTrackingOptionDetail) node() {}
func (a *AutoCleanupChangeTrackingOptionDetail) changeTrackingOptionDetail() {}

// ChangeRetentionChangeTrackingOptionDetail represents CHANGE_RETENTION option
type ChangeRetentionChangeTrackingOptionDetail struct {
RetentionPeriod ScalarExpression
Unit string // "Days", "Hours", "Minutes"
}

func (c *ChangeRetentionChangeTrackingOptionDetail) node() {}
func (c *ChangeRetentionChangeTrackingOptionDetail) changeTrackingOptionDetail() {}
30 changes: 29 additions & 1 deletion ast/alter_index_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,42 @@ type AlterIndexStatement struct {
Name *Identifier
All bool
OnName *SchemaObjectName
AlterIndexType string // "Rebuild", "Reorganize", "Disable", "Set", etc.
AlterIndexType string // "Rebuild", "Reorganize", "Disable", "Set", "UpdateSelectiveXmlPaths", etc.
Partition *PartitionSpecifier
IndexOptions []IndexOption
PromotedPaths []*SelectiveXmlIndexPromotedPath
XmlNamespaces *XmlNamespaces
}

func (s *AlterIndexStatement) statement() {}
func (s *AlterIndexStatement) node() {}

// SelectiveXmlIndexPromotedPath represents a path in a selective XML index
type SelectiveXmlIndexPromotedPath struct {
Name *Identifier
Path *StringLiteral
XQueryDataType *StringLiteral
MaxLength *IntegerLiteral
IsSingleton bool
}

func (s *SelectiveXmlIndexPromotedPath) node() {}

// XmlNamespaces represents a WITH XMLNAMESPACES clause
type XmlNamespaces struct {
XmlNamespacesElements []*XmlNamespacesAliasElement
}

func (x *XmlNamespaces) node() {}

// XmlNamespacesAliasElement represents an alias element in XMLNAMESPACES
type XmlNamespacesAliasElement struct {
Identifier *Identifier
String *StringLiteral
}

func (x *XmlNamespacesAliasElement) node() {}

// PartitionSpecifier represents a partition specifier
type PartitionSpecifier struct {
All bool
Expand Down
44 changes: 43 additions & 1 deletion ast/alter_simple_statements.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,54 @@ type OnOffFullTextCatalogOption struct {

// AlterFulltextIndexStatement represents an ALTER FULLTEXT INDEX statement.
type AlterFulltextIndexStatement struct {
OnName *SchemaObjectName `json:"OnName,omitempty"`
OnName *SchemaObjectName `json:"OnName,omitempty"`
Action AlterFullTextIndexActionOption `json:"Action,omitempty"`
}

func (s *AlterFulltextIndexStatement) node() {}
func (s *AlterFulltextIndexStatement) statement() {}

// AlterFullTextIndexActionOption is an interface for fulltext index actions
type AlterFullTextIndexActionOption interface {
alterFullTextIndexAction()
}

// SimpleAlterFullTextIndexAction represents simple actions like ENABLE, DISABLE, etc.
type SimpleAlterFullTextIndexAction struct {
ActionKind string `json:"ActionKind,omitempty"`
}

func (*SimpleAlterFullTextIndexAction) node() {}
func (*SimpleAlterFullTextIndexAction) alterFullTextIndexAction() {}

// AddAlterFullTextIndexAction represents an ADD action for fulltext index
type AddAlterFullTextIndexAction struct {
Columns []*FullTextIndexColumn `json:"Columns,omitempty"`
WithNoPopulation bool `json:"WithNoPopulation"`
}

func (*AddAlterFullTextIndexAction) node() {}
func (*AddAlterFullTextIndexAction) alterFullTextIndexAction() {}

// DropAlterFullTextIndexAction represents a DROP action for fulltext index
type DropAlterFullTextIndexAction struct {
Columns []*Identifier `json:"Columns,omitempty"`
WithNoPopulation bool `json:"WithNoPopulation"`
}

func (*DropAlterFullTextIndexAction) node() {}
func (*DropAlterFullTextIndexAction) alterFullTextIndexAction() {}

// FullTextIndexColumn represents a column in a fulltext index
type FullTextIndexColumn struct {
Name *Identifier `json:"Name,omitempty"`
TypeColumn *Identifier `json:"TypeColumn,omitempty"`
LanguageTerm *IdentifierOrValueExpression `json:"LanguageTerm,omitempty"`
StatisticalSemantics bool `json:"StatisticalSemantics"`
}

func (*FullTextIndexColumn) node() {}

// AlterSymmetricKeyStatement represents an ALTER SYMMETRIC KEY statement.
type AlterSymmetricKeyStatement struct {
Name *Identifier `json:"Name,omitempty"`
Expand Down
10 changes: 10 additions & 0 deletions ast/alter_table_alter_index_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,13 @@ type OrderIndexOption struct {

func (o *OrderIndexOption) indexOption() {}
func (o *OrderIndexOption) node() {}

// MaxDurationOption represents MAX_DURATION option for resumable index operations
type MaxDurationOption struct {
MaxDuration ScalarExpression
Unit string // "", "Minutes"
OptionKind string // "MaxDuration"
}

func (m *MaxDurationOption) indexOption() {}
func (m *MaxDurationOption) node() {}
10 changes: 10 additions & 0 deletions ast/alter_table_filetable_namespace_statement.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package ast

// AlterTableFileTableNamespaceStatement represents ALTER TABLE ... ENABLE/DISABLE FILETABLE_NAMESPACE
type AlterTableFileTableNamespaceStatement struct {
SchemaObjectName *SchemaObjectName `json:"SchemaObjectName,omitempty"`
IsEnable bool `json:"IsEnable,omitempty"`
}

func (s *AlterTableFileTableNamespaceStatement) node() {}
func (s *AlterTableFileTableNamespaceStatement) statement() {}
11 changes: 10 additions & 1 deletion ast/alter_table_switch_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,16 @@ type TruncateTargetTableSwitchOption struct {
func (o *TruncateTargetTableSwitchOption) tableSwitchOption() {}
func (o *TruncateTargetTableSwitchOption) node() {}

// LowPriorityLockWait represents LOW_PRIORITY_LOCK_WAIT option
// LowPriorityLockWaitTableSwitchOption represents WAIT_AT_LOW_PRIORITY option
type LowPriorityLockWaitTableSwitchOption struct {
OptionKind string
Options []LowPriorityLockWaitOption
}

func (o *LowPriorityLockWaitTableSwitchOption) tableSwitchOption() {}
func (o *LowPriorityLockWaitTableSwitchOption) node() {}

// LowPriorityLockWait represents LOW_PRIORITY_LOCK_WAIT option (legacy)
type LowPriorityLockWait struct {
MaxDuration ScalarExpression
MaxDurationUnit string // "MINUTES", "SECONDS"
Expand Down
10 changes: 10 additions & 0 deletions ast/at_time_zone.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package ast

// AtTimeZoneCall represents an AT TIME ZONE expression
type AtTimeZoneCall struct {
DateValue ScalarExpression
TimeZone ScalarExpression
}

func (*AtTimeZoneCall) node() {}
func (*AtTimeZoneCall) scalarExpression() {}
10 changes: 10 additions & 0 deletions ast/boolean_expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,13 @@ type BooleanExpression interface {
Node
booleanExpression()
}

// BooleanScalarPlaceholder is a temporary marker used during parsing when we
// encounter a scalar expression in a boolean context without a comparison operator.
// This allows the caller to detect and handle cases like (XACT_STATE()) = -1.
type BooleanScalarPlaceholder struct {
Scalar ScalarExpression
}

func (b *BooleanScalarPlaceholder) booleanExpression() {}
func (b *BooleanScalarPlaceholder) node() {}
41 changes: 37 additions & 4 deletions ast/create_simple_statements.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,38 @@ type QueueOptionSimple struct {
func (o *QueueOptionSimple) node() {}
func (o *QueueOptionSimple) queueOption() {}

// QueueProcedureOption represents a PROCEDURE_NAME option.
type QueueProcedureOption struct {
OptionValue *SchemaObjectName `json:"OptionValue,omitempty"`
OptionKind string `json:"OptionKind,omitempty"` // "ActivationProcedureName"
}

func (o *QueueProcedureOption) node() {}
func (o *QueueProcedureOption) queueOption() {}

// QueueValueOption represents an option with an integer value.
type QueueValueOption struct {
OptionValue ScalarExpression `json:"OptionValue,omitempty"`
OptionKind string `json:"OptionKind,omitempty"` // "ActivationMaxQueueReaders"
}

func (o *QueueValueOption) node() {}
func (o *QueueValueOption) queueOption() {}

// QueueExecuteAsOption represents an EXECUTE AS option.
type QueueExecuteAsOption struct {
OptionValue *ExecuteAsClause `json:"OptionValue,omitempty"`
OptionKind string `json:"OptionKind,omitempty"` // "ActivationExecuteAs"
}

func (o *QueueExecuteAsOption) node() {}
func (o *QueueExecuteAsOption) queueOption() {}

// CreateQueueStatement represents a CREATE QUEUE statement.
type CreateQueueStatement struct {
Name *SchemaObjectName `json:"Name,omitempty"`
QueueOptions []QueueOption `json:"QueueOptions,omitempty"`
Name *SchemaObjectName `json:"Name,omitempty"`
OnFileGroup *IdentifierOrValueExpression `json:"OnFileGroup,omitempty"`
QueueOptions []QueueOption `json:"QueueOptions,omitempty"`
}

func (s *CreateQueueStatement) node() {}
Expand Down Expand Up @@ -408,8 +436,13 @@ func (s *CreateTypeTableStatement) statement() {}

// CreateXmlIndexStatement represents a CREATE XML INDEX statement.
type CreateXmlIndexStatement struct {
Name *Identifier `json:"Name,omitempty"`
OnName *SchemaObjectName `json:"OnName,omitempty"`
Primary bool `json:"Primary,omitempty"`
XmlColumn *Identifier `json:"XmlColumn,omitempty"`
SecondaryXmlIndexName *Identifier `json:"SecondaryXmlIndexName,omitempty"`
SecondaryXmlIndexType string `json:"SecondaryXmlIndexType,omitempty"` // "NotSpecified", "Value", "Path", "Property"
Name *Identifier `json:"Name,omitempty"`
OnName *SchemaObjectName `json:"OnName,omitempty"`
IndexOptions []IndexOption `json:"IndexOptions,omitempty"`
}

func (s *CreateXmlIndexStatement) node() {}
Expand Down
9 changes: 9 additions & 0 deletions ast/create_table_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,17 @@ type CreateTableStatement struct {
TextImageOn *IdentifierOrValueExpression
FileStreamOn *IdentifierOrValueExpression
Options []TableOption
FederationScheme *FederationScheme
}

// FederationScheme represents a FEDERATED ON clause
type FederationScheme struct {
DistributionName *Identifier
ColumnName *Identifier
}

func (*FederationScheme) node() {}

// TableDataCompressionOption represents a DATA_COMPRESSION option
type TableDataCompressionOption struct {
DataCompressionOption *DataCompressionOption
Expand Down
2 changes: 1 addition & 1 deletion ast/drop_statements.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ type LowPriorityLockWaitOption interface {

// LowPriorityLockWaitMaxDurationOption represents MAX_DURATION option
type LowPriorityLockWaitMaxDurationOption struct {
MaxDuration *IntegerLiteral
MaxDuration ScalarExpression
Unit string // Minutes or Seconds
OptionKind string // MaxDuration
}
Expand Down
Loading
Loading