♥ You are here: Home > 心情随笔 > PowerDesigner好用的小脚本

PowerDesigner好用的小脚本

by | 没有评论

首先,不知道PowerDesigner是干啥的就不要往下看了。:)

本文中的脚本执行方式:在PowerDesigner中依次点击:Tools->Execute Commands->Edit/Run Script,粘贴代码到打开窗口的文本框中,点击 Run 按钮即可。

一、复制 Comment To Name
Option Explicit
ValidationMode = True
InteractiveMode = im_Batch
Dim mdl
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)
Dim Tab
for each Tab in folder.tables
if not tab.isShortcut then
if tab.comment <> "" then
tab.name=tab.comment
end if
Dim col
for each col in tab.columns
if col.comment <> "" then
col.name=col.comment
end if
next
end if
next
end sub

二、复制 Name To Comment

Option Explicit

ValidationMode = True

InteractiveMode = im_Batch

Dim mdl

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)

Dim Tab

for each Tab in folder.tables

if not tab.isShortcut then

tab.comment=tab.name

Dim col

for each col in tab.columns

col.comment=col.name

next

end if

next

end sub

三、将主键修改为pk_表名形式

Comments

0 Comments

发表评论