zoukankan      html  css  js  c++  java
  • Find the tables extending a specific extended data type

      Recently I was instructed to updated a table field, It is easy to write a simple statement to complete the task. But I have no idea about that there may be some tables having the same field in the system. So I writed a job to verify mine suspicious. 

     1 static void Jinn_FindExtendedType(Args _args)
     2 {
     3     DictTable       m_DictTable;
     4     DictField       m_DictField;
     5     ExtendedTypeId  m_EDTItemId, m_EDTItemGroup;
     6     Dictionary      m_Dictionary = new Dictionary();
     7     TableName       m_TableName;
     8     FieldName       m_ItemName, m_GroupName;
     9     FieldId         m_FieldIdItem, m_FieldIdGroup;
    10     Common          m_Common;
    11     int             i, j;
    12     boolean         m_IsItem, m_IsGroup;
    13     ;
    14     
    15     m_EDTItemGroup = m_Dictionary.typeName2Id("ItemGroupId");
    16     m_EDTItemId    = m_Dictionary.typeName2Id("ItemId");
    17     
    18     for (i = 1; i <= m_Dictionary.tableCnt(); i++)
    19     {
    20         m_DictTable = new DictTable(m_Dictionary.tableCnt2Id(i));
    21         m_TableName = m_DictTable.name();
    22         
    23         if (!m_DictTable.isMap() && !m_DictTable.isTmp() &&
    24             !m_DictTable.isView() && m_DictTable.rights() >= AccessType::View)
    25         {
    26             m_IsItem  = false;
    27             m_IsGroup = false;
    28             for (j = 1; j <= m_DictTable.fieldCnt(); j++)
    29             {
    30                 m_DictField = new DictField(m_DictTable.id(), m_DictTable.fieldCnt2Id(j));
    31                 if (m_DictField && m_DictField.typeId() == m_EDTItemId)
    32                 {
    33                     m_ItemName    = m_DictField.name();
    34                     m_FieldIdItem = m_DictField.id();
    35                     m_IsItem      = true;
    36                 }
    37                 if (m_DictField && m_DictField.typeId() == m_EDTItemGroup)
    38                 {
    39                     m_GroupName    = m_DictField.name();
    40                     m_FieldIdGroup = m_DictField.id();
    41                     m_IsGroup      = true;
    42                 }
    43 
    44             }
    45             
    46             if (m_IsItem && m_IsGroup)
    47             {
    48                 m_Common = m_DictTable.makeRecord();
    49                 select firstonly m_Common;
    50                 
    51                 if (m_Common)
    52                 {
    53                     info(strfmt("Table name: %1, ItemId Name: %2, Group name: %3.", m_DictTable.name(), m_ItemName, m_GroupName));
    54                     info(strfmt("Item: %1, Old group: %2, New group: %3", m_Common.(m_FieldIdItem), m_Common.(m_FieldIdGroup),
    55                                 InventTable::find(m_Common.(m_FieldIdItem)).ItemSubGroupId));
    56                     info("-----------------------------------------------------------------------------");
    57                 }
    58             }
    59         }
    60     }
    61 }
  • 相关阅读:
    ZOJ 3656Bit Magic解题报告——2sat问题建图总结
    gcc和g++的区别
    07车展,流水账。。
    放开思维啊~~~
    SC2和其他
    幻觉~
    去横店咯~
    ETS。。New G。。
    老子毕业鸟。。。
    gcc常用参数和环境变量小结
  • 原文地址:https://www.cnblogs.com/Jinnchu/p/3109747.html
Copyright © 2011-2022 走看看