您的位置:首页 > 数据库 > Oracle

oracle_powerdesinger逆向工程 , PDM 文件 注释到name的完美解决方案 comment2name

2013-11-22 11:46 471 查看
1、从oracle到PDM文件逆向工程中,需要注意去掉“”,这个百度下很多帖子,用于去掉引号

2、从注释copy到name运行脚本会有个问题就是,有些注释太长,不美观

解决方案,vb脚本判断注释中是否含有空格,如果含有去以空格spilt后的数组的第一个为name,要求写注释时描述性文字在字段名字后要以空格分开例如

code:flag。库中comment:标志位:【1、有效】【0、无效】默认【1】

这样逆向工程出来的效果



3运行脚本如下[运行方法,选中pdm文件中的表ctrl+shift+X,粘贴复制run]

commet2namePerfect.vbs



'******************************************************************************
'*File:commet2namePerfect.vbs
'*Title:commettoNameConversion
'*Purpose:To
'
'*Model:PhysicalDataModelforReverseEnginner
'*Category:NamingStandards
'*Author:cphmvp
'*Created:Nov22,2013
'*ModBy:
'*Modified:
'*Version:1.0
'*Comment:
'*v1.0-MusthaveConversionTablesassignedasamodeloption
'******************************************************************************

OptionExplicit
ValidationMode=True
InteractiveMode=im_Batch

Dimmdl'thecurrentmodel

'getthecurrentactivemodel
Setmdl=ActiveModel
If(mdlIsNothing)Then
MsgBox"ThereisnocurrentModel"
ElseIfNotmdl.IsKindOf(PdPDM.cls_Model)Then
MsgBox"ThecurrentmodelisnotanPhysicalDatamodel."
Else
ProcessFoldermdl
EndIf

'Thisroutinecopynameintocodeforeachtable,eachcolumnandeachview
'ofthecurrentfolder
PrivatesubProcessFolder(folder)

DimTab'runningtable
foreachTabinfolder.tables
ifnottab.isShortcutthen
iflen(tab.comment)<>0then
tab.name=tab.comment
endif
ifinstr(tab.comment,"")>0then
tab.name=split(tab.comment,"")(0)
endif
OnErrorResumeNext
Dimcol'runningcolumn
foreachcolintab.columns
iflen(col.comment)<>0then
col.name=col.comment
endif
ifinstr(col.comment,"")>0then
col.name=split(col.comment,"")(0)
endif
OnErrorResumeNext
next
endif
next
endsub





                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: