在使用PowerDesigner对数据库进行概念模型和物理模型设计时,一般在NAME或Comment中写中文,在Code中写英文。Name用来显 示,Code在代码中使用,但Comment中的文字会保存到数据库Table或Column的Comment中,当Name已经存在的时候,再写一次 Comment很麻烦,可以使用以下代码来解决这个问题:

  • 代码一:将Name中的字符COPY至Comment中

    1. Option   Explicit
    2. ValidationMode   =   True
    3. InteractiveMode   =   im_Batch
    4. Dim   mdl   '   the   current   model
    5. '   get   the   current   active   model
    6. Set   mdl   =   ActiveModel
    7. If   (mdl   Is   Nothing)   Then
    8. MsgBox   "There   is   no   current   Model "
    9. ElseIf   Not   mdl.IsKindOf(PdPDM.cls_Model)   Then
    10. MsgBox   "The   current   model   is   not   an   Physical   Data   model. "
    11. Else
    12. ProcessFolder   mdl
    13. End   If
    14. '   This   routine   copy   name   into   comment   for   each   table,   each   column   and   each   view
    15. '   of   the   current   folder
    16. Private   sub   ProcessFolder(folder)
    17. Dim   Tab   'running     table
    18. for   each   Tab   in   folder.tables
    19. if   not   tab.isShortcut   then
    20. tab.comment   =   tab.name
    21. Dim   col   '   running   column
    22. for   each   col   in   tab.columns
    23. col.comment=   col.name
    24. next
    25. end   if
    26. next
    27. Dim   view   'running   view
    28. for   each   view   in   folder.Views
    29. if   not   view.isShortcut   then
    30. view.comment   =   view.name
    31. end   if
    32. next
    33. '   go   into   the   sub-packages
    34. Dim   f   '   running   folder
    35. For   Each   f   In   folder.Packages
    36. if   not   f.IsShortcut   then
    37. ProcessFolder   f
    38. end   if
    39. Next
    40. end   sub

另外在使用REVERSE ENGINEER从数据库反向生成PDM的时候,PDM中的表的NAME和CODE事实上都是CODE,为了把NAME替换为数据库中Table或Column的中文Comment,可以使用以下脚本:

  • 代码二:将Comment中的字符COPY至Name中

    1. Option   Explicit
    2. ValidationMode   =   True
    3. InteractiveMode   =   im_Batch
    4. Dim   mdl   '   the   current   model
    5. '   get   the   current   active   model
    6. Set   mdl   =   ActiveModel
    7. If   (mdl   Is   Nothing)   Then
    8. MsgBox   "There   is   no   current   Model "
    9. ElseIf   Not   mdl.IsKindOf(PdPDM.cls_Model)   Then
    10. MsgBox   "The   current   model   is   not   an   Physical   Data   model. "
    11. Else
    12. ProcessFolder   mdl
    13. End   If
    14. Private   sub   ProcessFolder(folder)
    15. On Error Resume Next
    16. Dim   Tab   'running     table
    17. for   each   Tab   in   folder.tables
    18. if   not   tab.isShortcut   then
    19. tab.name   =   tab.comment
    20. Dim   col   '   running   column
    21. for   each   col   in   tab.columns
    22. if col.comment="" then
    23. else
    24. col.name=   col.comment
    25. end if
    26. next
    27. end   if
    28. next
    29. Dim   view   'running   view
    30. for   each   view   in   folder.Views
    31. if   not   view.isShortcut   then
    32. view.name   =   view.comment
    33. end   if
    34. next
    35. '   go   into   the   sub-packages
    36. Dim   f   '   running   folder
    37. For   Each   f   In   folder.Packages
    38. if   not   f.IsShortcut   then
    39. ProcessFolder   f
    40. end   if
    41. Next
    42. end   sub

以上两段代码都是VB脚本,在PowerDesigner中使用方法为:

PowerDesigner->Tools->Execute Commands->Edit/Run Scripts

将代码Copy进去执行就可以了,是对整个CDM或PDM进行操作

PowerDesigner 逆向中 Name和Comment互换的更多相关文章

  1. PowerDesigner逆向操作(从mysql5.0生成数据库的物理模型),把Comment写到name中,pdm文件导出为word

    PowerDesigner逆向操作(从mysql5.0生成数据库的物理模型) 环境:powderdesigner12.5:mysql5.0步骤:1. 为指定的数据库配置mysql的ODBC数据源先下载 ...

  2. PowerDesigner 的mysql PDM 的COMMENT注释

    PowerDesigner 的mysql PDM 的COMMENT注释 2012-11-01 15:38 4447人阅读 评论(0) 举报 分类: 数据库相关(7) PowerDesigner 的my ...

  3. android apk 逆向中常用工具一览

    关于apk 逆向中的一些工具的使用,看了不少文章,也使用过有很长一段时间了,今天对此做一总结: 几种文件之间的转换命令: 1. odex -> smali java -jar  baksmali ...

  4. C#中文件和byte[]互换问题

    如何将图片和声音转化成byte[],并通过webservice进行传输?    如何将webservice传输过来的byte[],转化成我们想要的文件?    (一)文件转化为byte[]    方法 ...

  5. 逆向中静态分析工具——IDA初学者笔记之字符串分析

    逆向中静态分析工具——IDA初学者笔记之字符串分析 程序中往往包含很多字符串资源,这些资源存在于PE文件的rdata段,使用IDA反编译后,可以查找到这些字符串, 逆向破解程序通常需要一个突破点,而这 ...

  6. 逆向中静态分析工具——IDA初学者笔记

    逆向中静态分析工具——IDA初学者笔记 //****************************************************************************** ...

  7. 安卓日常开发和逆向中常用的shell命令与非shell命令

    简述shell 命令与 非shell命令区别 shell命令不用先adb shell进入界面执行 非shell命令必须要 adb shell进入界面执行 基础非shell命令 1.安装app adb ...

  8. RPC 技术及其框架 Sekiro 在爬虫逆向中的应用,加密数据一把梭!

    什么是 RPC RPC,英文 RangPaCong,中文让爬虫,旨在为爬虫开路,秒杀一切,让爬虫畅通无阻! 开个玩笑,实际上 RPC 为远程过程调用,全称 Remote Procedure Call, ...

  9. PowerDesigner中NAME和COMMENT的互相转换,需要执行语句

    原文: http://www.cnblogs.com/xnxylf/p/3288718.html 由于PDM 的表中 Name 会默认=Code 所以很不方便, 所以需要将 StereoType 显示 ...

随机推荐

  1. SynchronousQueue类

    介绍 Java 6的并发编程包中的SynchronousQueue是一个没有数据缓冲的BlockingQueue,生产者线程对其的插入操作put必须等待消费者的移除操作take,反过来也一样.不像Ar ...

  2. OpenCV学习笔记——OpenCV安装

    关于OpenCV安装 1.下载和安装OpenCV SDK 在官网:http://opencv.org/上找到OpenCV windows版下载 . 后得到一个 opencv-2.X.X.exe的文件, ...

  3. Ubuntu16.04 安装配置Caffe

    Caffe已经是第三次安装配置了,为什么是第三次呢?因为我实在是低估了深度学习对于硬件的要求.第一次我在自己笔记本上配置的单核,CPU only ...  结果是,样例数据跑了4小时,这还怎么玩?第二 ...

  4. python print 进度条的例子

    def progress(width, percent): print "%s %d%%\r" % (('%%-%ds' % width) % (width * percent / ...

  5. windows下IIS+PHP解决大文件上传500错问题

    linux下改到iis+php后,上传大于2M就出500错,改了php.ini中的upload_max_filesize也不行,最后解决如下: 第一步:修改php.ini 上传大小限制 (以上传500 ...

  6. rsync命令详解

    介绍 rsync命令是一个远程数据同步工具,可通过LAN/WAN快速同步多台主机间的文件.rsync使用所谓的“rsync算法”来使本地和远程两个主机之间的文件达到同步,这个算法只传送两个文件的不同部 ...

  7. 【学】React的学习之旅6-组件的嵌套2

    <input type=text placeholder='aaa'>, placeholder属性是定义文本框在没有输入值之前显示的一段灰色提示 ()=>{}箭头函数在ECMA6里 ...

  8. 1.ARM的基础知识

    ARM简述 ARM公司既不生产芯片也不销售芯片,它只出售芯片技术授权.ARM技术具有很高的性能和功效,因而容易被厂商接受.同时,合作伙伴的增多,可获得更多的第三方工具.制造和软件支持,这又会使整个系统 ...

  9. PLSQL不好用,提示ora-12514 错误解决方法

    我的PLSQL不好用,提示ora-12514 错误时 我分两步干的: 1:用户名,密码,不写,提示错误后,cancel登陆 tools->preference左侧选->connection ...

  10. C#中的继承

    按照我个人的理解,继承和实现接口不是一个概念,结构和类型都可以实现接口,枚举不能. 话说,结构可以继承吗? 先梳理一下C#中的继承关系,如下图: class => [BaseClass => ...