powerdesigner 检查名称长度

时间:2022-07-30 14:29:30 阅读: 最新文章 文档下载
说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

'******************************************************************************

'* File: 检查名称长度.vbs

'* 目的: 检查表名、主键名、Ref、Index名称的长度是否小于30

'* 创建日期: 2014.05.15

'* 创建人: lixinglei

'* 执行方式:Ctrl+shift+x

'******************************************************************************

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 len(Tab.code) > 30 then

output "Scans table: " + Tab.code + " 长度:" + Cstr(len(Tab.code))

end if

next

output " table 检查完成! "

output

'Dim Tab 'running table

for each Tab in folder.tables

if len(Tab.PrimaryKey.code) > 30 then

output "Scans Primary Key: " + Tab.PrimaryKey.code + " 长度:" + Cstr(len(Tab.PrimaryKey.code))

end if

next

output " Primary Key 检查完成! "

output

Dim ref 'running ref

for each ref in folder.References

if len(ref.code) > 30 then

output "Scans Reference: " + CStr(ref.code) + " 长度:" + Cstr(len(ref.code))

end if

' output Cstr(ref.code) +Cstr(len(ref.code))

next

output " Reference 检查完成! "

output

'Dim Tab 'running Index

for each Tab in folder.tables

Dim idx

for each idx in tab.Indexes

if len(idx.code) > 30 then

output "Scans Index: " + idx.code + " 长度:" + Cstr(len(idx.code))

end if

next

next

output " Index 检查完成! "

output

' 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

本文来源:https://www.wddqw.com/doc/2cdcbf456edb6f1afe001f40.html