// ---------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------
//
//
// ---------------------------------------------------------------------
namespace Microsoft.Database.Isam
{
using System;
///
/// 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.
///
public class ConditionalColumn
{
///
/// The columnid
///
private readonly Columnid columnid;
///
/// The name
///
private string name = null;
///
/// The must be null
///
private bool mustBeNull = false;
///
/// Initializes a new instance of the class.
/// For use when defining a new conditional
/// column in an index.
///
///
/// The name of the column in the table to be used for this conditional column.
///
///
/// 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.
///
public ConditionalColumn(string name, bool mustBeNull)
{
this.columnid = null;
this.name = name;
this.mustBeNull = mustBeNull;
}
///
/// Initializes a new instance of the class.
///
/// The columnid.
/// if set to true [must be null].
internal ConditionalColumn(Columnid columnid, bool mustBeNull)
{
this.columnid = columnid;
this.name = columnid.Name;
this.mustBeNull = mustBeNull;
}
///
/// Gets the column ID of the column used for this conditional column
///
///
/// The column ID is undefined if this conditional column will be used
/// to define a new index
///
public Columnid Columnid
{
get
{
return this.columnid;
}
}
///
/// Gets or sets the name of the column used for this conditional column
///
public string Name
{
get
{
return this.name;
}
set
{
this.name = value;
}
}
///
/// Gets the type of the column used for this conditional column
///
///
/// The column type is undefined if this conditional column will be
/// used to define a new index
///
public Type Type
{
get
{
return this.columnid.Type;
}
}
///
/// Gets or sets a value indicating whether the column must be null for the record to be visible in the index.
///
public bool MustBeNull
{
get
{
return this.mustBeNull;
}
set
{
this.mustBeNull = value;
}
}
///
/// Gets or sets a value indicating whether the column must be non-null for the record to be visible in the index.
///
public bool MustBeNonNull
{
get
{
return !this.mustBeNull;
}
set
{
this.mustBeNull = !value;
}
}
}
}