PowerDesigner中一些有用的设置

来源:互联网 发布:python list转为str 编辑:程序博客网 时间:2024/05/21 20:25

sql语句中表名与字段名前的引号去除: 

打开cdm的情况下,进入Tools-Model Options-Naming Convention,把Name和Code的标签的Charcter case选项设置成Uppercase或者Lowercase,只要不是Mixed Case就行! 
或者选择Database->Edit current database->Script->Sql->Format,有一项CaseSensitivityUsingQuote,它的 comment为“Determines if the case sensitivity for identifiers is managed using double quotes”,表示是否适用双引号来规定标识符的大小写, 可以看到右边的values默认值为“YES”,改为“No”即可! 
或者在打开pdm的情况下,进入Tools-Model Options-Naming Convention,把Name和Code的标签的Charcter case选项设置成Uppercase就可以! 
----------------------------------------------------------------------------------------------------------------------------------

在修改name的时候,code的值将跟着变动,很不方便 

修改方法:PowerDesign中的选项菜单里修改,在[Tool]-->[General Options]->[Dialog]->[Operating modes]->[Name to Code mirroring],这里默认是让名称和代码同步,将前面的复选框去掉就行了。 
----------------------------------------------------------------------------------------------------------------------------------

由pdm生成建表脚本时,字段超过15字符就发生错误(oracle) 

原因未知,解决办法是打开PDM后,会出现Database的菜单栏,进入Database - Edit Current DBMS -script-objects-column-maxlen,把value值调大(原为30),比如改成60。出现表或者其它对象的长度也有这种错误的话都可以选择对应的objects照此种方法更改! 
或者使用下面的这种方法: 
生成建表脚本时会弹出Database generation提示框:把options - check model的小勾给去掉,就是不进行检查(不推荐)! 
或者可以修改C:\Program Files\Sybase\PowerDesigner Trial 11\Resource Files\DBMS\oracl9i2.xdb文件 
修改好后,再cdm转为pdm时,选择“Copy the DBMS definition in model”把把这个资源文件拷贝到模型中。 
----------------------------------------------------------------------------------------------------------------------------------

修改外键命名规则

选择Database—>Edit Current DBMS

选择Scripts-》Objects-》Reference-》ConstName
可以发现右侧的Value为:

FK_%.U8:CHILD%_%.U9:REFR%_%.U8:PARENT%

可见,该命名方法是:'FK_'+8位子表名+9位Reference名+8位父表名,你可以根据这中模式自定义为:

FK_%.U7:CHILD%_RELATIONS_%.U7:PARENT%,

可以使FK名称变为FK_TABLE_2_RELATIONS_TABLE_1
掌握这种方法后就可以按照自己的想法修改了

生成建库脚本SQL文件中的表头注释很讨厌,可以在 Databse -> Generate Database (Ctrl+G)窗口中,选择Options卡片,去掉Usage的Title钩选项即可。

----------------------------------------------------------------------------------------------------------------------------------

建立一个表后,为何检测出现Existence of index的警告 
A table should contain at least one column, one index, one key, and one reference. 
可以不检查 Existence of index 这项,也就没有这个警告错误了! 
意思是说没有给表建立索引,而一个表一般至少要有一个索引,这是一个警告,不用管也没有关系! 
----------------------------------------------------------------------------------------------------------------------------------

如何防止一对一的关系生成两个引用(外键) 
要定义关系的支配方向,占支配地位的实体(有D标志)变为父表。 
在cdm中双击一对一关系->Detail->Dominant role选择支配关系 
----------------------------------------------------------------------------------------------------------------------------------

修改报表模板中一些术语的定义 
即文件:C:\Program Files\Sybase\PowerDesigner Trial 11\Resource Files\Report Languages\Chinese.xrl 
Tools-Resources-Report Languages-选择Chinese-单击Properties或双击目标 
修改某些对象的名称:Object Attributes\Physical Data Model\Column\ 
ForeignKey:外键 
Mandatory:为空 
Primary:主键 
Table:表 
用查找替换,把“表格”替换成“表” 
修改显示的内容为别的:Values Mapping\Lists\Standard,添加TRUE的转化列为是,FALSE的转化列为空 
另外Report-Title Page里可以设置标题信息
----------------------------------------------------------------------------------------------------------------------------------

 
批量根据对象的name生成comment的脚本

执行方法:Open PDM -- Tools -- Execute Commands -- Run Script

Option ExplicitValidationMode = TrueInteractiveMode = im_BatchDim mdl 'the current model'get the current active modelSet mdl = ActiveModelIf (mdl Is Nothing) ThenMsgBox "There is no current Model"ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) ThenMsgBox "The current model is not an Physical Data model."ElseProcessFolder mdlEnd If'This routine copy name into code for each table, each column and each view'of the current folderPrivate sub ProcessFolder(folder)Dim Tab 'running tablefor each Tab in folder.tablesif not tab.isShortcut thentab.comment = tab.nameDim col 'running columnfor each col in tab.columnscol.comment= col.namenextend ifnextDim view 'running viewfor each view in folder.Viewsif not view.isShortcut thenview.comment = view.nameend ifnext'go into the sub-packagesDim f 'running folderFor Each f In folder.Packagesif not f.IsShortcut thenProcessFolder fend ifNextend sub

逆向工程将数据库中comment脚本赋值到PDM的name

执行方法:Open PDM -- Tools -- Execute Commands -- Run Script

Option ExplicitValidationMode = TrueInteractiveMode = im_BatchDim mdl 'the current model'get the current active modelSet mdl = ActiveModelIf (mdl Is Nothing) ThenMsgBox "There is no current Model"ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) ThenMsgBox "The current model is not an Physical Data model."ElseProcessFolder mdlEnd If'This routine copy name into code for each table, each column and each view'of the current folderPrivate sub ProcessFolder(folder)Dim Tab 'running tablefor each Tab in folder.tablesif not tab.isShortcut thenif len(tab.comment) <> 0 thentab.name = tab.commentend ifOn Error Resume NextDim col 'running columnfor each col in tab.columnsif len(col.comment) <>0 thencol.name =col.commentend ifOn Error Resume Nextnextend ifnextend sub

删除概念模型中没用的Data Items

'*****************************************************************************'文件:Delete useless data items.vbs'版本:1.0'版权:floodzhu (floodzhu@hotmail.com),2005.1.6'功能:遍历概念模型,把无用的Data Items删除。'*****************************************************************************dim indexindex = 0dim model 'current modelset model = ActiveModelIf (model Is Nothing) Then   MsgBox "当前没有活动的模型。"ElseIf Not model.IsKindOf(PdCDM.cls_Model) Then   MsgBox "当前模型不是概念模型。"Else   View model   MsgBox index & "个无用字段被删除。"End If'*****************************************************************************'函数:View'功能:递归遍历'*****************************************************************************sub View(folder)   dim item   for each item in folder.DataItems      if not item.IsShortCut then         Visit item      end if   next     '对子目录进行递归   dim subFolder   for each subFolder in folder.Packages      View subFolder   nextend sub'*****************************************************************************'函数:Visit'功能:处理节点'*****************************************************************************sub Visit(node) if node.UsedBy="" then      node.delete      index = index + 1   end ifend sub



0 0
原创粉丝点击