POWERDESIGNER 常用設(shè)置
sql語(yǔ)句中表名與字段名前的引號(hào)去除:
打開(kāi)cdm的情況下,進(jìn)入Tools-Model Options-Naming Convention,把Name和Code的標(biāo)簽的Charcter case選項(xiàng)設(shè)置成Uppercase或者Lowercase,只要不是Mixed Case就行!
或者選擇Database->Edit current database->Script->Sql->Format,有一項(xiàng)CaseSensitivityUsingQuote,它的 comment為“Determines if the case sensitivity for identifiers is managed using double quotes”,表示是否適用雙引號(hào)來(lái)規(guī)定標(biāo)識(shí)符的大小寫(xiě), 可以看到右邊的values默認(rèn)值為“YES”,改為“No”即可!
或者在打開(kāi)pdm的情況下,進(jìn)入Tools-Model Options-Naming Convention,把Name和Code的標(biāo)簽的Charcter case選項(xiàng)設(shè)置成Uppercase就可以!
?
在修改name的時(shí)候,code的值將跟著變動(dòng),很不方便
修改方法:PowerDesign中的選項(xiàng)菜單里修改,在[Tool]-->[General Options]->[Dialog]->[Operating modes]->[Name to Code mirroring],這里默認(rèn)是讓名稱和代碼同步,將前面的復(fù)選框去掉就行了。
?
由pdm生成建表腳本時(shí),字段超過(guò)15字符就發(fā)生錯(cuò)誤(oracle)
? 原因未知,解決辦法是打開(kāi)PDM后,會(huì)出現(xiàn)Database的菜單欄,進(jìn)入Database - Edit Current DBMS -script-objects-column-maxlen,把value值調(diào)大(原為30),比如改成60。出現(xiàn)表或者其它對(duì)象的長(zhǎng)度也有這種錯(cuò)誤的話都可以選擇對(duì)應(yīng)的objects照此種方法更改!
或者使用下面的這種方法:
???? 生成建表腳本時(shí)會(huì)彈出Database generation提示框:把options - check model的小勾給去掉,就是不進(jìn)行檢查(不推薦)!
??? 或者可以修改C:Program FilesSybasePowerDesigner Trial 11Resource FilesDBMSoracl9i2.xdb文件
???? 修改好后,再cdm轉(zhuǎn)為pdm時(shí),選擇“Copy the DBMS definition in model”把把這個(gè)資源文件拷貝到模型中。
?
由CDM生成PDM時(shí),自動(dòng)生成的外鍵的重命名
PDM Generation Options->Detail->FK index names默認(rèn)是%REFR%_FK,改為FK_%REFRCODE%,其中%REFRCODE%指的就是CDM中Relationship的code!另外自動(dòng)生成的父字段的規(guī)則是PDM Generation Options->Detail->FK column name template中設(shè)置的,默認(rèn)是%.3:PARENT%_%COLUMN%,可以改為Par%COLUMN%表示是父字段!
?
?建立一個(gè)表后,為何檢測(cè)出現(xiàn)Existence of index的警告
??? A table should contain at least one column, one index, one key, and one reference.
可以不檢查 Existence of index 這項(xiàng),也就沒(méi)有這個(gè)警告錯(cuò)誤了!
意思是說(shuō)沒(méi)有給表建立索引,而一個(gè)表一般至少要有一個(gè)索引,這是一個(gè)警告,不用管也沒(méi)有關(guān)系!
?
如何防止一對(duì)一的關(guān)系生成兩個(gè)引用(外鍵)
要定義關(guān)系的支配方向,占支配地位的實(shí)體(有D標(biāo)志)變?yōu)楦副怼?br />在cdm中雙擊一對(duì)一關(guān)系->Detail->Dominant role選擇支配關(guān)系
?
修改報(bào)表模板中一些術(shù)語(yǔ)的定義
即文件:C:Program FilesSybasePowerDesigner Trial 11Resource FilesReport LanguagesChinese.xrl
Tools-Resources-Report Languages-選擇Chinese-單擊Properties或雙擊目標(biāo)
修改某些對(duì)象的名稱:Object AttributesPhysical Data ModelColumn
??????? ForeignKey:外鍵
??????? Mandatory:為空
??????? Primary:主鍵
??????? Table:表
用查找替換,把“表格”替換成“表”
修改顯示的內(nèi)容為別的:Values MappingListsStandard,添加TRUE的轉(zhuǎn)化列為是,F(xiàn)ALSE的轉(zhuǎn)化列為空
另外Report-Title Page里可以設(shè)置標(biāo)題信息
?
PowerDesigner11中批量根據(jù)對(duì)象的name生成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:??? 把對(duì)象name拷入comment屬性中
'* Version:? 1.0
'* Author:
'* 執(zhí)行方法:PD11 -- Open PDM -- Tools --? Execute Commands -- Run Script
'******************************************************************************
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 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
?
PowerDesigner 生成SQL的Existence of refernce錯(cuò)誤問(wèn)題
現(xiàn)象:用PowerDesigner生成SQL語(yǔ)句時(shí),提示Existence of refernce錯(cuò)誤。
原因:該表沒(méi)有與其他表的關(guān)聯(lián)(如外鍵等),而PowerDesigner需要存在一個(gè)refernce才能生成SQL.
解決方法:
??? 在工具欄空白處右鍵打開(kāi)Palette面板,選中Link/Extended Dependency 按鈕,然后在提示出錯(cuò)的表上添加到自己的Dependency。
??? 重新生成SQL,你將發(fā)現(xiàn)剛才提示的錯(cuò)誤沒(méi)有了,問(wèn)題解決。
???
利用PowerDesigner批量生成測(cè)試數(shù)據(jù)
主要解決方法:
A:在PowerDesigner 建表
B:然后給每一個(gè)表的字段建立相應(yīng)的摘要文件
步驟如下:
Model->Test Data Profiles配置每一個(gè)字段摘要文件General:輸入Name、Code、
選擇Class(數(shù)字、字符、時(shí)間)類型
選擇Generation Source: Automatic、List、ODBC、File Detail:配置字段相關(guān)信息
所有字段摘要文件配置完成后雙擊該表->選擇字段->Detail->選擇Test Data Parameters 摘要文件如果字段值與其它字段有關(guān)系在: Computed Expression 中輸入計(jì)算列--生成測(cè)試數(shù)據(jù):
DataBase->Generation Test Data->
選擇:Genration 類型(Sript、ODBC)
???? Selection(選擇要生成的表)
???? Test Data Genration(Default number of rows 生成記錄行數(shù))
用心對(duì)待身邊的一切,一切皆有可能!