ice world

          There is nothing too difficult if you put your heart into it.
          posts - 104, comments - 103, trackbacks - 0, articles - 0

          PowerDesigner中一些有用的設(shè)置

          Posted on 2011-04-23 15:24 IceWee 閱讀(905) 評(píng)論(0)  編輯  收藏 所屬分類: Database

          最近使用PD比較頻繁,也被PD給搞的焦頭爛額,網(wǎng)上好的東西還是比較多的,摘了點(diǎn)留作備用。

           

          sql語(yǔ)句中表名與字段名前的引號(hào)去除:

          打開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)來規(guī)定標(biāo)識(shí)符的大小寫, 可以看到右邊的values默認(rèn)值為“YES”,改為“No”即可!
          或者在打開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í),字段超過15字符就發(fā)生錯(cuò)誤(oracle)

          原因未知,解決辦法是打開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 Files\Sybase\PowerDesigner Trial 11\Resource Files\DBMS\oracl9i2.xdb文件
          修改好后,再cdm轉(zhuǎn)為pdm時(shí),選擇“Copy the DBMS definition in model”把把這個(gè)資源文件拷貝到模型中。
          ----------------------------------------------------------------------------------------------------------------------------------

          修改外鍵命名規(guī)則

          選擇Database—>Edit Current DBMS

          選擇Scripts-》Objects-》Reference-》ConstName
          可以發(fā)現(xiàn)右側(cè)的Value為:

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

          可見,該命名方法是:'FK_'+8位子表名+9位Reference名+8位父表名,你可以根據(jù)這中模式自定義為:

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

          可以使FK名稱變?yōu)镕K_TABLE_2_RELATIONS_TABLE_1
          掌握這種方法后就可以按照自己的想法修改了

          生成建庫(kù)腳本SQL文件中的表頭注釋很討厭,可以在 Databse -> Generate Database (Ctrl+G)窗口中,選擇Options卡片,去掉Usage的Title鉤選項(xiàng)即可。

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

          建立一個(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),也就沒有這個(gè)警告錯(cuò)誤了!
          意思是說沒有給表建立索引,而一個(gè)表一般至少要有一個(gè)索引,這是一個(gè)警告,不用管也沒有關(guān)系!
          ----------------------------------------------------------------------------------------------------------------------------------

          如何防止一對(duì)一的關(guān)系生成兩個(gè)引用(外鍵)
          要定義關(guān)系的支配方向,占支配地位的實(shí)體(有D標(biāo)志)變?yōu)楦副怼?
          在cdm中雙擊一對(duì)一關(guān)系->Detail->Dominant role選擇支配關(guān)系
          ----------------------------------------------------------------------------------------------------------------------------------

          修改報(bào)表模板中一些術(shù)語(yǔ)的定義
          即文件:C:\Program Files\Sybase\PowerDesigner Trial 11\Resource Files\Report Languages\Chinese.xrl
          Tools-Resources-Report Languages-選擇Chinese-單擊Properties或雙擊目標(biāo)
          修改某些對(duì)象的名稱:Object Attributes\Physical Data Model\Column\
          ForeignKey:外鍵
          Mandatory:為空
          Primary:主鍵
          Table:表
          用查找替換,把“表格”替換成“表”
          修改顯示的內(nèi)容為別的:Values Mapping\Lists\Standard,添加TRUE的轉(zhuǎn)化列為是,F(xiàn)ALSE的轉(zhuǎn)化列為空
          另外Report-Title Page里可以設(shè)置標(biāo)題信息
          ----------------------------------------------------------------------------------------------------------------------------------

           
          批量根據(jù)對(duì)象的name生成comment的腳本

          執(zhí)行方法: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 NothingThen
          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

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

          逆向工程將數(shù)據(jù)庫(kù)中comment腳本賦值到PDM的name

          執(zhí)行方法: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 NothingThen
          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
          if len(tab.comment) <> 0 then
          tab.name 
          = tab.comment
          end if
          On Error Resume Next
          Dim col 'running column
          for each col in tab.columns
          if len(col.comment) <>0 then
          col.name 
          =col.comment
          end if
          On Error Resume Next
          next
          end if
          next
          end sub

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

          刪除概念模型中沒用的Data Items

          '*****************************************************************************
          '
          文件:Delete useless data items.vbs
          '
          版本:1.0
          '
          版權(quán):floodzhu (floodzhu@hotmail.com),2005.1.6
          '
          功能:遍歷概念模型,把無用的Data Items刪除。
          '
          *****************************************************************************
          dim index
          index 
          = 0

          dim model 'current model
          set model = ActiveModel


          If (model Is NothingThen
             
          MsgBox "當(dāng)前沒有活動(dòng)的模型。"
          ElseIf Not model.IsKindOf(PdCDM.cls_Model) Then
             
          MsgBox "當(dāng)前模型不是概念模型。"
          Else
             View model
             
          MsgBox index & "個(gè)無用字段被刪除。"
          End If

          '*****************************************************************************
          '
          函數(shù):View
          '
          功能:遞歸遍歷
          '
          *****************************************************************************
          sub View(folder)
             
          dim item
             
          for each item in folder.DataItems
                
          if not item.IsShortCut then
                   Visit item
                
          end if
             
          next
            
             
          '對(duì)子目錄進(jìn)行遞歸
             dim subFolder
             
          for each subFolder in folder.Packages
                View subFolder
             
          next
          end sub

          '*****************************************************************************
          '
          函數(shù):Visit
          '
          功能:處理節(jié)點(diǎn)
          '
          *****************************************************************************
          sub Visit(node)
           
          if node.UsedBy="" then
                node.delete
                index 
          = index + 1
             
          end if
          end sub

           

          主站蜘蛛池模板: 融水| 陆河县| 定西市| 嘉鱼县| 祁东县| 琼海市| 昌平区| 东明县| 遂宁市| 福州市| 建阳市| 醴陵市| 方城县| 丹东市| 富宁县| 高安市| 东乌珠穆沁旗| 莱西市| 永吉县| 徐闻县| 介休市| 威信县| 牡丹江市| 盐津县| 尉氏县| 定安县| 平定县| 安宁市| 申扎县| 大连市| 塔河县| 赣州市| 青铜峡市| 池州市| 老河口市| 诸城市| 康平县| 正镶白旗| 乐清市| 婺源县| 伊金霍洛旗|