PowerDesigner可以将PDM的NAME值写入数据库的PBCATCOL表中相应的几个字段,但我现在通过PD的Resever Engineer功能将数据库的表反向到PDM中,怎样才能使当时生成在表PBCATCOL中的相应NAME值同时反向到PDM的NAME(我想要是的中文)。
先谢了!
先谢了!
回复人:不愿放弃(byfq)
2004-12-2 12:36:37
PowerDesigner数据库系统分析设计与应用 姜江著 一书中写有,有点复杂,记不清楚了,你可以找找看看
回复人:阿飞(nbnasom)
2004-12-3 14:37:37
学习ING
回复人:【最后一滴水】(am2000)
2004-12-4 22:33:52
Tools-PowerBuilder-Reverse Extended Attributes
回复人:【最后一滴水】(am2000)
2004-12-4 23:33:48
我也碰到这个问题。
我现已通过逆向工程将数据库中的LABEL、HEADER、COMMENT逆向到PDM的Extended attributes中了。
但我不知道如何将Label赋值到NAME.
我现已通过逆向工程将数据库中的LABEL、HEADER、COMMENT逆向到PDM的Extended attributes中了。
但我不知道如何将Label赋值到NAME.
回复人:【最后一滴水】(am2000)
2004-12-4 23:45:44
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 code for each table, each column and each view
' of the current folder
Private sub ProcessFolder(folder)
dim ls_NameTemp
Dim Tab 'running table
for each Tab in folder.tables
if not tab.isShortcut then
'tab.code = tab.name
if instr(Tab.name," ") > 0 then
ls_NameTemp = Mid(Tab.name,1,instr(Tab.name," ") - 1 )
else
if instr(Tab.name," ") > 0 then
ls_NameTemp = Mid(Tab.name,1,instr(Tab.name," ") - 1 )
else
ls_NameTemp = Tab.name
end if
end if
if len(ls_NameTemp) < 8 then
Tab.name = ls_NameTemp + Space( 8 - len(ls_NameTemp) ) + Tab.code
else
Tab.name = ls_NameTemp + Space( 2 ) + Tab.code
'考虑名称相同出现的异常
end if
On Error Resume Next
Dim col ' running column
for each col in tab.columns
'col.code= col.name
if instr(col.name," ") > 0 then
ls_NameTemp = Mid(col.name,1,instr(col.name," ") - 1 )
else
if instr(col.name," ") > 0 then
ls_NameTemp = Mid(col.name,1,instr(col.name," ") - 1 )
else
ls_NameTemp = col.name
end if
end if
if len(ls_NameTemp) < 6 then
'col.name = ls_NameTemp + Space( (8 - len(ls_NameTemp)) * 2 ) + col.code
col.name = ls_NameTemp + left( " ",6 - len(ls_NameTemp) ) + col.code
else
'col.name = ls_NameTemp + Space(2) + col.code
col.name = ls_NameTemp + left( " ",1) + col.code
'考虑名称相同出现的异常
end if
On Error Resume Next
next
end if
next
Dim view 'running view
for each view in folder.Views
if not view.isShortcut then
'view.code = view.name
if instr(view.name," ") > 0 then
ls_NameTemp = Mid(view.name,1,instr(view.name," ") - 1 )
else
if instr(view.name," ") > 0 then
ls_NameTemp = Mid(view.name,1,instr(view.name," ") - 1 )
else
ls_NameTemp = view.name
end if
end if
if len(ls_NameTemp) < 8 then
view.name = ls_NameTemp + Space( 8 - len(ls_NameTemp) ) + view.code
else
view.name = ls_NameTemp + Space( 2 ) + view.code
'考虑名称相同出现的异常
end if
On Error Resume Next
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
' This routine copy name into code for each table, each column and each view
' of the current folder
Private sub ProcessFolder(folder)
dim ls_NameTemp
Dim Tab 'running table
for each Tab in folder.tables
if not tab.isShortcut then
'tab.code = tab.name
if instr(Tab.name," ") > 0 then
ls_NameTemp = Mid(Tab.name,1,instr(Tab.name," ") - 1 )
else
if instr(Tab.name," ") > 0 then
ls_NameTemp = Mid(Tab.name,1,instr(Tab.name," ") - 1 )
else
ls_NameTemp = Tab.name
end if
end if
if len(ls_NameTemp) < 8 then
Tab.name = ls_NameTemp + Space( 8 - len(ls_NameTemp) ) + Tab.code
else
Tab.name = ls_NameTemp + Space( 2 ) + Tab.code
'考虑名称相同出现的异常
end if
On Error Resume Next
Dim col ' running column
for each col in tab.columns
'col.code= col.name
if instr(col.name," ") > 0 then
ls_NameTemp = Mid(col.name,1,instr(col.name," ") - 1 )
else
if instr(col.name," ") > 0 then
ls_NameTemp = Mid(col.name,1,instr(col.name," ") - 1 )
else
ls_NameTemp = col.name
end if
end if
if len(ls_NameTemp) < 6 then
'col.name = ls_NameTemp + Space( (8 - len(ls_NameTemp)) * 2 ) + col.code
col.name = ls_NameTemp + left( " ",6 - len(ls_NameTemp) ) + col.code
else
'col.name = ls_NameTemp + Space(2) + col.code
col.name = ls_NameTemp + left( " ",1) + col.code
'考虑名称相同出现的异常
end if
On Error Resume Next
next
end if
next
Dim view 'running view
for each view in folder.Views
if not view.isShortcut then
'view.code = view.name
if instr(view.name," ") > 0 then
ls_NameTemp = Mid(view.name,1,instr(view.name," ") - 1 )
else
if instr(view.name," ") > 0 then
ls_NameTemp = Mid(view.name,1,instr(view.name," ") - 1 )
else
ls_NameTemp = view.name
end if
end if
if len(ls_NameTemp) < 8 then
view.name = ls_NameTemp + Space( 8 - len(ls_NameTemp) ) + view.code
else
view.name = ls_NameTemp + Space( 2 ) + view.code
'考虑名称相同出现的异常
end if
On Error Resume Next
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