power的总结comment配置

如下图所示,创建模型:

如下图,选择物理模型的同时指定数据库管理系统:

如下图,选择Table新建表,点击之后在中间位置点击一次即可,选择如下图剪刀上面的图片开始进行操作:

如下图,本次只演示一下,因此使用两个字段信息来演示,需要使用注解就是直接在Name列来描述Code的字段的作用:

 

如下图,选择如下图进行视图里面的操作,接下里的操作如下图后面的图操作:

如下图,操作如下 Select Attributes视图,勾上CodeAttribute Name顺序如下即可:

如下图,满足了所需的要求:

如下图,在视图显示表的comment注释的操作:

如下图,选择合适的数据库系统:

如下图,表导出sql文件需要注意的一些问题:

导出SQL文件时,把Name列设置code列的注释,操作步骤如下:

步骤一:Database->Edit Current DBMS,如上图。

步骤二:如下图:

方法一:

以上是默认内容:

以上是默认内容:

comment on column

[%QUALIFIER%]%TABLE%.%COLUMN% is
%.q:COMMENT%

改成:

comment on column [%QUALIFIER%]%TABLE%.%COLUMN% is
%.q:COLNNAME%

方法二:

操作:Database-->Edit Current DBMS,进入下图页面,

然后分别将

Script-->Objects-->Table-->TableComment

Script-->Objects-->Column-->ColumnComment

修改成

alter table [%QUALIFIER%]%TABLE% comment %.60qA:COMMENT%

alter table [%QUALIFIER%]%TABLE% modify column %COLUMN% %DATATYPE% comment %.60qA:COMMENT%

步骤三:解决当comment为空时,则不能生成注释的问题:

物理模型生产数据库时,Database->Generate Database..
在Format标签选项中,将Generate name in empty comment,勾选上,默认不勾选,同时设置编码Encoding防止乱码发生。

如下,有两个脚本的生成注释的作用:

把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  
  
'   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
View Code

 把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  
  
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
View Code

如下图,执行命令:

powerdesigner中给一主键设为自增型auto_increment,光标选中该列右键选择properties或者按快捷键 alt+enter,勾选Domain后面的Identity即可,然后查看preview



原文链接:https://blog.csdn.net/qq496013218/article/details/70267611

原文地址:https://www.cnblogs.com/gxbmjz0721/p/13366621.html