PowerDesigner常用操作

常用操作

 

1.新建文件

file --> new physical Data Model-->model types 选择数据库 ModelName

 

2.配制数据库信息

database-->configure connections--> connections profiles-->new ....

 

3.连接数据库

database --> connect

 

4.生成sql语句

database --> generate database ....

 

5.导入sqlpd

file --> reverse engineer -->database....-->MYSQL5.0-->Using script files

(视频 马士兵 hibernate 042 00:02:36)

 


powerDesigner设置 name不自动等于code

选择tools->general Options
选择弹出窗口中的Dialog选项,将Name to Code mirroring 上的钩去掉。

 

 

使用PowerDesigner把设计图导出成图片

 

1: 按住Shift键点击鼠标选择要导出的对象,必须先选择。

2: 选择Edit—>Export Image 到出你需要的格式,如下图

以上方法要是不行,可以用一下方法

CTRL+A,复制到word文档,然后在word里面再另存为图片!

 

 

打开图形界面工具栏(palette

 

Tools-->customize Toolbars -->palette

 

CODE NAME变化

 

NAME-->GENERAL OPTIONS --> Dialog-->Name to Code mirroring(去掉勾选)

 

PowerDesigner去掉SQL脚本中的双引号

   ◇问题描述:

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

   ◇解决方法:

   把Database → Edit Current DBMS → General → Script → Sql → Format → CaseSensitivityUsingQuote设置为NO即可

 

 

 

 

PowerDesigner使用MySQL的auto_increment

  ◇问题描述:

  PD怎样能使主键id使用MySQL的auto_increment呢?

   ◇解决方法:

   打开table properties窗口 → columns → 选中id列 → 打开columns properties窗口 → 勾选identity即可

   注意:概念模型没有此选项,物理模型才有

 

 

PowerDesigner中设置Entity自动调整尺寸大小

   ◇问题描述:

   当给Entity添加了字段或其他修改时,Entiry的显示尺寸大小不会自动调整,怎样解决呢?

   ◇解决方法:

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

 

powerdesigner中怎么把线条画成直线

 

空白处右击->Display Preferences->左边框里选择自己想改变的线种类->右边框里选Format->Symbol Format对话框里第一个标签Line Style下的Corners里选第一种折线。

然后把你的设置Set as Default。

PowerDesigner 把Comment写到name中 和把name写到Comment中 pd7以后版本可用

参考http://www.cnblogs.com/cxd4321/archive/2009/03/07/1405475.html
在使用PowerDesigner对数据库进行概念模型和物理模型设计时,一般在NAME或Comment中写中文,在Code中写英文。Name用来显 示,Code在代码中使用,但Comment中的文字会保存到数据库Table或Column的Comment中,当Name已经存在的时候,再写一次 Comment很麻烦,可以使用以下代码来解决这个问题:

代码一:将Name中的字符COPY至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

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

         另外在使用REVERSE ENGINEER从数据库反向生成PDM的时候,PDM中的表的NAME和CODE事实上都是CODE,为了把NAME替换为数据库中Table或Column的中文Comment,可以使用以下脚本:

代码二:将Comment中的字符COPY至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

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

以上两段代码都是VB脚本,在PowerDesigner中使用方法为:

    PowerDesigner->Tools->Execute Commands->Edit/Run Scripts

将代码Copy进去执行就可以了,是对整个CDM或PDM进行操作

转载于:https://my.oschina.net/topeagle/blog/402502

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值