Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 17 additions & 0 deletions ast/alter_server_configuration_statement.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
package ast

// AlterServerConfigurationStatement represents ALTER SERVER CONFIGURATION SET PROCESS AFFINITY statement
type AlterServerConfigurationStatement struct {
ProcessAffinity string // "CpuAuto", "Cpu", "NumaNode"
ProcessAffinityRanges []*ProcessAffinityRange // for Cpu or NumaNode
}

func (a *AlterServerConfigurationStatement) node() {}
func (a *AlterServerConfigurationStatement) statement() {}

// ProcessAffinityRange represents a CPU or NUMA node range
type ProcessAffinityRange struct {
From ScalarExpression // IntegerLiteral
To ScalarExpression // IntegerLiteral (optional)
}

func (p *ProcessAffinityRange) node() {}

// AlterServerConfigurationSetSoftNumaStatement represents ALTER SERVER CONFIGURATION SET SOFTNUMA statement
type AlterServerConfigurationSetSoftNumaStatement struct {
Options []*AlterServerConfigurationSoftNumaOption
Expand Down
49 changes: 44 additions & 5 deletions ast/create_table_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ type TableConstraint interface {

// IndexDefinition represents an index definition within CREATE TABLE
type IndexDefinition struct {
Name *Identifier
Columns []*ColumnWithSortOrder
Unique bool
IndexType *IndexType
IndexOptions []*IndexExpressionOption
Name *Identifier
Columns []*ColumnWithSortOrder
Unique bool
IndexType *IndexType
IndexOptions []*IndexExpressionOption
IncludeColumns []*ColumnReferenceExpression
}

func (i *IndexDefinition) node() {}
Expand All @@ -108,3 +109,41 @@ const (
SortOrderAscending
SortOrderDescending
)

// CheckConstraintDefinition represents a CHECK constraint
type CheckConstraintDefinition struct {
ConstraintIdentifier *Identifier
CheckCondition BooleanExpression
NotForReplication bool
}

func (c *CheckConstraintDefinition) node() {}
func (c *CheckConstraintDefinition) tableConstraint() {}
func (c *CheckConstraintDefinition) constraintDefinition() {}

// UniqueConstraintDefinition represents a UNIQUE or PRIMARY KEY constraint
type UniqueConstraintDefinition struct {
ConstraintIdentifier *Identifier
Clustered bool
IsPrimaryKey bool
Columns []*ColumnWithSortOrder
IndexType *IndexType
}

func (u *UniqueConstraintDefinition) node() {}
func (u *UniqueConstraintDefinition) tableConstraint() {}
func (u *UniqueConstraintDefinition) constraintDefinition() {}

// ForeignKeyConstraintDefinition represents a FOREIGN KEY constraint
type ForeignKeyConstraintDefinition struct {
ConstraintIdentifier *Identifier
Columns []*Identifier
ReferenceTableName *SchemaObjectName
ReferencedColumns []*Identifier
DeleteAction string
UpdateAction string
NotForReplication bool
}

func (f *ForeignKeyConstraintDefinition) node() {}
func (f *ForeignKeyConstraintDefinition) tableConstraint() {}
17 changes: 17 additions & 0 deletions ast/declare_variable_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@ type DeclareVariableElement struct {
Nullable *NullableConstraintDefinition `json:"Nullable,omitempty"`
}

// DeclareTableVariableStatement represents a DECLARE @var TABLE statement.
type DeclareTableVariableStatement struct {
Body *DeclareTableVariableBody `json:"Body,omitempty"`
}

func (d *DeclareTableVariableStatement) node() {}
func (d *DeclareTableVariableStatement) statement() {}

// DeclareTableVariableBody represents the body of a table variable declaration.
type DeclareTableVariableBody struct {
VariableName *Identifier `json:"VariableName,omitempty"`
AsDefined bool `json:"AsDefined,omitempty"`
Definition *TableDefinition `json:"Definition,omitempty"`
}

func (d *DeclareTableVariableBody) node() {}

// SqlDataTypeReference represents a SQL data type.
type SqlDataTypeReference struct {
SqlDataTypeOption string `json:"SqlDataTypeOption,omitempty"`
Expand Down
9 changes: 9 additions & 0 deletions ast/drop_statements.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@ type DropExternalResourcePoolStatement struct {
func (s *DropExternalResourcePoolStatement) statement() {}
func (s *DropExternalResourcePoolStatement) node() {}

// DropExternalModelStatement represents a DROP EXTERNAL MODEL statement
type DropExternalModelStatement struct {
IsIfExists bool
Name *SchemaObjectName
}

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

// DropWorkloadGroupStatement represents a DROP WORKLOAD GROUP statement
type DropWorkloadGroupStatement struct {
IsIfExists bool
Expand Down
12 changes: 7 additions & 5 deletions ast/set_variable_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package ast

// SetVariableStatement represents a SET @var = value statement.
type SetVariableStatement struct {
Variable *VariableReference `json:"Variable,omitempty"`
Expression ScalarExpression `json:"Expression,omitempty"`
CursorDefinition *CursorDefinition `json:"CursorDefinition,omitempty"`
AssignmentKind string `json:"AssignmentKind,omitempty"`
SeparatorType string `json:"SeparatorType,omitempty"`
Variable *VariableReference `json:"Variable,omitempty"`
Expression ScalarExpression `json:"Expression,omitempty"`
CursorDefinition *CursorDefinition `json:"CursorDefinition,omitempty"`
AssignmentKind string `json:"AssignmentKind,omitempty"`
SeparatorType string `json:"SeparatorType,omitempty"`
Identifier *Identifier `json:"Identifier,omitempty"`
FunctionCallExists bool `json:"FunctionCallExists,omitempty"`
Parameters []ScalarExpression `json:"Parameters,omitempty"`
}

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