Skip to content
Merged
  •  
  •  
  •  
13 changes: 13 additions & 0 deletions ast/backup_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,16 @@ type BackupOption struct {
OptionKind string // Compression, NoCompression, StopOnError, ContinueAfterError, etc.
Value ScalarExpression
}

// BackupCertificateStatement represents a BACKUP CERTIFICATE statement
type BackupCertificateStatement struct {
Name *Identifier
File ScalarExpression
PrivateKeyPath ScalarExpression
EncryptionPassword ScalarExpression
DecryptionPassword ScalarExpression
ActiveForBeginDialog string // "NotSet", "Active", "Inactive"
}

func (s *BackupCertificateStatement) statement() {}
func (s *BackupCertificateStatement) node() {}
13 changes: 12 additions & 1 deletion ast/create_simple_statements.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,20 @@ type CreateFulltextIndexStatement struct {
func (s *CreateFulltextIndexStatement) node() {}
func (s *CreateFulltextIndexStatement) statement() {}

// PartitionParameterType represents the parameter type in a partition function.
type PartitionParameterType struct {
DataType *SqlDataTypeReference `json:"DataType,omitempty"`
Collation *Identifier `json:"Collation,omitempty"`
}

func (p *PartitionParameterType) node() {}

// CreatePartitionFunctionStatement represents a CREATE PARTITION FUNCTION statement.
type CreatePartitionFunctionStatement struct {
Name *Identifier `json:"Name,omitempty"`
Name *Identifier `json:"Name,omitempty"`
ParameterType *PartitionParameterType `json:"ParameterType,omitempty"`
Range string `json:"Range,omitempty"` // "Left" or "Right"
BoundaryValues []ScalarExpression `json:"BoundaryValues,omitempty"`
}

func (s *CreatePartitionFunctionStatement) node() {}
Expand Down
127 changes: 123 additions & 4 deletions ast/drop_statements.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ func (s *DropIndexStatement) node() {}

// DropIndexClause represents a single index to drop
type DropIndexClause struct {
Index *SchemaObjectName
// Could have additional options like ON table, WITH options
Index *SchemaObjectName // For backwards-compatible syntax: table.index
IndexName *Identifier // For new syntax: index ON table
Object *SchemaObjectName // Table name for ON clause syntax
}

// DropStatisticsStatement represents a DROP STATISTICS statement
Expand Down Expand Up @@ -98,9 +99,127 @@ func (s *DropRuleStatement) node() {}

// DropSchemaStatement represents a DROP SCHEMA statement
type DropSchemaStatement struct {
IsIfExists bool
Schema *SchemaObjectName
IsIfExists bool
Schema *SchemaObjectName
DropBehavior string // "None", "Cascade", "Restrict"
}

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

// DropSecurityPolicyStatement represents a DROP SECURITY POLICY statement
type DropSecurityPolicyStatement struct {
IsIfExists bool
Objects []*SchemaObjectName
}

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

// DropExternalDataSourceStatement represents a DROP EXTERNAL DATA SOURCE statement
type DropExternalDataSourceStatement struct {
IsIfExists bool
Name *Identifier
}

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

// DropExternalFileFormatStatement represents a DROP EXTERNAL FILE FORMAT statement
type DropExternalFileFormatStatement struct {
IsIfExists bool
Name *Identifier
}

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

// DropExternalTableStatement represents a DROP EXTERNAL TABLE statement
type DropExternalTableStatement struct {
IsIfExists bool
Objects []*SchemaObjectName
}

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

// DropExternalResourcePoolStatement represents a DROP EXTERNAL RESOURCE POOL statement
type DropExternalResourcePoolStatement struct {
IsIfExists bool
Name *Identifier
}

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

// DropWorkloadGroupStatement represents a DROP WORKLOAD GROUP statement
type DropWorkloadGroupStatement struct {
IsIfExists bool
Name *Identifier
}

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

// DropWorkloadClassifierStatement represents a DROP WORKLOAD CLASSIFIER statement
type DropWorkloadClassifierStatement struct {
IsIfExists bool
Name *Identifier
}

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

// DropTypeStatement represents a DROP TYPE statement
type DropTypeStatement struct {
IsIfExists bool
Name *SchemaObjectName
}

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

// DropAggregateStatement represents a DROP AGGREGATE statement
type DropAggregateStatement struct {
IsIfExists bool
Objects []*SchemaObjectName
}

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

// DropSynonymStatement represents a DROP SYNONYM statement
type DropSynonymStatement struct {
IsIfExists bool
Objects []*SchemaObjectName
}

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

// DropUserStatement represents a DROP USER statement
type DropUserStatement struct {
IsIfExists bool
Name *Identifier
}

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

// DropRoleStatement represents a DROP ROLE statement
type DropRoleStatement struct {
IsIfExists bool
Name *Identifier
}

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

// DropAssemblyStatement represents a DROP ASSEMBLY statement
type DropAssemblyStatement struct {
IsIfExists bool
Objects []*SchemaObjectName
}

func (s *DropAssemblyStatement) statement() {}
func (s *DropAssemblyStatement) node() {}
21 changes: 15 additions & 6 deletions ast/set_variable_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,26 @@ 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"`
FunctionCallExists bool `json:"FunctionCallExists,omitempty"`
}

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

// CursorDefinition represents a cursor definition.
type CursorDefinition struct {
Select QueryExpression `json:"Select,omitempty"`
Options []*CursorOption `json:"Options,omitempty"`
Select QueryExpression `json:"Select,omitempty"`
}

// CursorOption represents a cursor option like SCROLL or DYNAMIC.
type CursorOption struct {
OptionKind string `json:"OptionKind,omitempty"`
}

func (o *CursorOption) node() {}
Loading
Loading