PowerDesigner使用小总结

前言

总结powerdesigner使用技巧,如取消name和code的联动,去掉双引号等,方便中国用户使用

自己使用的PowerDesigner版本为16.5

基础

  • 去掉SQL中的双引号

    按照图片圈出来的部分操作

    修改配置

  • 取消name和code的联动

    依次选择:Tools->General Operations

    出现下图界面,选择Dialog,将图中的复选框选择取消掉

    扫描二维码关注公众号,回复: 4224776 查看本文章
  • 在表中显示name和code

    依次选择:Tools->Display Preferences

    出现下图界面,选择Table,点击Advanced

    根据图中圈出来的部分最终确定显示的列和先后顺序

    最终的显示结果如下:

高级

  • 将name字段值放到comment

    中国用户为了方便理解,在name字段通常使用中文,最终还希望将中文添加到备注当中去。下面的操作步骤非常重要

    1.设计表的时候先不要去添加任何字段的备注,否则一会儿执行脚本将name转换为字段的时候会将之前的备注全部清除掉

    2.执行脚本

    3.添加个性化的备注,比如约定枚举值等

    脚本内容如下:

    '******************************************************************************
    '* File:     name2comment.vbs
    '* Title:    Name to Comment Conversion
    '* Model:    Physical Data Model
    '* Objects: Table, Column, View
    '* Author:   steveguoshao
    '* Created: 2013-11-29
    '* Mod By:   
    '* Modified: 
    '* Version: 1.0
    '* Memo:     Modify from name2code.vbs
    '******************************************************************************
    ​
    ​
    Option   Explicit 
    ValidationMode   =   True 
    InteractiveMode   =   im_Batch
    ​
    ​
    Dim   mdl   '   the   current   model
    ​
    ​
    '   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
    ​
    ​
    '   This   routine   copy   name   into   comment   for   each   table,   each   column   and   each   view 
    '   of   the   current   folder 
    Private   sub   ProcessFolder(folder) 
          Dim   Tab   'running     table 
          for   each   Tab   in   folder.tables 
                if   not   tab.isShortcut   then 
                      tab.comment   =   tab.name 
                      Dim   col   '   running   column 
                      for   each   col   in   tab.columns 
                            col.comment=   col.name 
                      next 
                end   if 
          next
    ​
    ​
          Dim   view   'running   view 
          for   each   view   in   folder.Views 
                if   not   view.isShortcut   then 
                      view.comment   =   view.name 
                end   if 
          next
    ​
    ​
          '   go   into   the   sub-packages 
          Dim   f   '   running   folder 
          For   Each   f   In   folder.Packages 
                if   not   f.IsShortcut   then 
                      ProcessFolder   f 
                end   if 
          Next 
    end   sub

    将上面的内容保存到name2comment.vbs中

    进入脚本执行界面

    打开选择脚本窗口

    选择并执行脚本

    然后查看你的SQL脚本

猜你喜欢

转载自my.oschina.net/u/3049601/blog/1920174