`
luats
  • 浏览: 16563 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

PowerDesigner小技巧

阅读更多
转载地址:http://fengyie007.iteye.com/blog/232784

1、PowerDesigner 使用MySQL的auto_increment
  ◇问题描述:
  PD怎样能使主键id使用MySQL的auto_increment呢?

   ◇解决方法:
   打开table properties窗口 → columns → 选中id列 → 打开columns properties窗口 → 勾选identity即可
   注意:概念模型没有此选项,物理模型才有

2、PowerDesigner 去掉SQL脚本中的双引号
   ◇问题描述:
   PD生成Oracle数据库建表SQL时,默认会给表名和字段名加上双引号,怎样能去掉SQL脚本中的双引号呢?

   ◇解决方法:
   把Database → Edit Current DBMS → General → Script → Sql → Format → CaseSensitivityUsingQuote设置为NO即可

3、PowerDesigner 生成SQL语句时不使用Domain
   ◇问题描述:
   如果在PD中使用了Domain,生成SQLServer的数据库SQL的脚本中会使用与Domain对应的自定义数据类型,而不会使用 SQLServer自己的数据类型,怎样能让PD生成SQL语句时使用SQLServer自己的数据库类型,而不是Domain对应的自定义数据类型呢?

   ◇解决方法:
   把Database → Edit Current DBMS → General → Script → Objects → Domain → Enable设置为NO即可

4、PowerDesigner 中设置Entity的默认字体
   ◇问题描述:
   创建Entity时,如果PD默认字体不适合自己的个人习惯,每次创建了一个实体后都要修改实体的字体,非常麻烦,是否有只修改一次一劳永逸的方法呢?

   ◇解决方法:
   Tools → Display Preferences... → Format → Entity → Modity... → Font → 进行相应修改并保存设置 → Set As Default

5、PowerDesigner 中设置Entity自动调整尺寸大小
   ◇问题描述:
   当给Entity添加了字段或其他修改时,Entiry的显示尺寸大小不会自动调整,怎样解决呢?

   ◇解决方法:
   在Entity上点击右键 → 单击Format...菜单项 → 选择size标签页 → 勾选Auto adjust to text即可

6、在修改name的时候,code的值将跟着变动  
     ◇问题描述:
   在修改name的时候,code的值将跟着变动,怎样解决呢?

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

7、PowerDesigner 生成SQL的Existence of refernce错误问题
     ◇问题描述:
     用PowerDesigner生成SQL语句时,提示Existence of refernce错误。

     ◇原因:
     该表没有与其他表的关联(如外键等),而PowerDesigner需要存在一个refernce才能生成SQL.
   
    ◇解决方法:
    在工具栏空白处右键打开Palette面板,选中Link/Extended Dependency 按钮,然后在提示出错的表上添加到自己的Dependency。重新生成SQL,你将发现刚才提示的错误没有了,问题解决。
 
8、利用PowerDesigner批量生成测试数据
     ◇解决方法:
     A:在PowerDesigner 建表
     B:然后给每一个表的字段建立相应的摘要文件,步骤如下:
    Model->Test Data Profiles配置每一个字段摘要文件General:输入Name、Code、
     选择Class(数字、字符、时间)类型
     选择Generation Source: Automatic、List、ODBC、File Detail:配置  字段相关信息
     所有字段摘要文件配置完成后双击该表->选择字段->Detail->选择Test Data Parameters 摘要文件如果字段值与其它字段有关系在: Computed Expression 中输入计算列--生成测试数据:
    DataBase->Generation Test Data->选择:
         Genration 类型(Sript、ODBC)
         Selection(选择要生成的表)
         Test Data Genration(Default number of rows 生成记录行数)

9、E-R图中,同时显示Name和Code
     ◇问题描述:E-R图中,默认显示的只有Name、Date Type,如果让Name、Code同时显示该怎么办呢?

      ◇解决方法:双击E-R图,切换到Columns->Customize Columns Fileter,将StereoType勾上,然后将StereoType的值设置成和Name一致;然后Tools->Model Options->Name Convention->Display一栏选Code

10、PowerDesigner,将name列批量转换成comment
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   comment   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


11、PowerDesigner,将comment列批量转换成name
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
       
Private   sub   ProcessFolder(folder) 
On Error Resume Next
      Dim   Tab   'running     table 
      for   each   Tab   in   folder.tables 
            if   not   tab.isShortcut   then 
                  tab.name   =   tab.comment
                  Dim   col   '   running   column 
                  for   each   col   in   tab.columns 
                  if col.comment="" then
                  else
                        col.name=   col.comment 
                  end if
                  next 
            end   if 
      next
       
      Dim   view   'running   view 
      for   each   view   in   folder.Views 
            if   not   view.isShortcut   then 
                  view.name   =   view.comment 
            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
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics