PowerDesigner逆向生成处理

PowerDesigner逆向生成数据库表之间的关系图:这是很早的文档我搬到博客上面来

1、逆向生成开始

 

选我们配置好的ODBC

 

选我们用本地文件反向生成还是服务器的数据反向生成

 

选择我们需要生成库或者所有的信息。如果这里没选,name所有的表结构都会出来。

2、整个数据库表被逆向生成了 ,解决办法

其实解决这个问题比较简单。

这个界面有两个button 分别是:Select all & Deselect All

我先Deselct All 然后再选择guides_dev这个库。

 

然后我们需要再选择Active Page,它这里面的page其实就是指的选中的这个库。

 

 

二十秒后就生成了我需要的数据库47张表数据结构

 

3、全库的name都是英文解决

我们看到上面的这种情况。气死个人,都是英文的那我们怎么搞,我们的表呀,字段都是有中文注释的,所以没有commt注释很不爽,那么我们来处理这样的情况。

接下来我们就来解决这个问题:

 

在弹出的界面窗口:输入这段命令

 

接下来就是,你选择关闭的时候,弹出来是不是要保存,下次来你就不用再输入了,直接执行这段代码就好了。我这里保存了

 

 

下来要转换成中文的时候,我就不需要再次输入那段代码了。

问题解决

 

代码在这里哦:

这里附上 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
发布了91 篇原创文章 · 获赞 79 · 访问量 63万+

猜你喜欢

转载自blog.csdn.net/yexiaomodemo/article/details/101776777
今日推荐