aboutsummaryrefslogtreecommitdiff
path: root/src/wixext/Tuples/SqlDatabaseTuple.cs
blob: 1e056212815a398b04eb7a2ef1b46dd29a215e92 (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.Tuples;

    public static partial class SqlTupleDefinitions
    {
        public static readonly IntermediateTupleDefinition SqlDatabase = new IntermediateTupleDefinition(
            SqlTupleDefinitionType.SqlDatabase.ToString(),
            new[]
            {
                new IntermediateFieldDefinition(nameof(SqlDatabaseTupleFields.Server), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(SqlDatabaseTupleFields.Instance), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(SqlDatabaseTupleFields.Database), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(SqlDatabaseTupleFields.ComponentRef), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(SqlDatabaseTupleFields.UserRef), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(SqlDatabaseTupleFields.FileSpecRef), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(SqlDatabaseTupleFields.LogFileSpecRef), IntermediateFieldType.String),
                new IntermediateFieldDefinition(nameof(SqlDatabaseTupleFields.Attributes), IntermediateFieldType.Number),
            },
            typeof(SqlDatabaseTuple));
    }
}

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

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

    public class SqlDatabaseTuple : IntermediateTuple
    {
        public SqlDatabaseTuple() : base(SqlTupleDefinitions.SqlDatabase, null, null)
        {
        }

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

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

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

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

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

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

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

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

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

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