PowerDesigner 把Comment写到name中 和把name写到Comment中 pd7以后版本可用

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

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

    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

--------------------------------------------

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

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


    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

    Private   sub   ProcessFolder(folder)
    On Error Resume Next
          Dim   Tab   'running     table
          for   each   Tab   in   folder.tables
                if   not   tab.isShortcut   then
                      tab.name   =   tab.comment
                      Dim   col   '   running   column
                      for   each   col   in   tab.columns
                      if col.comment="" then
                      else
                            col.name=   col.comment
                      end if
                      next
                end   if
          next

          Dim   view   'running   view
          for   each   view   in   folder.Views
                if   not   view.isShortcut   then
                      view.name   =   view.comment
                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

-----------------------------------------------------------------------

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

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

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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/462246.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

CentOS 6.2 安装教程

一、CentOS简介 CentOS是Linux的发行版之一,它安全、稳定、高效,是我最喜欢的Linux发行版之一。CentOS根据Red Hat Enterprise Linux开放源代码编译而成,与RedHat Linux并没有什么本质上的差别。但Red Hat Enterprise Linux是商业软件&#x…

python-day2

7.字符串操作 capitalize:首字母大写 upper:全大写 lower:全小写 swapcase:大小写翻转 center:居中,空白填充 8.列表的操作 增删改查 增:append\extend 删:pop默认删除最后一位&…

浅入ICE组件编程

转载网页:http://blog.csdn.net/liuxuezong/article/details/26745041 一、ICE介绍 ICE是ZeroC公司开发的一款高效的开源中间件平台,全称是Internet Communications Engine。 它的主要设计目标是: • 提供适用于异种环境的面向对象中间件平台…

好久没有写了,今天就谈谈微信吧!

微信,也算是13年内比较火的东西了,就功能性而言,它的确是一个颠覆性的产品,大家可以想想看,如果你把微信一直运行在手机后台,有人给你语音留言,收到后是一段提醒铃声,这个不是带打电…

去哪儿对垒携程 在线旅游静悄悄的革命

出处:21世纪经济报道 时间:2011-05-11 10:38【 字体: 大 中 小 】 【打印此页】 【关闭】 颠覆与被颠覆的游戏,正于在线旅游市场悄然演绎。 5月10日,携程收报48.3美元,市值71.42亿美元,在赴美上…

Mybatis一级缓存和二级缓存 Redis缓存

一级缓存 Mybatis的一级缓存存放在SqlSession的生命周期,在同一个SqlSession中查询时,Mybatis会把执行的方法和参数通过算法生成缓存的键值,将键值和查询结果存入一个Map对象中。如果同一个SqlSession中执行的方法和参数完全一致,…

关于数据库查询优化的思考

举一个例子,我现在有一些新闻信息,它包括这些字段;新闻ID,新闻Name,新闻ShortIntro,新闻Detail,新闻PublishTime。我现在要把它存放在数据库中,然后从数据库中将其取出来放在GridVie…

mysql添加远程登陆权限及mysql远程连接命令

mysql添加远程登陆权限及mysql远程连接命令 1、mysql使用本身环境下面mysql数据库中的user表来管理用户及权限 mysql> use mysql;Database changedmysql> select user,host from user;-----------------| user | host |-----------------| root | 127.0.0.1 || …

linux下编译jrtplib-3.9.1

网站:http://blog.csdn.net/caoshangpa/article/details/51416822 一、下载jrtplib、jthread、CMake jrtplib:http://research.edm.uhasselt.be/jori/jrtplib/jrtplib-3.9.1.zip jthread:http://research.edm.uhasselt.be/jori/jthread/jthre…

【链接】Solr的Filed中indexed与stored属性

Solr的Filed中indexed与stored属性转载于:https://www.cnblogs.com/xiaostudy/p/11105554.html

mysql从入门到精通之数据库基本概念理解

生活中的记账,帐:就是数据,或者简单理解为信息吧。记账:就是存储数据、信息生活中记账都是记在哪儿呢?比如:门上、墙上、日历上无论记在哪儿?特点:记录的都是信息,变化的…

Eclipse WTP 使用入门

什么是WTP?WTP (Web Tools Platform) 是一个开发J2EE Web应用程序的工具集。用了太长时间的MyEclipse难免想换换口味,引用一段官方的描述来介绍WTP:The Eclipse Web Tools Platform (WTP) project extends the Eclipse platform with tools for developi…

linux uuid/uuid.h

我的错误信息 ...... global1.cpp:39:23: uuid/uuid.h: No such file or directory global1.cpp: In static member function static QUuid Global::generateUuid(): global1.cpp:188: ::uuid_generate undeclared (first use here) make[1]: *** [.obj/linux-generic-g//globa…

__int64

如果要处理很大的数据,long long这类数据类型也不管用,这时就要用到__int64,输出格式是在原有的格式前加入I64如%I64d转载于:https://www.cnblogs.com/ssNiper/p/11109100.html

Js控制弹窗实现在任意分辨率下居中显示

弹窗居中比较烦人的是怎么才能在任意分辨率下实现居中显示。1&#xff0c;html部分 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns"http://www…

兼容IE与firefox的css 线性渐变(linear-gradient)

IE系列 filter: progid:DXImageTransform.Microsoft.Gradient(startColorStr#FF0000,endColorStr#F9F900,gradientType0);参数&#xff1a;startColorStr起始颜色 endColorStr结束颜色 gradientType为0时代表垂直&#xff0c;为1时代表水平 Firefox background: -moz-linear-gr…

windbg 常用命令详解

&#xfeff;&#xfeff;一、 1、 !address eax 查看对应内存页的属性 2、 vertarget 显示当前进程的大致信息 3 !peb 显示process Environment Block 4、 lmvm 可以查看任意一个dll的详细信息 例如&#xff1a;我们查看cyusb.sys的信息 5.reload !sym 加载符号文件 6…

JS 与Flex交互:html中的js 与flex中的actionScript通信

Flex与JavaScript交互的问题&#xff0c;这里和大家分享一下&#xff0c;主要包括Flex调用JavaScript中的函数和JavaScript调用Flex中的函数两大部分内容。 Flex 与JavaScript 交互&#xff0c;主要依靠Flex的ExternalInterface&#xff0c;其提供了addCallBack和call方法。 一…

poj3615

floyd水题&#xff0c;将map[i][j]理解为从i到j的路径中高度最小即可&#xff0c;将松弛条件改为map[i][j]MIN(map[i][j],MAX(map[i][k],map[k][j]));好好理解一下吧 View Code 1 #include <stdio.h> 2 #include <string.h> 3 #define MAXN 310 4 #define INF (1&…

H264码流打包分析(精华)

网页&#xff1a;https://www.cnblogs.com/lidabo/p/4602422.htmlH264码流打包分析SODB 数据比特串&#xff0d;&#xff0d;&#xff1e;最原始的编码数据RBSP 原始字节序列载荷&#xff0d;&#xff0d;&#xff1e;在SODB的后面填加了结尾比特&#xff08;RBSP trailing b…