Beispiel #1
0
        private PdmIndex GetIndex(XmlNode xnKey, PdmTable pTable)
        {
            PdmIndex   mIndex = new PdmIndex();
            XmlElement xe     = (XmlElement)xnKey;

            mIndex.PdmID = xe.GetAttribute("Id");
            XmlNodeList xnKProperty = xe.ChildNodes;

            foreach (XmlNode xnP in xnKProperty)
            {
                switch (xnP.Name)
                {
                case "a:Name": mIndex.IndexName = xnP.InnerText;
                    break;

                case "a:Code": mIndex.IndexCode = xnP.InnerText;
                    break;

                case "a:Unique": mIndex.IsUnique = ConvertToBooleanPG(xnP.InnerText);
                    break;

                case "c:IndexColumns": InitIndexColumns(xnP, pTable, mIndex);
                    break;
                }
            }
            return(mIndex);
        }
Beispiel #2
0
        //初始化c:Keys"的节点
        private void InitKeys(XmlNode xnKeys, PdmTable pTable)
        {
            int i = 1;

            pTable.Keys.Clear();

            foreach (XmlNode xnKey in xnKeys)
            {
                PdmKey item = GetKey(xnKey, pTable);
                item.KeyID = i;
                pTable.AddKey(item);
                i++;
            }
        }
Beispiel #3
0
        private void InitIndexes(XmlNode xnKeys, PdmTable pTable)
        {
            int i = 1;

            pTable.Indexs.Clear();

            foreach (XmlNode xnKey in xnKeys)
            {
                PdmIndex item = GetIndex(xnKey, pTable);
                item.IndexID = i;
                pTable.AddIndex(item);
                i++;
            }
        }
Beispiel #4
0
        //初始化"c:Columns"的节点
        private void InitColumns(XmlNode xnColumns, PdmTable pTable)
        {
            int i = 1;

            pTable.Columns.Clear();

            foreach (XmlNode xnColumn in xnColumns)
            {
                PdmColumn item = GetColumn(xnColumn);
                item.ColumnID = i;
                pTable.AddColumn(item);
                i++;
            }
        }
Beispiel #5
0
 private void InitIndexColumn(XmlNode xnKeys, PdmTable pTable, PdmIndex pIndex)
 {
     foreach (XmlNode xnKey in xnKeys)
     {
         XmlElement xe = (XmlElement)xnKey;
         foreach (PdmColumn column in pTable.Columns)
         {
             if (column.PdmID == xe.GetAttribute("Ref"))
             {
                 pIndex.AddColumn(column);
                 break;
             }
         }
     }
 }
Beispiel #6
0
        private void InitPrimaryKey(XmlNode xnKeys, PdmTable pTable)
        {
            foreach (XmlNode xnKey in xnKeys)
            {
                PdmKey item = GetKey(xnKey, pTable);

                foreach (PdmKey key in pTable.Keys)
                {
                    XmlElement xe = (XmlElement)xnKey;
                    if (key.PdmID == xe.GetAttribute("Ref"))
                    {
                        key.IsPrimary = true;
                        break;
                    }
                }
            }
        }
Beispiel #7
0
        private void InitIndexColumns(XmlNode xnKeys, PdmTable pTable, PdmIndex pIndex)
        {
            pIndex.Columns.Clear();

            foreach (XmlNode xnKey in xnKeys)
            {
                XmlElement  xe          = (XmlElement)xnKey;
                XmlNodeList xnKProperty = xe.ChildNodes;

                foreach (XmlNode xnP in xnKProperty)
                {
                    switch (xnP.Name)
                    {
                    case "c:Column": InitIndexColumn(xnP, pTable, pIndex);
                        break;
                    }
                }
            }
        }
Beispiel #8
0
        private void InitKeyColumns(XmlNode xnKeys, PdmTable pTable, PdmKey pKey)
        {
            int i = 1;

            pKey.Columns.Clear();

            foreach (XmlNode xnKey in xnKeys)
            {
                XmlElement xe = (XmlElement)xnKey;
                foreach (PdmColumn column in pTable.Columns)
                {
                    if (column.PdmID == xe.GetAttribute("Ref"))
                    {
                        pKey.AddColumn(column);
                        i++;
                        break;
                    }
                }
            }
        }
Beispiel #9
0
        //初始化"o:Table"的节点
        private PdmTable GetTable(XmlNode xnTable)
        {
            PdmTable   mTable = new PdmTable();
            XmlElement xe     = (XmlElement)xnTable;

            mTable.PdmID = xe.GetAttribute("Id");

            XmlNodeList xnTProperty = xe.ChildNodes;

            foreach (XmlNode xnP in xnTProperty)
            {
                switch (xnP.Name)
                {
                case "a:Name": mTable.TableName = xnP.InnerText;
                    break;

                case "a:Code": mTable.TableCode = xnP.InnerText;
                    break;

                case "a:Comment": mTable.Comment = xnP.InnerText;
                    break;

                case "c:Columns": InitColumns(xnP, mTable);
                    break;

                case "c:Keys": InitKeys(xnP, mTable);
                    break;

                case "c:PrimaryKey": InitPrimaryKey(xnP, mTable);
                    break;

                case "c:Indexes": InitIndexes(xnP, mTable);
                    break;
                }
            }
            return(mTable);
        }
Beispiel #10
0
        private PdmKey GetKey(XmlNode xnKey, PdmTable pTable)
        {
            PdmKey     mKey = new PdmKey();
            XmlElement xe   = (XmlElement)xnKey;

            mKey.PdmID = xe.GetAttribute("Id");
            XmlNodeList xnKProperty = xe.ChildNodes;

            foreach (XmlNode xnP in xnKProperty)
            {
                switch (xnP.Name)
                {
                case "a:Name": mKey.KeyName = xnP.InnerText;
                    break;

                case "a:Code": mKey.KeyCode = xnP.InnerText;
                    break;

                case "c:Key.Columns": InitKeyColumns(xnP, pTable, mKey);
                    break;
                }
            }
            return(mKey);
        }
Beispiel #11
0
 public bool OnEqual(PdmTable tbl)
 {
     return((tbl.TableName == this.TableName) && (tbl.TableCode == this.TableCode) && (tbl.DBID == this.DBID) && (tbl.Comment == this.Comment));
 }