DBSqlParserColumn.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / DataOracleClient / System / Data / Common / DBSqlParserColumn.cs / 1 / DBSqlParserColumn.cs

                            //------------------------------------------------------------------------------ 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// [....] 
//-----------------------------------------------------------------------------
 
namespace System.Data.OracleClient { 

    using System; 
    using System.Collections;
    using System.Diagnostics;
    using System.Text;
 
    //---------------------------------------------------------------------
    // DbSqlParserColumn 
    // 
    //  A parsed column reference from DbSqlParser.
    // 
    sealed internal class DbSqlParserColumn {
        private bool        _isKey;
        private bool        _isUnique;
        private string      _databaseName; 
        private string      _schemaName;
        private string      _tableName; 
        private string      _columnName; 
        private string      _alias;
 
        internal enum ConstraintType {
            PrimaryKey = 1,
            UniqueKey = 2,
            UniqueConstraint = 3, 
        }
 
 
        internal DbSqlParserColumn(string databaseName, string schemaName, string tableName, string columnName, string alias) {
            _databaseName = databaseName; 
            _schemaName = schemaName;
            _tableName = tableName;
            _columnName = columnName;
            _alias = alias; 
        }
 
//      internal string Alias           { get { return (null == _alias)         ? string.Empty : _alias; } } 
        internal string ColumnName      { get { return (null == _columnName)    ? string.Empty : _columnName; } }
        internal string DatabaseName    { get { return (null == _databaseName)  ? string.Empty : _databaseName; } } 

        internal bool   IsAliased       { get { return _alias != null; } }
        internal bool   IsExpression    { get { return _columnName == null; } }
        internal bool   IsKey           { get { return _isKey; } } 
        internal bool   IsUnique        { get { return _isUnique; } }
 
        internal string SchemaName      { get { return (null == _schemaName)    ? string.Empty : _schemaName; } } 
        internal string TableName       { get { return (null == _tableName)     ? string.Empty : _tableName; } }
 
        internal void CopySchemaInfoFrom(DbSqlParserColumn completedColumn) {
            _databaseName = completedColumn.DatabaseName;
            _schemaName = completedColumn.SchemaName;
            _tableName = completedColumn.TableName; 
            _columnName = completedColumn.ColumnName;
            _isKey = completedColumn.IsKey; 
            _isUnique = completedColumn.IsUnique; 
        }
 
        internal void CopySchemaInfoFrom(DbSqlParserTable table) {
            _databaseName = table.DatabaseName;
            _schemaName = table.SchemaName;
            _tableName = table.TableName; 
            _isKey = false;
            _isUnique = false; 
        } 

        internal void SetConstraint(ConstraintType constraintType) { 
            switch (constraintType) {
                case ConstraintType.PrimaryKey:
                    _isKey = true;
                    break; 

                case ConstraintType.UniqueKey: 
                case ConstraintType.UniqueConstraint: 
                    _isUnique = _isKey = true;
                    break; 
            }
        }
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------ 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// [....] 
//-----------------------------------------------------------------------------
 
namespace System.Data.OracleClient { 

    using System; 
    using System.Collections;
    using System.Diagnostics;
    using System.Text;
 
    //---------------------------------------------------------------------
    // DbSqlParserColumn 
    // 
    //  A parsed column reference from DbSqlParser.
    // 
    sealed internal class DbSqlParserColumn {
        private bool        _isKey;
        private bool        _isUnique;
        private string      _databaseName; 
        private string      _schemaName;
        private string      _tableName; 
        private string      _columnName; 
        private string      _alias;
 
        internal enum ConstraintType {
            PrimaryKey = 1,
            UniqueKey = 2,
            UniqueConstraint = 3, 
        }
 
 
        internal DbSqlParserColumn(string databaseName, string schemaName, string tableName, string columnName, string alias) {
            _databaseName = databaseName; 
            _schemaName = schemaName;
            _tableName = tableName;
            _columnName = columnName;
            _alias = alias; 
        }
 
//      internal string Alias           { get { return (null == _alias)         ? string.Empty : _alias; } } 
        internal string ColumnName      { get { return (null == _columnName)    ? string.Empty : _columnName; } }
        internal string DatabaseName    { get { return (null == _databaseName)  ? string.Empty : _databaseName; } } 

        internal bool   IsAliased       { get { return _alias != null; } }
        internal bool   IsExpression    { get { return _columnName == null; } }
        internal bool   IsKey           { get { return _isKey; } } 
        internal bool   IsUnique        { get { return _isUnique; } }
 
        internal string SchemaName      { get { return (null == _schemaName)    ? string.Empty : _schemaName; } } 
        internal string TableName       { get { return (null == _tableName)     ? string.Empty : _tableName; } }
 
        internal void CopySchemaInfoFrom(DbSqlParserColumn completedColumn) {
            _databaseName = completedColumn.DatabaseName;
            _schemaName = completedColumn.SchemaName;
            _tableName = completedColumn.TableName; 
            _columnName = completedColumn.ColumnName;
            _isKey = completedColumn.IsKey; 
            _isUnique = completedColumn.IsUnique; 
        }
 
        internal void CopySchemaInfoFrom(DbSqlParserTable table) {
            _databaseName = table.DatabaseName;
            _schemaName = table.SchemaName;
            _tableName = table.TableName; 
            _isKey = false;
            _isUnique = false; 
        } 

        internal void SetConstraint(ConstraintType constraintType) { 
            switch (constraintType) {
                case ConstraintType.PrimaryKey:
                    _isKey = true;
                    break; 

                case ConstraintType.UniqueKey: 
                case ConstraintType.UniqueConstraint: 
                    _isUnique = _isKey = true;
                    break; 
            }
        }
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK