PowerDesigner连接数据库生成文档

      (1)配置数据库

           安装数据连接驱动

           下载地址:https://dev.mysql.com/downloads/connector/odbc/5.2.html

            

                 最好安装32位的,64位的找不到。

            控制面板\所有控制面板项\管理工具

          

           打开之后 选择系统DSN,用户也是可以。点击添加

  

 

   输入 数据库信息 就可以呢 

 

 打开PowerDesigner 

         

      

小猪带你添加 name为mysql 是我添加的

 

 在这里选中添加的

 取消掉所有选择  不然生成太多 选择你需要的库

 

 

 

 打开一个表  name 都为字段 用备注替换掉name

替换操作

打开Tools --》

 执行下边脚本

		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

  

 

 

 

 

 

 

 

 

 

猜你喜欢

转载自www.cnblogs.com/pengbaowei/p/12142967.html