使用PowerDesigner对NAME和COMMENT互相转换
本文来自我的github pages博客http://galengao.github.io/ 即www.gaohuirong.cn
在使用PowerDesigner对数据库进行概念模型和物理模型设计时,一般在NAME或Comment中写中文,在Code中写英文。Name用来显 示,Code在代码中使用,但Comment中的文字会保存到数据库Table或Column的Comment中,当Name已经存在的时候,再写一次 Comment很麻烦,可以使用以下代码来解决这个问题。
在PowerDesigner中使用方法为:
PowerDesigner->Tools->Execute Commands->Edit/Run Scripts
将代码Copy进去执行就可以了,是对整个CDM或PDM进行操作
代码一:将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
使用PowerDesigner对NAME和COMMENT互相转换的更多相关文章
- PowerDesigner中NAME和COMMENT的互相转换,需要执行语句
原文: http://www.cnblogs.com/xnxylf/p/3288718.html 由于PDM 的表中 Name 会默认=Code 所以很不方便, 所以需要将 StereoType 显示 ...
- PowerDesigner中NAME和COMMENT的互相转换
原文: http://www.cnblogs.com/yelaiju/archive/2013/04/26/3044828.html 由于PDM 的表中 Name 会默认=Code 所以很不方便, 所 ...
- PowerDesigner设计Name和Comment 替换
这两天在用powerdesigner设计数据库.一直以为name就是注释名字来着.后来生成sql语句 怎么就没有注释信息那. 后来看了半天才知道自己范2了. 通过各种信息查找.大多都是改databas ...
- PowerDesigner 同步Name到Comment 及 同步 Comment 到Name
PowerDesigner中使用方法为: PowerDesigner->Tools->Execute Commands->Edit/Run Scripts 代码一:将Name ...
- 转载 - PowerDesigner(CDM—PDM—SQL脚本的转换流程)
出处: http://jbeduhai.iteye.com/blog/338579 由于图片复制上去不显示,如想看内容及图片详情,请下载附件 PowerDesigner数据模型(CDM—PDM—SQL ...
- PowerDesigner执行脚本 name/comment/stereotype互转
执行方法:工具栏->Tools -> Execute Commands -> Edit/Run Script (Ctrl+Shift+X) 如下图所示: 1.Name转到Commen ...
- [转]PowerDesigner表结构和字段大小写转换
原文地址:https://blog.csdn.net/u010216641/article/details/48712503 ##PowerDesigner去除双引号## 平时经常用PowerDesi ...
- 【转】PowerDesigner表结构和字段大小写转换
[转自]http://blog.csdn.net/xysh1991/article/details/8016192 使用方法:进入PowerDesigner,打开一个PDM,在菜单栏找到:Tools ...
- powerDesigner的name和comment转化
name2comment.vbs '****************************************************************************** '* ...
随机推荐
- 利用xcode生成的app生成可以在iphone和itouch上运行的ipa安装包
在编译好的真机版目录下的.app文件,至于生成真机可以运行的app的方法,有两种方式,一种是交99美元获得一个证书,另外一种是破解的方式,在此不再详述,本文假设你已经生成了真机上可以运行的app包了( ...
- 通读cheerio API ——NodeJs中的jquery
通读cheerio API ——NodeJs中的jquery 所谓工欲善其事,必先利其器,所以通读了cheerio的API,顺便翻译了一遍,有些地方因为知道的比较少,不知道什么意思,保留了英文,希望各 ...
- Java进阶篇(五)——Java的I/O技术
程序中,为了永久的保存创建的数据,需要将其保存在磁盘文件中,以便在其它程序中使用它们.Java的I/O技术可以将数据保存到文本文件.二进制文件甚至是ZIP压缩文件中,以达到永久性保存数据的要求. 本篇 ...
- 了解JDK 6和JDK 7中substring的原理及区别
substring(int beginIndex, int endIndex)方法在jdk 6和jdk 7中的实现是不同的.了解他们的区别可以帮助你更好的使用他.为简单起见,后文中用substring ...
- python_如何快速安装第三方库?
如何快速安装第三方库? 通过python 豆瓣园源https://pypi.douban.com/simple/进行安装,利用国内网速 如何安装? pip -i install https://pyp ...
- java.lang.IllegalArgumentException: Document base D:\Project\workspace\space\.metadata\.plugins\org.eclipse.wst.server.core\tmp7\wtpwebapps\Blog
java.lang.IllegalArgumentException: Document base D:\Project\workspace\space\.metadata\.plugins\org. ...
- JDK自带的日志Logging
OK,现在我们来研究下JDK自带的日志Logger. 从jdk1.4起,JDK开始自带一套日志系统.JDK Logger最大的优点就是不需要任何类库的支持,只要有Java的运行环境就可以使用. 相对于 ...
- cJSON使用
cJSON是使用C语言编写的 关于JSON数据的 编解码库,使用方便简单 编译时注意后面要跟-lm参数,否则编译会报错 解析JSON数据包流程: 1.调用cJSON_Parse()函数,解析J ...
- 一步一步从原理跟我学邮件收取及发送 8.EHLO 命令详解
我们在上一篇中解决了接收一行命令的问题后,就可以来具体的分析邮件发送过程中涉及到的 SMTP 协议内容了. 首先来看通讯过程中的第一个内容:服务器在客户端连接上来后会主动发送一个问好的信息,所以这第一 ...
- tp5命令行基础
命令行工具需要在命令行下面执行,请先确保你的php.exe已经加入了系统环境变量Path. 要执行命令,首先进入命令行,并切换当前目录到应用的根目录(也就是think文件所在目录)下面,执行: php ...