数据库:
1.打开数据——右键——转储SQL文件——仅结构——保存好转储的SQL文件;
PowerDeSigner通过已有的sql文件,生成数据库模型PDM:
步骤如下:
第一步:File->Reverse Enginner->Databases…
第二步:选择mysql5.0(选择适合的版本)
第三步:点击加号选择SQL文件所在位置,然后点击确定,等待所有OK!!
这个时候生成的数据库模型,是没有中文注释的。
第一步:tools->Execute Commands->Edit/Run Script
第二步:需要修改VB代码,代码如下:
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
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
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
如图所示:
即生成带中文注释的pdm
pdm同时显示中文和英文
第一步:tools->Display Preferences…->table
第二步:点击Advanced.
第三步:点击进行选择显示的内容
第四步:选择 code 并且置顶。即可显示中英文的pdm啦