-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathConditionalColumn.cs
147 lines (132 loc) · 4.43 KB
/
ConditionalColumn.cs
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// ---------------------------------------------------------------------------
// <copyright file="ConditionalColumn.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------
// <summary>
// </summary>
// ---------------------------------------------------------------------
namespace Microsoft.Database.Isam
{
using System;
/// <summary>
/// A Conditional Column is a column used to determine the visibility of a
/// record in an index. This object can be used to explore the schema of
/// an existing index and to create the definition of a new index.
/// </summary>
public class ConditionalColumn
{
/// <summary>
/// The columnid
/// </summary>
private readonly Columnid columnid;
/// <summary>
/// The name
/// </summary>
private string name = null;
/// <summary>
/// The must be null
/// </summary>
private bool mustBeNull = false;
/// <summary>
/// Initializes a new instance of the <see cref="ConditionalColumn"/> class.
/// For use when defining a new conditional
/// column in an index.
/// </summary>
/// <param name="name">
/// The name of the column in the table to be used for this conditional column.
/// </param>
/// <param name="mustBeNull">
/// True if the column must be null for the record to be visible in the index,
/// false if the column must be non-null for the record to be visible in the index.
/// </param>
public ConditionalColumn(string name, bool mustBeNull)
{
this.columnid = null;
this.name = name;
this.mustBeNull = mustBeNull;
}
/// <summary>
/// Initializes a new instance of the <see cref="ConditionalColumn"/> class.
/// </summary>
/// <param name="columnid">The columnid.</param>
/// <param name="mustBeNull">if set to <c>true</c> [must be null].</param>
internal ConditionalColumn(Columnid columnid, bool mustBeNull)
{
this.columnid = columnid;
this.name = columnid.Name;
this.mustBeNull = mustBeNull;
}
/// <summary>
/// Gets the column ID of the column used for this conditional column
/// </summary>
/// <remarks>
/// The column ID is undefined if this conditional column will be used
/// to define a new index
/// </remarks>
public Columnid Columnid
{
get
{
return this.columnid;
}
}
/// <summary>
/// Gets or sets the name of the column used for this conditional column
/// </summary>
public string Name
{
get
{
return this.name;
}
set
{
this.name = value;
}
}
/// <summary>
/// Gets the type of the column used for this conditional column
/// </summary>
/// <remarks>
/// The column type is undefined if this conditional column will be
/// used to define a new index
/// </remarks>
public Type Type
{
get
{
return this.columnid.Type;
}
}
/// <summary>
/// Gets or sets a value indicating whether the column must be null for the record to be visible in the index.
/// </summary>
public bool MustBeNull
{
get
{
return this.mustBeNull;
}
set
{
this.mustBeNull = value;
}
}
/// <summary>
/// Gets or sets a value indicating whether the column must be non-null for the record to be visible in the index.
/// </summary>
public bool MustBeNonNull
{
get
{
return !this.mustBeNull;
}
set
{
this.mustBeNull = !value;
}
}
}
}