summaryrefslogtreecommitdiff
path: root/src/ext/Sql/wixext/Symbols/SqlDatabaseSymbol.cs
blob: 6f0820ac7eeae00928a2218b43d99d57150c68ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// 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.

namespace WixToolset.Sql
{
    using WixToolset.Data;
    using WixToolset.Sql.Symbols;

    public static partial class SqlSymbolDefinitions
    {
        public static readonly IntermediateSymbolDefinition SqlDatabase = new IntermediateSymbolDefinition(
            SqlSymbolDefinitionType.SqlDatabase.ToString(),
            new[]
            {
                new IntermediateFieldDefinition(nameof(SqlDatabaseSymbolFields.Server), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(SqlDatabaseSymbolFields.Instance), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(SqlDatabaseSymbolFields.Database), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(SqlDatabaseSymbolFields.ComponentRef), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(SqlDatabaseSymbolFields.UserRef), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(SqlDatabaseSymbolFields.FileSpecRef), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(SqlDatabaseSymbolFields.LogFileSpecRef), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(SqlDatabaseSymbolFields.Attributes), IntermediateFieldType.Number),
            },
            typeof(SqlDatabaseSymbol));
    }
}

namespace WixToolset.Sql.Symbols
{
    using WixToolset.Data;

    public enum SqlDatabaseSymbolFields
    {
        Server,
        Instance,
        Database,
        ComponentRef,
        UserRef,
        FileSpecRef,
        LogFileSpecRef,
        Attributes,
    }

    public class SqlDatabaseSymbol : IntermediateSymbol
    {
        public SqlDatabaseSymbol() : base(SqlSymbolDefinitions.SqlDatabase, null, null)
        {
        }

        public SqlDatabaseSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(SqlSymbolDefinitions.SqlDatabase, sourceLineNumber, id)
        {
        }

        public IntermediateField this[SqlDatabaseSymbolFields index] => this.Fields[(int)index];

        public string Server
        {
            get => this.Fields[(int)SqlDatabaseSymbolFields.Server].AsString();
            set => this.Set((int)SqlDatabaseSymbolFields.Server, value);
        }

        public string Instance
        {
            get => this.Fields[(int)SqlDatabaseSymbolFields.Instance].AsString();
            set => this.Set((int)SqlDatabaseSymbolFields.Instance, value);
        }

        public string Database
        {
            get => this.Fields[(int)SqlDatabaseSymbolFields.Database].AsString();
            set => this.Set((int)SqlDatabaseSymbolFields.Database, value);
        }

        public string ComponentRef
        {
            get => this.Fields[(int)SqlDatabaseSymbolFields.ComponentRef].AsString();
            set => this.Set((int)SqlDatabaseSymbolFields.ComponentRef, value);
        }

        public string UserRef
        {
            get => this.Fields[(int)SqlDatabaseSymbolFields.UserRef].AsString();
            set => this.Set((int)SqlDatabaseSymbolFields.UserRef, value);
        }

        public string FileSpecRef
        {
            get => this.Fields[(int)SqlDatabaseSymbolFields.FileSpecRef].AsString();
            set => this.Set((int)SqlDatabaseSymbolFields.FileSpecRef, value);
        }

        public string LogFileSpecRef
        {
            get => this.Fields[(int)SqlDatabaseSymbolFields.LogFileSpecRef].AsString();
            set => this.Set((int)SqlDatabaseSymbolFields.LogFileSpecRef, value);
        }

        public int Attributes
        {
            get => this.Fields[(int)SqlDatabaseSymbolFields.Attributes].AsNumber();
            set => this.Set((int)SqlDatabaseSymbolFields.Attributes, value);
        }
    }
}