反向生成pdm文件

Step 1 :首先下载mysql-connector-odbc-3.51.27-win32.msi ,然后进行程序的安装。安装完毕之后打开控制面板,在打开管理工具,打开数据库源ODBC选择添加按钮选择对应的数据库(以Mysql为例),然后进行Mysql配置,相当于在Myeclipse下配置数据源一样的方法。


Step 2:打开powerdesigner。选择file--->reverse engineer--->database

Step 3:在弹出的对话框new physic data model里填写你自己的modelname,选择dbms为mysql5点击确定


Step 4:在弹出的 database reverse engineer selection 里选using a data source 并点击connect to a data source弹出connect to a data source对话框.


Step 5:选择data source 为odbc machine data source,并选择刚才配置好的mysql数据源输入用户密码点击connect返回到database reverse engineer options,点击确定。


Step 6:此时弹出,database reverse engineer对话框。选择要生成的表点击ok即可


最重要的地方

PowerDesigner中逆向工程将数据库中comment脚本赋值到PDM的name

执行方法:Open PDM -- Tools -- Execute Commands -- Run Script

Vb script代码

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 code 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

if len(tab.comment) <> 0 then

tab.name = tab.comment

end if

On Error Resume Next

Dim col 'running column

for each col in tab.columns

if len(col.comment) <>0 then

col.name =col.comment

end if

On Error Resume Next

next

end if

next

end sub

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 痤疮疤痕是怎么形成的呢?怎样护理比较好?脸上长了痘痘,让很多青少年朋友失去了往日的光彩、活泼,变得黯然失色。其实,...
    cqhfyy02阅读 517评论 0 0
  • 最近一段时间都在学习新的技巧,练习的时候都没有计算时间,所以今天特意做了一个手速的练习,8页PPT的时间大约...
    爱睡觉de猪阅读 493评论 1 16
  • 仔细看也挺粗糙的,呐,不管了,今天的搞定啦(。ò ∀ ó。)
    谢勿念阅读 703评论 3 1
  • 灯红酒绿的街区躯体像个僵尸游荡在裱花的盒子里失去梦想飘荡的记忆穿梭在人流密集的城市树影丢掉了嫩绿电线杆没了麻雀的羽...
    鱼教头阅读 370评论 10 9