PowerDesigner 把Comment/name 互转
转载:https://www.cnblogs.com/cxd4321/archive/2009/03/07/1405475.html
在使用PowerDesigner对数据库进行概念模型和物理模型设计时,一般在NAME或Comment中写中文,在Code中写英文。Name用来显 示,Code在代码中使用,但Comment中的文字会保存到数据库Table或Column的Comment中,当Name已经存在的时候,再写一次 Comment很麻烦,可以使用以下代码来解决这个问题:
- 代码一:将Name中的字符COPY至Comment中
Option Explicit
ValidationMode = True
InteractiveMode = im_BatchDim 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
nextDim 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_BatchDim 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 IfPrivate 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
nextDim 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进行操作
PowerDesigner 把Comment/name 互转的更多相关文章
- PowerDesigner执行脚本 name/comment/stereotype互转
执行方法:工具栏->Tools -> Execute Commands -> Edit/Run Script (Ctrl+Shift+X) 如下图所示: 1.Name转到Commen ...
- PowerDesigner 把Comment复制到name中和把name复制到Comment
在使用PowerDesigner对数据库进行概念模型和物理模型设计时,一般在NAME或Comment中写中文,在Code中写英文.Name用来显 示,Code在代码中使用,但Comment中的文字会保 ...
- PowerDesigner 把Comment写到name中 和把name写到Comment中 pd7以后版本可用
在使用PowerDesigner对数据库进行概念模型和物理模型设计时,一般在NAME或Comment中写中文,在Code中写英文.Name用来显 示,Code在代码中使用,但Comment中的文字会保 ...
- [转]PowerDesigner 把Comment写到name中 和把name写到Comment中 pd7以后版本可用
http://www.cnblogs.com/cxd4321/archive/2009/03/07/1405475.html 在使用PowerDesigner对数据库进行概念模型和物理模型设计时,一般 ...
- PowerDesigner 中将Comment(注释)及Name(名称)内容互相COPY的VBS代码
在用PowerDesigner时.常常在NAME或Comment中写中文在Code中写英文.Name只会显示给我们看,Code会使用在代码中.但Comment中的文字会保存到数据库TABLE的Desc ...
- PowerDesigner 把Comment写到name中 和把name写到Comment中
在使用PowerDesigner对数据库进行概念模型和物理模型设计时,一般在NAME或Comment中写中文,在Code中写英文.Name用来显 示,Code在代码中使用,但Comment中的文字会保 ...
- 【PowerDesigner】【8】把Comment复制到name中和把name复制到Comment
原因:这两个字段的值很多时候其实是一样的,重写很麻烦 步骤:打开菜单Tools>Execute Commands>Edit/Run Script.. 或者用快捷键 Ctrl+Shift+X ...
- 【PowerDesigner】【7】Table视图显示Comment
原理:把显示name的列的值,替换成注释的值. 步骤:打开菜单Tools>Execute Commands>Edit/Run Script.. 或者用快捷键 Ctrl+Shift+X.将下 ...
- PowerDesigner逆向操作(从mysql5.0生成数据库的物理模型),把Comment写到name中,pdm文件导出为word
PowerDesigner逆向操作(从mysql5.0生成数据库的物理模型) 环境:powderdesigner12.5:mysql5.0步骤:1. 为指定的数据库配置mysql的ODBC数据源先下载 ...
随机推荐
- 二维码生成:使用 JavaScript 库QRCode.js生成二维码
QRCode.js:跨浏览器的javascript二维码生成库,支持html5的Canvas画布,没有任何依赖. Github 地址:https://github.com/davidshimjs/qr ...
- 关于移位运算符>>和<<
首先,移位运算符有三种,其操作类型只支持:byte / short / char / int和long五种. << 左移运算符,表示将左边的操作数的二进制数据向左移动*位,移动后空缺位以0 ...
- ajax之cache血与泪~~
场景:项目以ie5渲染页面,点击导出列表数据(Excel形式),点击导出发送get请求,后台生成Excel文件,返回文件地址信息 异常:ie第一次返回的信息正常,之后返回的都是第一次的结果,googl ...
- 手机APP支付--整合银联支付控件
长话短说,本文根据银联官方说明文档,简单总结下,并且说明下中途碰到问题该如何解决. 一.开发前的准备工作1. 打开https://open.unionpay.com/,后续说的文档下载.FAQ查询等都 ...
- SpringMVC由浅入深day02_8json数据交互
8 json数据交互 8.1 为什么要进行json数据交互 json数据格式在接口调用中.html页面中较常用,json格式比较简单,解析还比较方便. 比如:webservice接口,传输json数据 ...
- iptables相关操作以及简单理解端口和服务之间关系
一般CentOS7默认安装的是firewall不是iptables 1.查看firewall状态 firewall-cmd --state 关闭后显示not running,开启后显示running ...
- 【NGINX】Windows配置
缺省安装nginx之后的配置 检查80端口占用 启动缺省配置之后的nginx 配置多端口站点 注册Server,server_name是配置的域名,proxy_pass是上图配置的代理地址 注意: 1 ...
- gitlab 使用现有 nginx 服务器
gitlab 安装自带 nginx,如果想利用原有 nginx,可按如下操作: 8.0 版本 socket 文件位置有变动,感谢评论区的同学. nginx 增加虚拟主机配置 # gitlab sock ...
- Android学习之BitMap用法实例
下面简单说明了BitMap的用法: 从服务器下载一张图片,显示在ImageView控件上,并将该图片保存在移动设备的SD上. // 根据网络URL获取输入流 public InputStream ge ...
- VMware Workstation 14 黑屏的一个解决办法
近期很多朋友遇到了VMware Workstation 14开启或新建虚拟机后黑屏的现象,同时发现如果挂起虚拟机,可以显示挂起前最后的画面.显然,虚拟机核心是正常工作的,只是“显示”方面出现了问题. ...