Skip to content

Commit 6872611

Browse files
kyleconroyclaude
andauthored
Enable PhaseOne_AlterDatabaseModifyFileStatementTest (#59)
* Enable PhaseOne_AlterDatabaseModifyFileStatementTest Fix inconsistent ast.json by adding UseCurrent: false to match other AlterDatabaseModifyFileStatement tests in the codebase. * Enable PhaseOne_AlterDatabaseRemoveFileStatementTest Fix inconsistent ast.json by adding UseCurrent: false to match other AlterDatabaseRemoveFileStatement tests in the codebase. * Enable PhaseOne_AlterDatabaseModifyNameStatementTest Fix inconsistent ast.json by adding UseCurrent: false to match other AlterDatabaseModifyNameStatement tests in the codebase. * Enable PhaseOne_AlterDatabaseModifyFilegroup3StatementTest Fix inconsistent ast.json by adding UpdatabilityOption: None to match other AlterDatabaseModifyFileGroupStatement tests in the codebase. * Enable PhaseOne_AlterDatabaseModifyFilegroup2StatementTest Fix inconsistent ast.json by adding UpdatabilityOption: None to match other AlterDatabaseModifyFileGroupStatement tests in the codebase. * Add FullTextPredicate and ExistsPredicate support Implements parsing for: - CONTAINS (column/PROPERTY, value) predicate - FREETEXT (column, value) predicate - EXISTS (subquery) predicate These are used in WHERE clauses for full-text search and subquery existence checks. * Add IIfCall, ParseCall, and TryParseCall support Implements parsing for: - IIF(condition, true_value, false_value) function - PARSE(string AS type [USING culture]) function - TRY_PARSE(string AS type [USING culture]) function These are SQL Server 2012+ functions for conditional expressions and culture-aware parsing. * Enable PhaseOne_CreateFulltextCatalog test Fix inconsistent ast.json by using CreateFullTextCatalogStatement with IsDefault: false to match other CreateFullTextCatalog tests. Also update metadata.json from invalid_syntax to enabled. * Enable Baselines110_ExpressionTests110 and ExpressionTests110 Fix FullTextPredicate to use PascalCase for FullTextFunctionType: - "CONTAINS" -> "Contains" - "FREETEXT" -> "FreeText" This enables the expression tests that test CONTAINS, FREETEXT, IIF, PARSE, TRY_PARSE, and other SQL Server 2012+ expressions. * Add NULL/NOT NULL support for function parameters and fix option naming - Add parsing for NULL/NOT NULL nullability in function parameters - Fix NativeCompilation and SchemaBinding option naming in parseFunctionOptions - Enables NativelyCompiledScalarUDFTests130 tests * Add support for CREATE FUNCTION parsing features - Add @varname support for multi-statement table-valued function return types - Add column constraint parsing (PRIMARY KEY, NOT NULL, NULL) in table definitions - Add multi-statement table-valued function body parsing - Handle parenthesized WITH XMLNAMESPACES in SELECT statements - Enables CreateFunctionStatementTests90 and FunctionStatementTests tests * Add support for select element alias styles - Add string literal alias without AS (e.g., expr 'alias') - Add national string literal alias without AS (e.g., expr N'alias') - Add equals-style alias (e.g., column1 = expr, [column1] = expr, 'alias' = expr) - Enables SelectExpressionTests * Add columnstore index, WHERE clause, and COMPRESSION_DELAY support - Add COLUMNSTORE keyword support to parseInlineIndexDefinition (CLUSTERED COLUMNSTORE, NONCLUSTERED COLUMNSTORE, implicit COLUMNSTORE) - Add WHERE clause parsing for filtered indexes in inline index definitions - Add COMPRESSION_DELAY option parsing with time units (Unitless, Minute, Minutes) - Add FilterPredicate field to IndexDefinition struct Enables ColumnStoreInlineIndex130 test. * Add UNIQUE inline index and DURABILITY table option support - Enhance column-level INDEX parsing to handle UNIQUE keyword - Add HASH keyword support after CLUSTERED/NONCLUSTERED in column INDEX - Add WITH clause parsing with BUCKET_COUNT option for column INDEX - Add DurabilityTableOption AST type for DURABILITY table option - Add DURABILITY table option parsing (SchemaOnly, SchemaAndData) - Add DurabilityTableOption marshaling Enables Baselines130_UniqueInlineIndex130 test. * Add ALTER TABLE REBUILD, CHANGE_TRACKING, and enhanced ALTER COLUMN support - Add AlterTableRebuildStatement with PARTITION and IndexOptions support - Add AlterTableChangeTrackingModificationStatement for ENABLE/DISABLE CHANGE_TRACKING - Add LockEscalationTableOption and FileStreamOnTableOption for ALTER TABLE SET - Enhance ALTER COLUMN to support ADD/DROP SPARSE options - Add SPARSE, FILESTREAM, and COLUMN_SET FOR ALL_SPARSE_COLUMNS parsing - Add StorageOptions field to AlterTableAlterColumnStatement - Add marshaling for all new statement types and table options * Fix XML data type parsing in ALTER TABLE ALTER COLUMN Use parseDataTypeReference() instead of parseDataType() to correctly handle XmlDataTypeReference. The parseDataType() wrapper was discarding non-SqlDataTypeReference types and returning an empty SqlDataTypeReference. Enables Baselines100_AlterTableStatementTests100 test. * Add CREATE INDEX WHERE clause and DATA_COMPRESSION support (#59) - Add FilterPredicate and FileStreamOn fields to CreateIndexStatement - Add DATA_COMPRESSION option with ON PARTITIONS support to parseCreateIndexOptions - Add pseudo column handling ($ACTION, $IDENTITY, $ROWGUID, $CUID) in parsePrimaryExpression - Add JSON marshaling for FilterPredicate and FileStreamOn - Enable CreateIndexStatementTests100 and Baselines100_CreateIndexStatementTests100 * Add function parameter default values and EXECUTE AS parsing (#60) - Add default value parsing (=value) for function parameters - Add EXECUTE AS (SELF/OWNER/CALLER/String) option parsing for CREATE OR ALTER FUNCTION - Fix SCHEMABINDING option capitalization to SchemaBinding - Enable ScalarFunctionTestsFabricDW and BaselinesFabricDW_ScalarFunctionTestsFabricDW * Add inline index HASH, ON filegroup, and FILESTREAM_ON support - Add standalone HASH keyword parsing for inline indexes (treated as NonClusteredHash) - Add OnFileGroupOrPartitionScheme and FileStreamOn fields to IndexDefinition AST - Add JSON marshaling for these fields in indexDefinitionToJSON - Comprehensive inline index options parsing including PAD_INDEX, FILLFACTOR, IGNORE_DUP_KEY, STATISTICS_NORECOMPUTE, ALLOW_ROW_LOCKS, ALLOW_PAGE_LOCKS, BUCKET_COUNT, DATA_COMPRESSION with ON PARTITIONS Fixes ColumnDefinitionTests120 and Baselines120_ColumnDefinitionTests120 * Add CREATE/ALTER SERVER/DATABASE AUDIT SPECIFICATION parsing - Add AST types for audit specification statements: - CreateServerAuditSpecificationStatement - AlterServerAuditSpecificationStatement - CreateDatabaseAuditSpecificationStatement - AlterDatabaseAuditSpecificationStatement - AuditSpecificationPart - AuditActionGroupReference - Add parsing for SPECIFICATION keyword after SERVER AUDIT and DATABASE AUDIT - Add FOR SERVER AUDIT, ADD/DROP parts, and WITH STATE parsing - Add convertAuditGroupName helper for mapping audit group names - Add JSON marshaling for all new types Fixes AuditSpecificationStatementTests110 and Baselines110_AuditSpecificationStatementTests110 * Add support for CREATE EXTERNAL TABLE ... AS SELECT (CTAS) - Add SelectStatement field to CreateExternalTableStatement for CTAS syntax - Add ExternalTableOptionItem interface for polymorphic option handling - Add ExternalTableRejectTypeOption for REJECT_TYPE option parsing - Add parsing for REJECT_TYPE, REJECT_VALUE, REJECT_SAMPLE_VALUE options - Add AS SELECT clause parsing in external table statements * Add support for DROP RESOURCE POOL statement - Add DropResourcePoolStatement AST type - Add parsing for DROP RESOURCE POOL in parseDropStatement - Add JSON marshaling for DropResourcePoolStatement * Add Column and WithValues fields to DefaultConstraintDefinition Partial progress toward ALTER TABLE ADD statement improvements: - Add Column field for table-level DEFAULT constraints (DEFAULT ... FOR column) - Add WithValues field for DEFAULT with WITH VALUES clause - Add tableConstraint() method to DefaultConstraintDefinition - Update WITH VALUES parsing in column DEFAULT handling - Update defaultConstraintToJSON marshaling * Add ALTER VIEW support and fix double-quoted identifiers - Add AlterViewStatement AST type with IsRebuild, IsDisable, IsMaterialized fields - Add ALTER VIEW parsing in parseAlterStatement (parse_ddl.go) - Add alterViewStatementToJSON marshaling function - Fix view options parsing to handle keyword tokens (ENCRYPTION) - Map view options to proper OptionKind values (Encryption, SchemaBinding, ViewMetadata) - Add WITH CHECK OPTION parsing after SELECT statement - Fix table hint parsing to only consume WITH when followed by ( - Fix double-quoted identifier handling in parseColumnReferenceOrFunctionCall This enables ViewStatementTests, Baselines80_ViewStatementTests, and Baselines90_ViewStatementTests. * Add partial support for ALTER TABLE ADD multiple elements - Add loop for comma-separated elements in parseAlterTableAddStatement - Add table-level CHECK constraint parsing without CONSTRAINT keyword - Handle WITH CHECK/NOCHECK ADD statements properly - Add ON DELETE/UPDATE actions for FOREIGN KEY constraints - Add NOT FOR REPLICATION parsing for foreign keys - Add ON filegroup parsing for PRIMARY KEY and UNIQUE constraints Baselines90_AlterTableAddTableElementStatementTests still needs: - DEFAULT ... FOR column with WITH VALUES - COLLATE for columns - Computed column expressions (AS ... UNIQUE) - Additional constraint parsing features * Add support for ALTER TABLE ADD CONSTRAINT with DEFAULT and CHECK - Add DEFAULT and CHECK cases to CONSTRAINT parsing in parseAlterTableAddStatement - Add DefaultConstraintDefinition case to tableConstraintToJSON marshaling - Remove hasColumnsFK requirement for FOREIGN KEY (columns are optional) - Handle incomplete DEFAULT constraints gracefully - Enables Baselines90_AlterTableAddTableElementStatementTests * Add partial support for GRANT/REVOKE/DENY column list parsing - Add Columns field to SecurityTargetObject for column-level permissions - Fix object name parsing to handle ..name syntax without :: - Add column list parsing after object name in GRANT/REVOKE/DENY - Update securityTargetObjectToJSON to marshal Columns field * Add full GRANT/REVOKE/DENY security statement support - Add AsClause field to GrantStatement for AS identifier clause - Add TokenAll, TokenDefault, TokenTrigger, TokenSchema to permission parsing - Add column list parsing for permissions (e.g., SELECT (c1, c2)) - Synchronize permission token handling across GRANT, REVOKE, DENY parsers - Update grantStatementToJSON to marshal AsClause field - Enables 3 tests: SecurityStatement80Tests, Baselines80_*, Baselines90_* * Add support for WITH index options without parentheses - Handle WITH FILLFACTOR = 25 syntax (no parentheses) - Parse index options until ON (filegroup) keyword is encountered - Applies to both UNIQUE and PRIMARY KEY constraints - Enables 2 tests: AlterTableAddTableElementStatementTests, Baselines80_* * Add ALTER DATABASE SET termination clause and cursor options support Add parsing for: - Termination clause (WITH NO_WAIT, WITH ROLLBACK AFTER N, WITH ROLLBACK IMMEDIATE) - CURSOR_CLOSE_ON_COMMIT ON/OFF option - CURSOR_DEFAULT LOCAL/GLOBAL option - RecoveryDatabaseOption for RECOVERY FULL/BULK_LOGGED/SIMPLE - Fix capitalization for ArithAbort and NumericRoundAbort option kinds * Add ALTER EXTERNAL RESOURCE POOL statement support Add parsing for: - MAX_CPU_PERCENT, MAX_MEMORY_PERCENT, MAX_PROCESSES parameters - AFFINITY CPU/NUMANODE with AUTO or range specifications * Add IF EXISTS support for DROP SEQUENCE and ALTER TABLE DROP Add IF EXISTS parsing for: - DROP SEQUENCE IF EXISTS - ALTER TABLE DROP CONSTRAINT IF EXISTS - ALTER TABLE DROP COLUMN IF EXISTS Also add WithNoDependents field to DropAssemblyStatement * Add CREATE AVAILABILITY GROUP statement support - Add CreateAvailabilityGroupStatement AST type with full replica parsing - Support REQUIRED_COPIES_TO_COMMIT option - Parse replica options: AVAILABILITY_MODE, FAILOVER_MODE, ENDPOINT_URL, SESSION_TIMEOUT, APPLY_DELAY - Parse role-based options: PRIMARY_ROLE and SECONDARY_ROLE with ALLOW_CONNECTIONS - Add marshaling functions for all new types - Enable 2 passing tests * Add BACKUP ENCRYPTION option support - Add BackupEncryptionOption and BackupOptionBase interface - Support ENCRYPTION(ALGORITHM = ..., SERVER CERTIFICATE|ASYMMETRIC KEY = ...) - Reuse existing CryptoMechanism type - Add Stats option kind capitalization - Enable 1 passing test * Add IS [NOT] DISTINCT FROM SOME/ANY/ALL (subquery) support - Add SubqueryComparisonPredicate AST type for subquery comparisons - Parse SOME/ANY/ALL with subqueries after IS [NOT] DISTINCT FROM - Add marshaling for SubqueryComparisonPredicate - Enable 2 passing tests * Add ALTER TABLE ALTER COLUMN HIDDEN and encryption support - Support ADD HIDDEN and DROP HIDDEN column options - Parse HIDDEN modifier in column definitions - Add ColumnEncryptionDefinition and related parameter types - Parse ENCRYPTED WITH (...) specifications - Parse MASKED WITH (FUNCTION = ...) specifications - Add MaskingFunction and Encryption fields to AlterTableAlterColumnStatement - Add marshaling for encryption parameter types - Enable 2 passing tests * Add Azure CREATE/ALTER DATABASE options support - Add SERVICE_OBJECTIVE option parsing for Azure databases - Add ElasticPoolSpecification AST type for elastic pool syntax - Parse ELASTIC_POOL(NAME = poolname) syntax - Support options after AS COPY OF clause - Add marshaling for ElasticPoolSpecification - Enable 2 passing tests * Add REMOTE_DATA_ARCHIVE table option parsing for CREATE/ALTER TABLE Support for: - REMOTE_DATA_ARCHIVE = ON/OFF/OFF_WITHOUT_DATA_RECOVERY - MIGRATION_STATE = PAUSED/OUTBOUND/INBOUND - FILTER_PREDICATE = NULL or function call * Add RETENTION_DAYS and EXTERNAL_MONITOR support for server audit - Add RetentionDaysAuditTargetOption AST type - Fix EXTERNAL_MONITOR target kind to return "ExternalMonitor" - Add URL target kind support * Add full ALTER PROCEDURE and BEGIN ATOMIC block support - Add Options field to AlterProcedureStatement for WITH clause - Add NATIVE_COMPILATION and SCHEMABINDING procedure option parsing - Fix BEGIN ATOMIC block to handle multi-word isolation levels - Add OnOffAtomicBlockOption for DELAYED_DURABILITY - Fix DATEFIRST (IntegerLiteral) and DATEFORMAT (StringLiteral) types * Add comprehensive ALTER DATABASE SET option support - Add PageVerifyDatabaseOption, PartnerDatabaseOption, WitnessDatabaseOption - Add ParameterizationDatabaseOption, GenericDatabaseOption AST types - Add parsing for EMERGENCY, PAGE_VERIFY, PARTNER, WITNESS, PARAMETERIZATION - Add broker options (ENABLE_BROKER, DISABLE_BROKER, etc.) - Fix DB_CHAINING capitalization to DBChaining * Add FOREIGN KEY constraint ON DELETE/UPDATE and NOT FOR REPLICATION support - Add ON DELETE/UPDATE action parsing (CASCADE, NO ACTION, SET NULL, SET DEFAULT) - Add NOT FOR REPLICATION parsing - Add parseForeignKeyAction helper function * Add AUTHORIZATION support for CREATE ASYMMETRIC KEY statements * Add ALTER DATABASE REBUILD LOG, AS SNAPSHOT OF, and additional database options * Add inline index options parsing for DATA_COMPRESSION, PAD_INDEX, FILLFACTOR, etc. --------- Co-authored-by: Claude <[email protected]>
1 parent e5e310d commit 6872611

File tree

107 files changed

+5252
-392
lines changed

Some content is hidden

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

107 files changed

+5252
-392
lines changed

ast/alter_database_set_statement.go

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,18 @@ type AlterDatabaseSetStatement struct {
66
UseCurrent bool
77
WithManualCutover bool
88
Options []DatabaseOption
9+
Termination *AlterDatabaseTermination
910
}
1011

12+
// AlterDatabaseTermination represents the termination clause (WITH NO_WAIT, WITH ROLLBACK AFTER N, WITH ROLLBACK IMMEDIATE)
13+
type AlterDatabaseTermination struct {
14+
NoWait bool
15+
ImmediateRollback bool
16+
RollbackAfter ScalarExpression
17+
}
18+
19+
func (a *AlterDatabaseTermination) node() {}
20+
1121
func (a *AlterDatabaseSetStatement) node() {}
1222
func (a *AlterDatabaseSetStatement) statement() {}
1323

@@ -82,6 +92,7 @@ type SimpleDatabaseOption struct {
8292

8393
func (d *SimpleDatabaseOption) node() {}
8494
func (d *SimpleDatabaseOption) createDatabaseOption() {}
95+
func (d *SimpleDatabaseOption) databaseOption() {}
8596

8697
// MaxSizeDatabaseOption represents a MAXSIZE option.
8798
type MaxSizeDatabaseOption struct {
@@ -104,6 +115,16 @@ func (l *LiteralDatabaseOption) node() {}
104115
func (l *LiteralDatabaseOption) databaseOption() {}
105116
func (l *LiteralDatabaseOption) createDatabaseOption() {}
106117

118+
// ElasticPoolSpecification represents SERVICE_OBJECTIVE = ELASTIC_POOL(name = poolname)
119+
type ElasticPoolSpecification struct {
120+
ElasticPoolName *Identifier
121+
OptionKind string // "ServiceObjective"
122+
}
123+
124+
func (e *ElasticPoolSpecification) node() {}
125+
func (e *ElasticPoolSpecification) databaseOption() {}
126+
func (e *ElasticPoolSpecification) createDatabaseOption() {}
127+
107128
// AlterDatabaseAddFileStatement represents ALTER DATABASE ... ADD FILE statement
108129
type AlterDatabaseAddFileStatement struct {
109130
DatabaseName *Identifier
@@ -145,11 +166,23 @@ type AlterDatabaseModifyFileGroupStatement struct {
145166
MakeDefault bool
146167
UpdatabilityOption string // "ReadOnly", "ReadWrite", "ReadOnlyOld", "ReadWriteOld", or ""
147168
NewFileGroupName *Identifier
169+
Termination *AlterDatabaseTermination
170+
UseCurrent bool
148171
}
149172

150173
func (a *AlterDatabaseModifyFileGroupStatement) node() {}
151174
func (a *AlterDatabaseModifyFileGroupStatement) statement() {}
152175

176+
// AlterDatabaseRebuildLogStatement represents ALTER DATABASE ... REBUILD LOG statement
177+
type AlterDatabaseRebuildLogStatement struct {
178+
DatabaseName *Identifier
179+
FileDeclaration *FileDeclaration
180+
UseCurrent bool
181+
}
182+
183+
func (a *AlterDatabaseRebuildLogStatement) node() {}
184+
func (a *AlterDatabaseRebuildLogStatement) statement() {}
185+
153186
// AlterDatabaseModifyNameStatement represents ALTER DATABASE ... MODIFY NAME statement
154187
type AlterDatabaseModifyNameStatement struct {
155188
DatabaseName *Identifier
@@ -279,3 +312,68 @@ type ChangeRetentionChangeTrackingOptionDetail struct {
279312

280313
func (c *ChangeRetentionChangeTrackingOptionDetail) node() {}
281314
func (c *ChangeRetentionChangeTrackingOptionDetail) changeTrackingOptionDetail() {}
315+
316+
// RecoveryDatabaseOption represents RECOVERY database option
317+
type RecoveryDatabaseOption struct {
318+
OptionKind string // "Recovery"
319+
Value string // "Full", "BulkLogged", "Simple"
320+
}
321+
322+
func (r *RecoveryDatabaseOption) node() {}
323+
func (r *RecoveryDatabaseOption) databaseOption() {}
324+
325+
// CursorDefaultDatabaseOption represents CURSOR_DEFAULT database option
326+
type CursorDefaultDatabaseOption struct {
327+
OptionKind string // "CursorDefault"
328+
IsLocal bool // true for LOCAL, false for GLOBAL
329+
}
330+
331+
func (c *CursorDefaultDatabaseOption) node() {}
332+
func (c *CursorDefaultDatabaseOption) databaseOption() {}
333+
334+
// PageVerifyDatabaseOption represents PAGE_VERIFY database option
335+
type PageVerifyDatabaseOption struct {
336+
OptionKind string // "PageVerify"
337+
Value string // "Checksum", "None", "TornPageDetection"
338+
}
339+
340+
func (p *PageVerifyDatabaseOption) node() {}
341+
func (p *PageVerifyDatabaseOption) databaseOption() {}
342+
343+
// PartnerDatabaseOption represents PARTNER database mirroring option
344+
type PartnerDatabaseOption struct {
345+
OptionKind string // "Partner"
346+
PartnerServer ScalarExpression // For PARTNER = 'server'
347+
PartnerOption string // "PartnerServer", "Failover", "ForceServiceAllowDataLoss", "Resume", "SafetyFull", "SafetyOff", "Suspend", "Timeout"
348+
Timeout ScalarExpression // For PARTNER TIMEOUT value
349+
}
350+
351+
func (p *PartnerDatabaseOption) node() {}
352+
func (p *PartnerDatabaseOption) databaseOption() {}
353+
354+
// WitnessDatabaseOption represents WITNESS database mirroring option
355+
type WitnessDatabaseOption struct {
356+
OptionKind string // "Witness"
357+
WitnessServer ScalarExpression // For WITNESS = 'server'
358+
IsOff bool // For WITNESS OFF
359+
}
360+
361+
func (w *WitnessDatabaseOption) node() {}
362+
func (w *WitnessDatabaseOption) databaseOption() {}
363+
364+
// ParameterizationDatabaseOption represents PARAMETERIZATION database option
365+
type ParameterizationDatabaseOption struct {
366+
OptionKind string // "Parameterization"
367+
IsSimple bool // true for SIMPLE, false for FORCED
368+
}
369+
370+
func (p *ParameterizationDatabaseOption) node() {}
371+
func (p *ParameterizationDatabaseOption) databaseOption() {}
372+
373+
// GenericDatabaseOption represents a simple database option with just OptionKind
374+
type GenericDatabaseOption struct {
375+
OptionKind string // e.g., "Emergency", "ErrorBrokerConversations", "EnableBroker", etc.
376+
}
377+
378+
func (g *GenericDatabaseOption) node() {}
379+
func (g *GenericDatabaseOption) databaseOption() {}

ast/alter_procedure_statement.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package ast
44
type AlterProcedureStatement struct {
55
ProcedureReference *ProcedureReference
66
Parameters []*ProcedureParameter
7+
Options []ProcedureOptionBase
78
StatementList *StatementList
89
IsForReplication bool
910
}

ast/alter_table_alter_column_statement.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ type AlterTableAlterColumnStatement struct {
55
SchemaObjectName *SchemaObjectName
66
ColumnIdentifier *Identifier
77
DataType DataTypeReference
8-
AlterTableAlterColumnOption string // "NoOptionDefined", "AddRowGuidCol", "DropRowGuidCol", "Null", "NotNull", etc.
8+
AlterTableAlterColumnOption string // "NoOptionDefined", "AddRowGuidCol", "DropRowGuidCol", "Null", "NotNull", "AddSparse", "DropSparse", etc.
9+
StorageOptions *ColumnStorageOptions
910
IsHidden bool
1011
Collation *Identifier
1112
IsMasked bool
13+
Encryption *ColumnEncryptionDefinition
14+
MaskingFunction ScalarExpression
1215
}
1316

1417
func (a *AlterTableAlterColumnStatement) node() {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package ast
2+
3+
// AlterTableChangeTrackingModificationStatement represents ALTER TABLE ... ENABLE/DISABLE CHANGE_TRACKING
4+
type AlterTableChangeTrackingModificationStatement struct {
5+
SchemaObjectName *SchemaObjectName
6+
IsEnable bool // true for ENABLE, false for DISABLE
7+
TrackColumnsUpdated string // "NotSet", "On", "Off"
8+
}
9+
10+
func (s *AlterTableChangeTrackingModificationStatement) node() {}
11+
func (s *AlterTableChangeTrackingModificationStatement) statement() {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package ast
2+
3+
// AlterTableRebuildStatement represents ALTER TABLE ... REBUILD statement
4+
type AlterTableRebuildStatement struct {
5+
SchemaObjectName *SchemaObjectName
6+
Partition *PartitionSpecifier
7+
IndexOptions []IndexOption
8+
}
9+
10+
func (s *AlterTableRebuildStatement) node() {}
11+
func (s *AlterTableRebuildStatement) statement() {}

ast/alter_table_set_statement.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,30 @@ type MemoryOptimizedTableOption struct {
4444

4545
func (o *MemoryOptimizedTableOption) tableOption() {}
4646
func (o *MemoryOptimizedTableOption) node() {}
47+
48+
// DurabilityTableOption represents a DURABILITY table option
49+
type DurabilityTableOption struct {
50+
OptionKind string // "Durability"
51+
DurabilityTableOptionKind string // "SchemaOnly", "SchemaAndData"
52+
}
53+
54+
func (o *DurabilityTableOption) tableOption() {}
55+
func (o *DurabilityTableOption) node() {}
56+
57+
// LockEscalationTableOption represents LOCK_ESCALATION option
58+
type LockEscalationTableOption struct {
59+
OptionKind string // "LockEscalation"
60+
Value string // "Auto", "Table", "Disable"
61+
}
62+
63+
func (o *LockEscalationTableOption) tableOption() {}
64+
func (o *LockEscalationTableOption) node() {}
65+
66+
// FileStreamOnTableOption represents FILESTREAM_ON option
67+
type FileStreamOnTableOption struct {
68+
OptionKind string // "FileStreamOn"
69+
Value *IdentifierOrValueExpression
70+
}
71+
72+
func (o *FileStreamOnTableOption) tableOption() {}
73+
func (o *FileStreamOnTableOption) node() {}

ast/backup_statement.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type BackupDatabaseStatement struct {
66
DatabaseName *IdentifierOrValueExpression
77
MirrorToClauses []*MirrorToClause
88
Devices []*DeviceInfo
9-
Options []*BackupOption
9+
Options []BackupOptionBase
1010
}
1111

1212
// MirrorToClause represents a MIRROR TO clause in a BACKUP statement
@@ -22,19 +22,37 @@ func (s *BackupDatabaseStatement) node() {}
2222
type BackupTransactionLogStatement struct {
2323
DatabaseName *IdentifierOrValueExpression
2424
Devices []*DeviceInfo
25-
Options []*BackupOption
25+
Options []BackupOptionBase
2626
}
2727

2828
func (s *BackupTransactionLogStatement) statementNode() {}
2929
func (s *BackupTransactionLogStatement) statement() {}
3030
func (s *BackupTransactionLogStatement) node() {}
3131

32+
// BackupOptionBase is an interface for backup options
33+
type BackupOptionBase interface {
34+
backupOption()
35+
}
36+
3237
// BackupOption represents a backup option
3338
type BackupOption struct {
3439
OptionKind string // Compression, NoCompression, StopOnError, ContinueAfterError, etc.
3540
Value ScalarExpression
3641
}
3742

43+
func (o *BackupOption) backupOption() {}
44+
45+
// BackupEncryptionOption represents an ENCRYPTION(...) backup option
46+
type BackupEncryptionOption struct {
47+
Algorithm string // Aes128, Aes192, Aes256, TripleDes3Key
48+
Encryptor *CryptoMechanism
49+
OptionKind string // typically "None"
50+
}
51+
52+
func (o *BackupEncryptionOption) backupOption() {}
53+
54+
// CryptoMechanism is defined in create_simple_statements.go
55+
3856
// BackupCertificateStatement represents a BACKUP CERTIFICATE statement
3957
type BackupCertificateStatement struct {
4058
Name *Identifier

ast/begin_end_block_statement.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ type LiteralAtomicBlockOption struct {
3838

3939
func (o *LiteralAtomicBlockOption) atomicBlockOption() {}
4040

41+
// OnOffAtomicBlockOption represents an atomic block option with an ON/OFF value.
42+
type OnOffAtomicBlockOption struct {
43+
OptionKind string
44+
OptionState string // "On" or "Off"
45+
}
46+
47+
func (o *OnOffAtomicBlockOption) atomicBlockOption() {}
48+
4149
// StatementList is a list of statements.
4250
type StatementList struct {
4351
Statements []Statement `json:"Statements,omitempty"`

ast/column_encryption.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package ast
2+
3+
// ColumnEncryptionDefinition represents the ENCRYPTED WITH specification
4+
type ColumnEncryptionDefinition struct {
5+
Parameters []ColumnEncryptionParameter
6+
}
7+
8+
func (c *ColumnEncryptionDefinition) node() {}
9+
10+
// ColumnEncryptionParameter is an interface for encryption parameters
11+
type ColumnEncryptionParameter interface {
12+
columnEncryptionParameter()
13+
}
14+
15+
// ColumnEncryptionKeyNameParameter represents COLUMN_ENCRYPTION_KEY = key_name
16+
type ColumnEncryptionKeyNameParameter struct {
17+
Name *Identifier
18+
ParameterKind string // "ColumnEncryptionKey"
19+
}
20+
21+
func (c *ColumnEncryptionKeyNameParameter) columnEncryptionParameter() {}
22+
23+
// ColumnEncryptionTypeParameter represents ENCRYPTION_TYPE = DETERMINISTIC|RANDOMIZED
24+
type ColumnEncryptionTypeParameter struct {
25+
EncryptionType string // "Deterministic", "Randomized"
26+
ParameterKind string // "EncryptionType"
27+
}
28+
29+
func (c *ColumnEncryptionTypeParameter) columnEncryptionParameter() {}
30+
31+
// ColumnEncryptionAlgorithmParameter represents ALGORITHM = 'algorithm_name'
32+
type ColumnEncryptionAlgorithmParameter struct {
33+
EncryptionAlgorithm ScalarExpression // StringLiteral
34+
ParameterKind string // "Algorithm"
35+
}
36+
37+
func (c *ColumnEncryptionAlgorithmParameter) columnEncryptionParameter() {}

0 commit comments

Comments
 (0)