zoukankan      html  css  js  c++  java
  • PowerDesigner 使用小结

      这里总结一篇关于数据建模工具 PowerDesigner 的使用小技巧,下面列出的两个应用场景要在网上现找解决方案的话还真不一定好找,所以选择将这两个棘手的问题先记下来。

    1. PDM 中表间关系出现多引用情况

      这种情况一般是在由 LDM 生成 PDM 时,对于一对一联系,没有指定主从表关系,如图:

      

      导致生成的 PDM 中出现一对一关系出现两个引用:

      

        如果指定了 Dominant role ,则只会产生一个引用:

      

      

    2. 去外键问题

      默认情况下,通过 PDM 生成数据库初始化脚本时会带有外键生成脚本,如下:

      如果在 PDM 的关系属性中将 Generate 后面的钩去掉则可解决(话说这个问题还卡了蛮长时间,最后是一个老工程师指点的)

      

    3. 在 PDM 中将字段命名格式改成下划线分隔形式

      需要进行操作: Tools -> Excute Commands -> Edit/Run Script , 如下图:

      

      选择执行脚本文件: ToLowerCase.vbs :

      

      

      最后点击 Run 即可,点完不会有任何弹窗予以提示,可直接点击 PDM 中的表查看。这里将 ToLoweCase.vbs 中的代码共享一下:

    Option Explicit
    ValidationMode = True
    InteractiveMode = im_Batch
    
    Dim mdl ' the current model
    Dim i
    
    ' get the current active model
    Set mdl = ActiveModel
    If (mdl Is Nothing) Then
       MsgBox "There is no current Model"
    ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
       MsgBox "The current model is not an Physical Data model."
    Else
       ProcessFolder mdl
    End If
    
    Private Function ToLowerCase(input)
      Dim result, ch, prevIsUpper
      result = ""
      For i = 1 to Len(input)
        ch = Mid(input, i, 1)
        If Asc(ch) < 91 And Asc(ch) > 64 Then
          If i > 1 And Not prevIsUpper Then
            result = result + "_"        
          End If
          result = result + LCase(ch)
          prevIsUpper = True
        Else
          result = result + ch
          prevIsUpper = False
        End If
      Next
      ToLowerCase = result
    End Function
    
    ' This routine copies the name into code for each table, column and view
    ' of the current folder
    Private sub ProcessFolder(folder)
       Dim Tab 'running  table
       Dim rc 'return code
    
       for each Tab in folder.tables
          if not tab.isShortcut then         
             tab.Code = ToLowerCase(tab.Code)
             'output ToLowerCase(tab.Code)
             Dim col ' running column
             for each col in tab.columns            
                col.Code = ToLowerCase(col.Code)
                'output ToLowerCase(col.Code)
             next
          end if
       next
    end sub
  • 相关阅读:
    iOS集成ijkplayer视频直播框架,遇到的bug和坑...
    push notification获取device token
    ios xcode Code signing failed 解决方案
    ios 返回指定导航控制器
    ios git 终端提交
    mysql问题集合
    mysql 备份和恢复
    cacti 异常问题
    硬盘各项检测
    LVS DR模式(直接路由模式)
  • 原文地址:https://www.cnblogs.com/binye-typing/p/8870086.html
Copyright © 2011-2022 走看看