| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 2 | |
| 3 | namespace WixToolset.Sql |
| 4 | { |
| 5 | using WixToolset.Data; |
| 6 | using WixToolset.Sql.Symbols; |
| 7 | |
| 8 | public static partial class SqlSymbolDefinitions |
| 9 | { |
| 10 | public static readonly IntermediateSymbolDefinition SqlString = new IntermediateSymbolDefinition( |
| 11 | SqlSymbolDefinitionType.SqlString.ToString(), |
| 12 | new[] |
| 13 | { |
| 14 | new IntermediateFieldDefinition(nameof(SqlStringSymbolFields.SqlDbRef), IntermediateFieldType.String), |
| 15 | new IntermediateFieldDefinition(nameof(SqlStringSymbolFields.ComponentRef), IntermediateFieldType.String), |
| 16 | new IntermediateFieldDefinition(nameof(SqlStringSymbolFields.SQL), IntermediateFieldType.String), |
| 17 | new IntermediateFieldDefinition(nameof(SqlStringSymbolFields.UserRef), IntermediateFieldType.String), |
| 18 | new IntermediateFieldDefinition(nameof(SqlStringSymbolFields.Attributes), IntermediateFieldType.Number), |
| 19 | new IntermediateFieldDefinition(nameof(SqlStringSymbolFields.Sequence), IntermediateFieldType.Number), |
| 20 | }, |
| 21 | typeof(SqlStringSymbol)); |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | namespace WixToolset.Sql.Symbols |
| 26 | { |
| 27 | using WixToolset.Data; |
| 28 | |
| 29 | public enum SqlStringSymbolFields |
| 30 | { |
| 31 | SqlDbRef, |
| 32 | ComponentRef, |
| 33 | SQL, |
| 34 | UserRef, |
| 35 | Attributes, |
| 36 | Sequence, |
| 37 | } |
| 38 | |
| 39 | public class SqlStringSymbol : IntermediateSymbol |
| 40 | { |
| 41 | public SqlStringSymbol() : base(SqlSymbolDefinitions.SqlString, null, null) |
| 42 | { |
| 43 | } |
| 44 | |
| 45 | public SqlStringSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SqlSymbolDefinitions.SqlString, sourceLineNumber, id) |
| 46 | { |
| 47 | } |
| 48 | |
| 49 | public IntermediateField this[SqlStringSymbolFields index] => this.Fields[(int)index]; |
| 50 | |
| 51 | public string SqlDbRef |
| 52 | { |
| 53 | get => this.Fields[(int)SqlStringSymbolFields.SqlDbRef].AsString(); |
| 54 | set => this.Set((int)SqlStringSymbolFields.SqlDbRef, value); |
| 55 | } |
| 56 | |
| 57 | public string ComponentRef |
| 58 | { |
| 59 | get => this.Fields[(int)SqlStringSymbolFields.ComponentRef].AsString(); |
| 60 | set => this.Set((int)SqlStringSymbolFields.ComponentRef, value); |
| 61 | } |
| 62 | |
| 63 | public string SQL |
| 64 | { |
| 65 | get => this.Fields[(int)SqlStringSymbolFields.SQL].AsString(); |
| 66 | set => this.Set((int)SqlStringSymbolFields.SQL, value); |
| 67 | } |
| 68 | |
| 69 | public string UserRef |
| 70 | { |
| 71 | get => this.Fields[(int)SqlStringSymbolFields.UserRef].AsString(); |
| 72 | set => this.Set((int)SqlStringSymbolFields.UserRef, value); |
| 73 | } |
| 74 | |
| 75 | public int Attributes |
| 76 | { |
| 77 | get => this.Fields[(int)SqlStringSymbolFields.Attributes].AsNumber(); |
| 78 | set => this.Set((int)SqlStringSymbolFields.Attributes, value); |
| 79 | } |
| 80 | |
| 81 | public int? Sequence |
| 82 | { |
| 83 | get => this.Fields[(int)SqlStringSymbolFields.Sequence].AsNullableNumber(); |
| 84 | set => this.Set((int)SqlStringSymbolFields.Sequence, value); |
| 85 | } |
| 86 | } |
| 87 | } |