Click here to Skip to main content
15,891,513 members
Articles / Desktop Programming / WPF

DBTool for Oracle - Part 1

Rate me:
Please Sign up or sign in to vote.
4.92/5 (45 votes)
13 Apr 2014CPOL18 min read 137.7K   5.1K   88  
Enhance productivity and reliability, write your own tools.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using Harlinn.Oracle.DBTool.Types.Common;
using Harlinn.Oracle.DBTool.Utils.DB;

namespace Harlinn.Oracle.DBTool.Types.Database
{
    public class DBUserTableIndexColumn : DBElement
    {
        private static readonly log4net.ILog sfLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

        private static void LogException(Exception exc, System.Reflection.MethodBase method)
        {
            Logger.LogException(sfLog, exc, method);
        }

        private string indexOwner;
        private string indexName;
        private string tableOwner;
        private string tableName;
        private string columnName;
        private decimal columnPosition;
        private decimal columnLength;
        private decimal? charLength;
        private string descend;

        private WeakReference fieldReference;

        public DBUserTableIndexColumn()
        {
            
        }
        public DBUserTableIndexColumn(DBUserTableIndexColumns parent, IndexColumnsReader reader)
            : base(parent, reader.ColumnName)
        {
            this.indexOwner = reader.IndexOwner;
            this.indexName = reader.IndexName;
            this.tableOwner = reader.TableOwner;
            this.tableName = reader.TableName;
            this.columnName = reader.ColumnName;
            this.columnPosition = reader.ColumnPosition;
            this.columnLength = reader.ColumnLength;
            this.charLength = reader.CharLength;
            this.descend = reader.Descend;
        }

        public override DBElementType ElementType
        {
            get 
            {
                return DBElementType.UserTableIndexColumn;
            }
        }

        [Browsable(false)]
        public DBUserTableIndexColumns Columns
        {
            get
            {
                DBUserTableIndexColumns result = (DBUserTableIndexColumns)Parent;
                return result;
            }
        }


        public DBField GetField()
        {
            if (fieldReference == null)
            {
                DBFields fields = Columns.Index.Indexes.Table.GetChildByName<DBFields>("Fields");
                if (fields != null)
                {
                    DBField field = fields[Name];
                    if (field != null)
                    {
                        fieldReference = new WeakReference(field);
                        return field;
                    }
                }
                return null;
            }
            return (DBField)fieldReference.Target;
        }


        public string IndexOwner
        {
            get
            {
                return indexOwner;
            }
            set
            {
                indexOwner = value;
            }
        }


        public string IndexName
        {
            get
            {
                return indexName;
            }
            set
            {
                indexName = value;
            }
        }


        public string TableOwner
        {
            get
            {
                return tableOwner;
            }
            set
            {
                tableOwner = value;
            }
        }


        public string TableName
        {
            get
            {
                return tableName;
            }
            set
            {
                tableName = value;
            }
        }


        public string ColumnName
        {
            get
            {
                return columnName;
            }
            set
            {
                columnName = value;
            }
        }


        public decimal ColumnPosition
        {
            get
            {
                return columnPosition;
            }
            set
            {
                columnPosition = value;
            }
        }


        public decimal ColumnLength
        {
            get
            {
                return columnLength;
            }
            set
            {
                columnLength = value;
            }
        }


        public decimal? CharLength
        {
            get
            {
                return charLength;
            }
            set
            {
                charLength = value;
            }
        }


        public string Descend
        {
            get
            {
                return descend;
            }
            set
            {
                descend = value;
            }
        }

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect Sea Surveillance AS
Norway Norway
Chief Architect - Sea Surveillance AS.

Specializing in integrated operations and high performance computing solutions.

I’ve been fooling around with computers since the early eighties, I’ve even done work on CP/M and MP/M.

Wrote my first “real” program on a BBC micro model B based on a series in a magazine at that time. It was fun and I got hooked on this thing called programming ...

A few Highlights:

  • High performance application server development
  • Model Driven Architecture and Code generators
  • Real-Time Distributed Solutions
  • C, C++, C#, Java, TSQL, PL/SQL, Delphi, ActionScript, Perl, Rexx
  • Microsoft SQL Server, Oracle RDBMS, IBM DB2, PostGreSQL
  • AMQP, Apache qpid, RabbitMQ, Microsoft Message Queuing, IBM WebSphereMQ, Oracle TuxidoMQ
  • Oracle WebLogic, IBM WebSphere
  • Corba, COM, DCE, WCF
  • AspenTech InfoPlus.21(IP21), OsiSoft PI


More information about what I do for a living can be found at: harlinn.com or LinkedIn

You can contact me at espen@harlinn.no

Comments and Discussions