예제 #1
0
        public IndexDefInfo CreateAKConstraint(string lpszName)
        {
            string constraintName = lpszName + m_strName;

            m_AKConstraint = new IndexDefInfo(constraintName, m_strName, true);

            return(m_AKConstraint);
        }
예제 #2
0
 private CloneIndexDefInfo CloneIndex(IndexDefInfo defInfo)
 {
     if (defInfo == null)
     {
         return(null);
     }
     return(new CloneIndexDefInfo(defInfo));
 }
예제 #3
0
        public IndexDefInfo CreateIndex(string lpszName, bool bUnique = false)
        {
            IndexDefInfo indexInfo = new IndexDefInfo(lpszName, m_strName, false);

            indexInfo.m_bUnique = bUnique;

            return(IndexAppend(indexInfo));
        }
예제 #4
0
        public IndexDefInfo CreateAKAutoConstraint(string lpszName, string lpszIdName)
        {
            string constraintName = lpszName + m_strName;

            m_AKConstraint = new IndexDefInfo(constraintName, m_strName, true);
            m_AKConstraint.AppendField(lpszIdName);

            return(m_AKConstraint);
        }
예제 #5
0
 public CloneIndexDefInfo(IndexDefInfo defInfo)
 {
     this.m_IndexFields = defInfo.IndexFields().Select((idxf) => new CloneIndexFieldDefInfo(idxf)).ToList();
     this.m_strName     = defInfo.m_strName;
     this.m_strTable    = defInfo.m_strTable;
     this.m_nFields     = defInfo.FieldsCount();
     this.m_bUnique     = defInfo.m_bUnique;
     this.m_bPrimary    = defInfo.m_bPrimary;
 }
예제 #6
0
 void Clear()
 {
     m_strName = "";
     m_TableFields.Clear();
     m_nFields      = 0;
     m_PKConstraint = null;
     m_AKConstraint = null;
     m_TableIndexs.Clear();
     m_TableRelations.Clear();
 }
예제 #7
0
        public IndexDefInfo GetTargetInfo()
        {
            IndexDefInfo defInfo = new IndexDefInfo(this.m_strName, this.m_strTable, this.m_bPrimary);

            defInfo.SetIndexFields(this.m_IndexFields.Select((idxf) => (idxf.GetTargetInfo())).ToList());
            defInfo.SetFields(this.m_nFields);
            defInfo.SetUnique(this.m_bUnique);

            return(defInfo);
        }
예제 #8
0
 public TableDefInfo(string lpszOwnerName, string lpszUsersName, string lpszTableName, UInt32 versFrom = 0, UInt32 versDrop = 9999)
 {
     this.m_strOwnerName   = lpszOwnerName;
     this.m_strUsersName   = lpszUsersName;
     this.m_TableFields    = new List <TableFieldDefInfo>();
     m_PKConstraint        = null;
     m_AKConstraint        = null;
     this.m_TableIndexs    = new List <IndexDefInfo>();
     this.m_TableRelations = new List <RelationDefInfo>();
     this.m_strName        = lpszTableName;
     this.m_VersFrom       = versFrom;
     this.m_VersDrop       = versDrop;
 }
예제 #9
0
        public object Clone()
        {
            IndexDefInfo other = (IndexDefInfo)this.MemberwiseClone();

            other.m_strName  = this.m_strName;
            other.m_strTable = this.m_strTable;
            other.m_nFields  = this.m_nFields;
            other.m_bUnique  = this.m_bUnique;
            other.m_bPrimary = this.m_bPrimary;

            other.m_IndexFields = this.m_IndexFields.Select((f) => ((IndexFieldDefInfo)f.Clone())).ToList();
            return(other);
        }
예제 #10
0
        public void CreateIndexFromXPK(IndexDefInfo primaryKey)
        {
            if (primaryKey != null)
            {
                IndexDefInfo indexInfo = (IndexDefInfo)primaryKey.Clone();

                string indexName = indexInfo.m_strName.Replace("XPK", "XAK");

                indexInfo.m_strName = indexName;

                indexInfo.m_bPrimary = false;

                indexInfo.m_bUnique = true;

                IndexAppend(indexInfo);
            }
        }
예제 #11
0
        public void CreateTargetIndexFromXPK(CloneIndexDefInfo primaryKey)
        {
            if (primaryKey != null)
            {
                IndexDefInfo indexInfo = (IndexDefInfo)primaryKey.GetTargetInfo();

                string indexName = indexInfo.m_strName.Replace("XPK", "XAK");

                indexInfo.m_strName = indexName;

                indexInfo.m_bPrimary = false;

                indexInfo.m_bUnique = true;

                CloneIndexDefInfo indexClone = new CloneIndexDefInfo(null, indexInfo);

                IndexAppend(indexClone);
            }
        }
예제 #12
0
        public IndexDefInfo CreateIndexFromXPK(IndexDefInfo pkConstraint, string oldAutoName, string newAutoName)
        {
            m_AKConstraint = null;

            if (pkConstraint != null)
            {
                m_AKConstraint = (IndexDefInfo)pkConstraint.Clone();

                string indexName = m_AKConstraint.m_strName.Replace("XPK", "XAK");

                m_AKConstraint.m_strName = indexName;

                m_AKConstraint.m_bPrimary = false;

                m_AKConstraint.m_bUnique = true;

                m_AKConstraint.ReNameColumn(oldAutoName, newAutoName);
            }
            return(m_AKConstraint);
        }
예제 #13
0
 public CloneIndexDefInfo(IndexDefInfo defSource, IndexDefInfo defTarget)
 {
     if (defSource != null)
     {
         this.m_IndexFields = defSource.IndexFields().Select((idxf) => new CloneIndexFieldDefInfo(idxf, null)).ToList();
         this.m_strName     = defSource.m_strName;
         this.m_strTable    = defSource.m_strTable;
         this.m_nFields     = defSource.FieldsCount();
         this.m_bUnique     = defSource.m_bUnique;
         this.m_bPrimary    = defSource.m_bPrimary;
     }
     else if (defTarget != null)
     {
         this.m_IndexFields = defTarget.IndexFields().Select((idxf) => new CloneIndexFieldDefInfo(null, idxf)).ToList();
         this.m_strName     = defTarget.m_strName;
         this.m_strTable    = defTarget.m_strTable;
         this.m_nFields     = defTarget.FieldsCount();
         this.m_bUnique     = defTarget.m_bUnique;
         this.m_bPrimary    = defTarget.m_bPrimary;
     }
 }
예제 #14
0
        public CloneIndexDefInfo CreateTargetIndexFromXPK(CloneIndexDefInfo pkConstraint, string oldAutoName, string newAutoName)
        {
            m_AKConstraint = null;

            if (pkConstraint != null)
            {
                IndexDefInfo indexInfo = (IndexDefInfo)pkConstraint.GetTargetInfo();

                m_AKConstraint = new CloneIndexDefInfo(null, indexInfo);

                string indexName = m_AKConstraint.m_strName.Replace("XPK", "XAK");

                m_AKConstraint.m_strName = indexName;

                m_AKConstraint.m_bPrimary = false;

                m_AKConstraint.m_bUnique = true;

                m_AKConstraint.ReNameTargetColumn(oldAutoName, newAutoName);
            }
            return(m_AKConstraint);
        }
예제 #15
0
 public void SetIndexAK(IndexDefInfo indexInfo)
 {
     m_AKConstraint = indexInfo;
 }
예제 #16
0
        public IndexDefInfo AddTableIndex(string lpszName)
        {
            IndexDefInfo indexInfo = new IndexDefInfo(lpszName, m_strName, false);

            return(indexInfo);
        }
예제 #17
0
        private IndexDefInfo IndexAppend(IndexDefInfo indexInfo)
        {
            m_TableIndexs.Add(indexInfo);

            return(indexInfo);
        }