PowerDesigner 中将Comment(注释)及Name(名称)内容互相COPY的VBS代码
2024-08-29 23:18:58
在用PowerDesigner时.常常在NAME或Comment中写中文在Code中写英文.Name只会显示给我们看,Code会使用在代码中.但Comment中的文字会保存到数据库TABLE的Description中,有时候我们写好了Name再写一次Comment很麻烦.以下两段代码就可以解决这个问题.
使用菜单:"Tools->Execute Commands->Edit/Run Scripts"来执行下面脚本
代码一:将Name中的字符COPY至Comment中
'******************************************************************************
'* File: name2comment.vbs
'* Purpose: Database generation cannot use object names anymore
' in version 7 and above.
' It always uses the object codes.
'
' In case the object codes are not aligned with your
' object names in your model, this script will copy
' the object Name onto the object Comment for
' the Tables and Columns.
'
'* Title:
'* Version: 1.0
'* Company: Sybase Inc.
'******************************************************************************
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
代码二:将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
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
最新文章
- 【跟着子迟品 underscore】for ... in 存在的浏览器兼容问题你造吗
- 20145213《Java程序设计》实验五Java网络编程及安全
- [译] Angular 2 VS. React: 血色将至
- JS和JQUERY的区别
- struts2——通配符
- 数据导出为excel表格
- linux下gitflow辅助工具安装和使用
- C#判断用户是否使用微信浏览器,并据此来显示真实内容或二维码
- MySQL导入数据非常慢的解决办法
- 熟人Dubbo 系列1-Dubbo什么
- 带您了解mysql CONCAT()函数
- 借鉴别人的Oracle 11g安装和卸载图文教程
- MySQL安装目录修改
- fastcgi协议之一:定义
- c++ 指针访问数组
- Android平台下OpenGL图形编程
- BZOJ-3509 母函数+分块+暴力+FFT
- Java中常用的日期操作方法
- Maven的使用入门
- python3条件表达式和字符串
热门文章
- python字典形list 去重复
- 【css】cursor鼠标指针光标样式知识整理
- java util - 中文、繁体转成拼音工具pinyin4j
- 04.VUE学习之v-text v-html
- Java总结 - List实现类ArrayList&;LinkedList
- __setitem__,__getitem,__delitem__的作用
- North American Invitational Programming Contest (NAIPC) 2017
- Appium环境搭建及“fn must be a function”问题解决
- P1198 [JSOI2008]最大数(单调栈)
- 通过js date对象获取各种开始结束日期的示例