Пример #1
0
 /// <summary>
 ///   指定ファイルからテーブル定義を読み取る
 /// </summary>
 public void Load(string xmlfile_)
 {
     xmlfile = xmlfile_;
     columns = new DBColumnDef[0];
     try {
         using (XmlFile xml = new XmlFile(xmlfile, "table")) {
             XmlElement root = xml.Root;
             name    = root.GetAttribute("name");
             expr    = root.GetAttribute("expr");
             note    = XmlFile.GetText(root, false).Trim();
             owner   = root.GetAttribute("owner");
             orgName = root.GetAttribute("orgname");
             foreach (XmlElement el in xml.GetElements(root, "column"))
             {
                 DBColumnDef coldef = new DBColumnDef(el);
                 coldef.ByteSize = StringUtil.ToInt(el.GetAttribute("bytesize"), 0);
                 coldef.OrgName  = el.GetAttribute("orgname");
                 AddColumn(coldef);
             }
             foreach (XmlElement el in xml.GetElements(root, "index"))
             {
                 AddIndex(new DBIndexDef(xml, el));
             }
             xml.Close();
         }
     } catch (XmlException e) {
         throw new XmlException(String.Format("XMLファイル({0})の読み取りに失敗しました: {1}", xmlfile, e.Message));
     }
 }