zoukankan      html  css  js  c++  java
  • 【转】PowerDesigner表结构和字段大小写转换

    【转自】http://blog.csdn.net/xysh1991/article/details/8016192


    使用方法:进入PowerDesigner,打开一个PDM,在菜单栏找到:Tools – Excute Commands – Edit/Run Script,或者直接按Ctrl+Shift+X调出脚本执行窗口,输入下边的代码就可以了。

    下面提供段代码可以把PowerDesigner中的小写字母变为大写字母。 
    代码如下: 
    Option Explicit  
    ValidationMode = True  
    InteractiveMode = im_Batch  
    Dim mdl ' 当前模型  
    ' 获取当前模型  
    Set mdl = ActiveModel  
    If (mdl Is Nothing) Then  
       MsgBox "没有打开一个模型" 
    ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then  
       MsgBox "当前模型不是一个PDM" 
    Else  
    '调用处理程序  
       ProcessFolder mdl  
    End If    
    '调用的处理程序  
    Private sub ProcessFolder(folder)  
       Dim Tab '要处理的表  
       for each Tab in folder.Tables  
        ' if not Tab.isShortcut then  
            ' Tab.code = tab.name  
            '表名处理,前边添加前缀,字母小写  
            Tab.name=  UCase(Tab.name)  
            Tab.code= UCase(Tab.code)  
             Dim col ' 要处理的列  
             for each col in Tab.columns  
                '列名称和code全部小写,大写诗UCase  
                col.code= UCase(col.code)  
                col.name= UCase(col.name)  
             next  
          'end if 
       next    
    ' 处理视图  
    '  Dim view 'running view  
    '   for each view in folder.Views  
       '   if not view.isShortcut then  
           '  view.code = view.name  
        '  end if 
      ' next     
       ' 递归进入 sub-packages  
       Dim f ' sub  folder  
       For Each f In folder.Packages  
          if not f.IsShortcut then  
             ProcessFolder f  
          end if 
       Next  
    end sub 

    =================================================================================================
    下面提供段代码可以把PowerDesigner中的大写字母变为小写字母。 
    代码如下: 
    Option Explicit  
    ValidationMode = True  
    InteractiveMode = im_Batch  
    Dim mdl ' 当前模型  
    ' 获取当前模型  
    Set mdl = ActiveModel  
    If (mdl Is Nothing) Then  
       MsgBox "没有打开一个模型" 
    ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then  
       MsgBox "当前模型不是一个PDM" 
    Else  
    '调用处理程序  
       ProcessFolder mdl  
    End If    
    '调用的处理程序  
    Private sub ProcessFolder(folder)  
       Dim Tab '要处理的表  
       for each Tab in folder.Tables  
        ' if not Tab.isShortcut then  
            ' Tab.code = tab.name  
            '表名处理,前边添加前缀,字母小写  
            Tab.name=  LCase(Tab.name)  
            Tab.code= LCase(Tab.code)  
             Dim col ' 要处理的列  
             for each col in Tab.columns  
                '列名称和code全部小写,大写诗UCase  
                col.code= LCase(col.code)  
                col.name= LCase(col.name)  
             next  
          'end if 
       next    
    ' 处理视图  
    '  Dim view 'running view  
    '   for each view in folder.Views  
       '   if not view.isShortcut then  
           '  view.code = view.name  
        '  end if 
      ' next     
       ' 递归进入 sub-packages  
       Dim f ' sub  folder  
       For Each f In folder.Packages  
          if not f.IsShortcut then  
             ProcessFolder f  
          end if 
       Next  
    end sub 

    【代码可以就地执行】

  • 相关阅读:
    JS知识点整理
    CSS3疑难问题---6、伪类和伪元素的区别
    人物志---宋霭龄
    范仁义js课程---4、js基本注意点
    legend3---24、软件更新的时候记得保留上两个版本的软件和数据
    心得体悟帖---200215(被动录课效率太低了)
    Java中迭代列表中数据时几种循环写法的效率比较
    Win10
    Java字符串的最大长度
    Android Application对象必须掌握的七点
  • 原文地址:https://www.cnblogs.com/zhzhang/p/3946609.html
Copyright © 2011-2022 走看看