Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2c956b4
Fix inline index ON/FILESTREAM_ON clause parsing
claude Jan 4, 2026
bdb621a
Add CREATE EXTERNAL RESOURCE POOL statement support
claude Jan 4, 2026
c252399
Add TRIM function LEADING/TRAILING/BOTH option support
claude Jan 4, 2026
b2cb43e
Add comprehensive RESTORE statement support
claude Jan 4, 2026
c0eab45
Add standalone HASH support for inline index definitions
claude Jan 4, 2026
38fd44b
Add OpenRowset Cosmos and TableReference support
claude Jan 4, 2026
888f466
Add AS keyword support for function parameter declarations
claude Jan 4, 2026
ca81ad1
Add WITH clause column schema support for BULK OPENROWSET
claude Jan 4, 2026
b07e1ae
Fix table hint and alias parsing order in FROM clause
claude Jan 4, 2026
468530b
Add CREATE/ALTER/DROP LOGIN statement support
claude Jan 4, 2026
7f60105
Fix LoginStatementTests - handle national strings and IsIfExists
claude Jan 4, 2026
4b9f707
Add support for service broker and other DROP statements
claude Jan 4, 2026
aa2f616
Add CHANGETABLE, VALUES, and GlobalFunction table references
claude Jan 4, 2026
9f130b9
Add DATABASE AUDIT SPECIFICATION action and group support
claude Jan 4, 2026
bed1118
Add DATA_COMPRESSION option for columnstore indexes
claude Jan 4, 2026
269492f
Add XML_COMPRESSION table option support (partial progress)
claude Jan 4, 2026
7a69bac
Add TABLE DISTRIBUTION, CLUSTERED INDEX, and HEAP options for CREATE …
claude Jan 4, 2026
22cb6a9
Add WINDOW clause and improve OVER clause support
claude Jan 5, 2026
99e4b3a
Add BACKUP statement FILE/FILEGROUP list parsing and option kinds
claude Jan 5, 2026
21d6e2d
Add ONLINE WAIT_AT_LOW_PRIORITY and XML_COMPRESSION support for CREAT…
claude Jan 5, 2026
14332f3
Add DataModificationTableReference and PIVOT/UNPIVOT support
claude Jan 5, 2026
ce3ef59
Add ForceSeekTableHint and FORCESCAN support for table hints
claude Jan 5, 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
5 changes: 3 additions & 2 deletions ast/alter_table_alter_index_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ type IndexExpressionOption struct {
Expression ScalarExpression
}

func (i *IndexExpressionOption) indexOption() {}
func (i *IndexExpressionOption) node() {}
func (i *IndexExpressionOption) indexOption() {}
func (i *IndexExpressionOption) dropIndexOption() {}
func (i *IndexExpressionOption) node() {}

// CompressionDelayIndexOption represents a COMPRESSION_DELAY option
type CompressionDelayIndexOption struct {
Expand Down
11 changes: 6 additions & 5 deletions ast/bulk_insert_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ func (o *OrderBulkInsertOption) bulkInsertOption() {}

// BulkOpenRowset represents an OPENROWSET (BULK ...) table reference.
type BulkOpenRowset struct {
DataFiles []ScalarExpression `json:"DataFiles,omitempty"`
Options []BulkInsertOption `json:"Options,omitempty"`
Columns []*Identifier `json:"Columns,omitempty"`
Alias *Identifier `json:"Alias,omitempty"`
ForPath bool `json:"ForPath"`
DataFiles []ScalarExpression `json:"DataFiles,omitempty"`
Options []BulkInsertOption `json:"Options,omitempty"`
WithColumns []*OpenRowsetColumnDefinition `json:"WithColumns,omitempty"`
Columns []*Identifier `json:"Columns,omitempty"`
Alias *Identifier `json:"Alias,omitempty"`
ForPath bool `json:"ForPath"`
}

func (b *BulkOpenRowset) node() {}
Expand Down
28 changes: 28 additions & 0 deletions ast/changetable_reference.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package ast

// ChangeTableChangesTableReference represents CHANGETABLE(CHANGES ...) table reference
type ChangeTableChangesTableReference struct {
Target *SchemaObjectName `json:"Target,omitempty"`
SinceVersion ScalarExpression `json:"SinceVersion,omitempty"`
ForceSeek bool `json:"ForceSeek"`
Columns []*Identifier `json:"Columns,omitempty"`
Alias *Identifier `json:"Alias,omitempty"`
ForPath bool `json:"ForPath"`
}

func (c *ChangeTableChangesTableReference) node() {}
func (c *ChangeTableChangesTableReference) tableReference() {}

// ChangeTableVersionTableReference represents CHANGETABLE(VERSION ...) table reference
type ChangeTableVersionTableReference struct {
Target *SchemaObjectName `json:"Target,omitempty"`
PrimaryKeyColumns []*Identifier `json:"PrimaryKeyColumns,omitempty"`
PrimaryKeyValues []ScalarExpression `json:"PrimaryKeyValues,omitempty"`
ForceSeek bool `json:"ForceSeek"`
Columns []*Identifier `json:"Columns,omitempty"`
Alias *Identifier `json:"Alias,omitempty"`
ForPath bool `json:"ForPath"`
}

func (c *ChangeTableVersionTableReference) node() {}
func (c *ChangeTableVersionTableReference) tableReference() {}
60 changes: 60 additions & 0 deletions ast/create_simple_statements.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,33 @@ type CreateLoginStatement struct {
func (s *CreateLoginStatement) node() {}
func (s *CreateLoginStatement) statement() {}

// AlterLoginEnableDisableStatement represents ALTER LOGIN name ENABLE/DISABLE
type AlterLoginEnableDisableStatement struct {
Name *Identifier `json:"Name,omitempty"`
IsEnable bool `json:"IsEnable"`
}

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

// AlterLoginOptionsStatement represents ALTER LOGIN name WITH options
type AlterLoginOptionsStatement struct {
Name *Identifier `json:"Name,omitempty"`
Options []PrincipalOption `json:"Options,omitempty"`
}

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

// DropLoginStatement represents DROP LOGIN name
type DropLoginStatement struct {
Name *Identifier `json:"Name,omitempty"`
IsIfExists bool `json:"IsIfExists"`
}

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

// CreateLoginSource is an interface for login sources
type CreateLoginSource interface {
createLoginSource()
Expand All @@ -46,6 +73,39 @@ type ExternalCreateLoginSource struct {

func (s *ExternalCreateLoginSource) createLoginSource() {}

// PasswordCreateLoginSource represents WITH PASSWORD = '...' source
type PasswordCreateLoginSource struct {
Password ScalarExpression `json:"Password,omitempty"`
Hashed bool `json:"Hashed"`
MustChange bool `json:"MustChange"`
Options []PrincipalOption `json:"Options,omitempty"`
}

func (s *PasswordCreateLoginSource) createLoginSource() {}

// WindowsCreateLoginSource represents FROM WINDOWS source
type WindowsCreateLoginSource struct {
Options []PrincipalOption `json:"Options,omitempty"`
}

func (s *WindowsCreateLoginSource) createLoginSource() {}

// CertificateCreateLoginSource represents FROM CERTIFICATE source
type CertificateCreateLoginSource struct {
Certificate *Identifier `json:"Certificate,omitempty"`
Credential *Identifier `json:"Credential,omitempty"`
}

func (s *CertificateCreateLoginSource) createLoginSource() {}

// AsymmetricKeyCreateLoginSource represents FROM ASYMMETRIC KEY source
type AsymmetricKeyCreateLoginSource struct {
Key *Identifier `json:"Key,omitempty"`
Credential *Identifier `json:"Credential,omitempty"`
}

func (s *AsymmetricKeyCreateLoginSource) createLoginSource() {}

// PrincipalOption is an interface for principal options (SID, TYPE, etc.)
type PrincipalOption interface {
principalOptionNode()
Expand Down
24 changes: 21 additions & 3 deletions ast/create_user_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,23 @@ type IdentifierPrincipalOption struct {
func (o *IdentifierPrincipalOption) userOptionNode() {}
func (o *IdentifierPrincipalOption) principalOptionNode() {}

// OnOffPrincipalOption represents an ON/OFF principal option
type OnOffPrincipalOption struct {
OptionKind string
OptionState string // "On" or "Off"
}

func (o *OnOffPrincipalOption) userOptionNode() {}
func (o *OnOffPrincipalOption) principalOptionNode() {}

// PrincipalOptionSimple represents a simple principal option with just an option kind
type PrincipalOptionSimple struct {
OptionKind string
}

func (o *PrincipalOptionSimple) userOptionNode() {}
func (o *PrincipalOptionSimple) principalOptionNode() {}

// DefaultSchemaPrincipalOption represents a default schema option
type DefaultSchemaPrincipalOption struct {
OptionKind string
Expand All @@ -47,14 +64,15 @@ type DefaultSchemaPrincipalOption struct {

func (o *DefaultSchemaPrincipalOption) userOptionNode() {}

// PasswordAlterPrincipalOption represents a password option for ALTER USER
// PasswordAlterPrincipalOption represents a password option for ALTER USER/LOGIN
type PasswordAlterPrincipalOption struct {
Password *StringLiteral
Password ScalarExpression
OldPassword *StringLiteral
MustChange bool
Unlock bool
Hashed bool
OptionKind string
}

func (o *PasswordAlterPrincipalOption) userOptionNode() {}
func (o *PasswordAlterPrincipalOption) userOptionNode() {}
func (o *PasswordAlterPrincipalOption) principalOptionNode() {}
19 changes: 19 additions & 0 deletions ast/data_modification_table_reference.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package ast

// DataModificationTableReference represents a DML statement used as a table source in FROM clause
// This allows using INSERT/UPDATE/DELETE/MERGE with OUTPUT clause as table sources
type DataModificationTableReference struct {
DataModificationSpecification DataModificationSpecification
Alias *Identifier
Columns []*Identifier
ForPath bool
}

func (d *DataModificationTableReference) node() {}
func (d *DataModificationTableReference) tableReference() {}

// DataModificationSpecification is the interface for DML specifications
type DataModificationSpecification interface {
Node
dataModificationSpecification()
}
3 changes: 3 additions & 0 deletions ast/delete_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ type DeleteSpecification struct {
OutputClause *OutputClause `json:"OutputClause,omitempty"`
OutputIntoClause *OutputIntoClause `json:"OutputIntoClause,omitempty"`
}

func (d *DeleteSpecification) node() {}
func (d *DeleteSpecification) dataModificationSpecification() {}
122 changes: 122 additions & 0 deletions ast/drop_service_broker_statements.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
package ast

// DropPartitionFunctionStatement represents a DROP PARTITION FUNCTION statement
type DropPartitionFunctionStatement struct {
Name *Identifier `json:"Name,omitempty"`
IsIfExists bool `json:"IsIfExists"`
}

func (*DropPartitionFunctionStatement) statement() {}
func (*DropPartitionFunctionStatement) node() {}

// DropPartitionSchemeStatement represents a DROP PARTITION SCHEME statement
type DropPartitionSchemeStatement struct {
Name *Identifier `json:"Name,omitempty"`
IsIfExists bool `json:"IsIfExists"`
}

func (*DropPartitionSchemeStatement) statement() {}
func (*DropPartitionSchemeStatement) node() {}

// DropApplicationRoleStatement represents a DROP APPLICATION ROLE statement
type DropApplicationRoleStatement struct {
Name *Identifier `json:"Name,omitempty"`
IsIfExists bool `json:"IsIfExists"`
}

func (*DropApplicationRoleStatement) statement() {}
func (*DropApplicationRoleStatement) node() {}

// DropCertificateStatement represents a DROP CERTIFICATE statement
type DropCertificateStatement struct {
Name *Identifier `json:"Name,omitempty"`
IsIfExists bool `json:"IsIfExists"`
}

func (*DropCertificateStatement) statement() {}
func (*DropCertificateStatement) node() {}

// DropMasterKeyStatement represents a DROP MASTER KEY statement
type DropMasterKeyStatement struct{}

func (*DropMasterKeyStatement) statement() {}
func (*DropMasterKeyStatement) node() {}

// DropXmlSchemaCollectionStatement represents a DROP XML SCHEMA COLLECTION statement
type DropXmlSchemaCollectionStatement struct {
Name *SchemaObjectName `json:"Name,omitempty"`
}

func (*DropXmlSchemaCollectionStatement) statement() {}
func (*DropXmlSchemaCollectionStatement) node() {}

// DropContractStatement represents a DROP CONTRACT statement
type DropContractStatement struct {
Name *Identifier `json:"Name,omitempty"`
IsIfExists bool `json:"IsIfExists"`
}

func (*DropContractStatement) statement() {}
func (*DropContractStatement) node() {}

// DropEndpointStatement represents a DROP ENDPOINT statement
type DropEndpointStatement struct {
Name *Identifier `json:"Name,omitempty"`
IsIfExists bool `json:"IsIfExists"`
}

func (*DropEndpointStatement) statement() {}
func (*DropEndpointStatement) node() {}

// DropMessageTypeStatement represents a DROP MESSAGE TYPE statement
type DropMessageTypeStatement struct {
Name *Identifier `json:"Name,omitempty"`
IsIfExists bool `json:"IsIfExists"`
}

func (*DropMessageTypeStatement) statement() {}
func (*DropMessageTypeStatement) node() {}

// DropQueueStatement represents a DROP QUEUE statement
type DropQueueStatement struct {
Name *SchemaObjectName `json:"Name,omitempty"`
}

func (*DropQueueStatement) statement() {}
func (*DropQueueStatement) node() {}

// DropRemoteServiceBindingStatement represents a DROP REMOTE SERVICE BINDING statement
type DropRemoteServiceBindingStatement struct {
Name *Identifier `json:"Name,omitempty"`
IsIfExists bool `json:"IsIfExists"`
}

func (*DropRemoteServiceBindingStatement) statement() {}
func (*DropRemoteServiceBindingStatement) node() {}

// DropRouteStatement represents a DROP ROUTE statement
type DropRouteStatement struct {
Name *Identifier `json:"Name,omitempty"`
IsIfExists bool `json:"IsIfExists"`
}

func (*DropRouteStatement) statement() {}
func (*DropRouteStatement) node() {}

// DropServiceStatement represents a DROP SERVICE statement
type DropServiceStatement struct {
Name *Identifier `json:"Name,omitempty"`
IsIfExists bool `json:"IsIfExists"`
}

func (*DropServiceStatement) statement() {}
func (*DropServiceStatement) node() {}

// DropEventNotificationStatement represents a DROP EVENT NOTIFICATION statement
type DropEventNotificationStatement struct {
Notifications []*Identifier `json:"Notifications,omitempty"`
Scope *EventNotificationObjectScope `json:"Scope,omitempty"`
}

func (*DropEventNotificationStatement) statement() {}
func (*DropEventNotificationStatement) node() {}
12 changes: 10 additions & 2 deletions ast/drop_statements.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,22 @@ type DropIndexOption interface {

// OnlineIndexOption represents the ONLINE option
type OnlineIndexOption struct {
OptionState string // On, Off
OptionKind string // Online
LowPriorityLockWaitOption *OnlineIndexLowPriorityLockWaitOption // For ONLINE = ON (WAIT_AT_LOW_PRIORITY (...))
OptionState string // On, Off
OptionKind string // Online
}

func (o *OnlineIndexOption) node() {}
func (o *OnlineIndexOption) dropIndexOption() {}
func (o *OnlineIndexOption) indexOption() {}

// OnlineIndexLowPriorityLockWaitOption represents WAIT_AT_LOW_PRIORITY options for ONLINE = ON
type OnlineIndexLowPriorityLockWaitOption struct {
Options []LowPriorityLockWaitOption
}

func (o *OnlineIndexLowPriorityLockWaitOption) node() {}

// MoveToDropIndexOption represents the MOVE TO option
type MoveToDropIndexOption struct {
MoveTo *FileGroupOrPartitionScheme
Expand Down
3 changes: 2 additions & 1 deletion ast/fulltext_stoplist_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ func (s *DropFullTextStopListStatement) statement() {}

// DropFullTextCatalogStatement represents DROP FULLTEXT CATALOG statement
type DropFullTextCatalogStatement struct {
Name *Identifier `json:"Name,omitempty"`
Name *Identifier `json:"Name,omitempty"`
IsIfExists bool `json:"IsIfExists"`
}

func (s *DropFullTextCatalogStatement) node() {}
Expand Down
Loading
Loading