예제 #1
0
파일: Mwb.cs 프로젝트: lovefc3s/M2E4Mono
        private void GetColumn(List <XElement> chd, string linkid)
        {
            MyColumn col = new MyColumn();

            col.linkid = linkid;
            foreach (var ere in chd)
            {
                if (ere.HasAttributes)
                {
                    XAttribute atr = ere.Attribute((XName)"key");
                    if (atr != null)
                    {
                        switch (atr.Value)
                        {
                        case "autoIncrement": col.autoIncrement = int.Parse(ere.Value); break;

                        case "characterSetName": col.characterSetName = ere.Value; break;

                        case "collationName": col.collationName = ere.Value; break;

                        case "datatypeExplicitParams": col.datatypeExplicitParams = ere.Value; break;

                        case "defaultValue": col.defaultValue = ere.Value; break;

                        case "defaultValueIsNull": col.defaultValueIsNull = int.Parse(ere.Value); break;

                        case "isNotNull": col.isNotNull = int.Parse(ere.Value); break;

                        case "length": col.length = int.Parse(ere.Value); break;

                        case "precision": col.precision = int.Parse(ere.Value); break;

                        case "scale": col.scale = int.Parse(ere.Value); break;

                        case "comment": col.comment = ere.Value; break;

                        case "name": col.name = ere.Value; break;

                        case "oldName": col.oldName = ere.Value; break;

                        default: break;
                        }
                    }
                    atr = ere.Attribute((XName)"struct-name");
                    if (atr != null)
                    {
                        if (atr.Value == "db.SimpleDatatype")
                        {
                            col.SimpleDatatype = ere.Value;
                        }
                    }
                }
            }
            if (_table != null)
            {
                _table.Columns.Add(col);
            }
        }
예제 #2
0
파일: Mwb.cs 프로젝트: lovefc3s/M2E4Mono
        public Mwb()
        {
            _table   = null;
            _column  = null;
            tab      = Resources.Tab;
            nl       = Resources.Nl;
            Columns  = new List <MyColumn>();
            Tables   = new List <MyTable>();
            Usertype = new List <MyUserDatatype>();
            MyUserDatatype typ = new MyUserDatatype();

            Usertype.Add(typ);
            typ.id            = 1;
            typ.name          = "VARCHAR";
            typ.actualType    = "com.mysql.rdbms.mysql.datatype.varchar";
            typ.flags         = "";
            typ.sqlDefinition = "verchar";
            Routines          = new List <MyRoutine>();
            Indexes           = new List <MyIndex>();
            tit      = "";
            Database = "";
        }
예제 #3
0
파일: Mwb.cs 프로젝트: lovefc3s/M2E4Mono
 //
 //	ノードの再帰的処理1
 //
 private void NodeProcess1(XmlNode nod, int level)
 {
     if (nod.Attributes != null)
     {
         foreach (XmlAttribute atr in nod.Attributes)
         {
             if ((atr.Name == "struct-name") && (atr.Value == "db.mysql.Table"))
             {
                 if (_table != null)
                 {
                     Tables.Add(_table);
                 }
                 _table = new MyTable();
             }
             else if ((atr.Name == "struct-name") && (atr.Value == "db.mysql.Column"))
             {
                 clevel = level;
                 if (_column != null)
                 {
                     Columns.Add(_column);
                     _table.Columns.Add(_column);
                 }
                 _column = new MyColumn();
             }
             else if ((atr.Name == "key") && (atr.Value == "autoIncrement"))
             {
                 _column.autoIncrement = int.Parse(nod.FirstChild.Value);
             }
             else if ((atr.Name == "key") && (atr.Value == "tableEngine"))
             {
                 _table.tableEngine = nod.FirstChild.Value;
                 dbe = true;
             }
             else if ((atr.Name == "key") && (atr.Value == "name"))
             {
                 if (dbe)
                 {
                     if ((_table != null) && (nod.FirstChild != null))
                     {
                         _table.name = nod.FirstChild.Value;
                         dbe         = false;
                     }
                 }
                 else
                 {
                     if ((_column != null) && (nod.FirstChild != null))
                     {
                         _column.name = nod.FirstChild.Value;
                     }
                 }
             }
         }
     }
     foreach (XmlNode nod1 in nod.ChildNodes)
     {
         NodeProcess1(nod1, level + 1);
     }
     if (clevel == level)
     {
         if (_column != null)
         {
             Columns.Add(_column);
             _table.Columns.Add(_column);
             _column = null;
         }
         clevel = 0;
     }
 }