PowerDesigner 把Comment写到name中 和把name写到Comment中 pd7以后版本可用
在使用PowerDesigner对数据库进行概念模型和物理模型设计时,一般在NAME或Comment中写中文,在Code中写英文。Name用来显 示,Code在代码中使用,但Comment中的文字会保存到数据库Table或Column的Comment中,当Name已经存在的时候,再写一次 Comment很麻烦,可以使用以下代码来解决这个问题:
- 代码一:将Name中的字符COPY至Comment中
Option Explicit
ValidationMode = True
InteractiveMode = im_BatchDim 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 not tab.isShortcut then
tab.comment = tab.name
Dim col ' running column
for each col in tab.columns
col.comment= col.name
next
end if
nextDim view 'running view
for each view in folder.Views
if not view.isShortcut then
view.comment = view.name
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
--------------------------------------------
另外在使用REVERSE ENGINEER从数据库反向生成PDM的时候,PDM中的表的NAME和CODE事实上都是CODE,为了把NAME替换为数据库中Table或Column的中文Comment,可以使用以下脚本:
- 代码二:将Comment中的字符COPY至Name中
Option Explicit
ValidationMode = True
InteractiveMode = im_BatchDim 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 IfPrivate 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
nextDim 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
-----------------------------------------------------------------------
以上两段代码都是VB脚本,在PowerDesigner中使用方法为:
PowerDesigner->Tools->Execute Commands->Edit/Run Scripts
将代码Copy进去执行就可以了,是对整个CDM或PDM进行操作
PowerDesigner 把Comment写到name中 和把name写到Comment中 pd7以后版本可用相关推荐
- PowerDesigner里面将表中name列值拷贝到comment列
完整版见https://jadyer.github.io/2015/06/03/powerdesigner-copy-name-to-comment/ /*** PowerDesigner里面将表中n ...
- MySQL中,21个写SQL的好习惯
点击上方 好好学java ,选择 星标 公众号 重磅资讯.干货,第一时间送达 今日推荐:硬刚一周,3W字总结,一年的经验告诉你如何准备校招! 个人原创100W+访问量博客:点击前往,查看更多 前言 每 ...
- 21种mysql_Mysql中,21个写SQL的好习惯,可以看一下
前言 每一个好习惯都是一笔财富,本文分SQL后悔药, SQL性能优化,SQL规范优雅三个方向,分享写SQL的21个好习惯,谢谢阅读,加油哈~ 公众号:捡田螺的小男孩 1. 写完SQL先explain查 ...
- php c扩展的方式,php中使用C语言写扩展的方法
php中使用C语言写扩展的方法 发布时间:2020-08-20 15:49:21 来源:亿速云 阅读:102 作者:小新 小编给大家分享一下php中使用C语言写扩展的方法,相信大部分人都还不怎么了解, ...
- server sql 无法从long转为int_MySQL中,21个写SQL的好习惯(修正版)
每一个好习惯都是一笔财富,本文分SQL后悔药, SQL性能优化,SQL规范优雅三个方向,分享写SQL的21个好习惯,谢谢阅读,加油哈~ 1. 写完SQL先explain查看执行计划(SQL性能优化) ...
- NIO入门系列之第3章:从理论到实践:NIO 中的读和写
3.1 概述 读和写是 I/O 的基本过程.从一个通道中读取很简单:只需创建一个缓冲区,然后让通道将数据读到这个缓冲区中.写入也相当简单:创建一个缓冲区,用数据填充它,然后让通道用这些数据来执行写入 ...
- VS2019中在源文件中如何使用自己写的头文件(保姆级教程)
VS2019中在源文件中如何使用自己写的头文件 前言 开始教程 建立一个头文件 建立头文件对应的.cpp文件 在其余源文件中使用 可能出现的错误 前言 一个完整的头文件应该分为:.h文件与.cpp文件 ...
- 对下图所示的连通网络G,用克鲁斯卡尔(Kruskal)算法求G的最小生成树T,请写出在算法执行过程中,依次加入T的边集TE中的边。说明该算法的基本思想及贪心策略,并简要分析算法的时间复杂度
对下图所示的连通网络G,用克鲁斯卡尔(Kruskal)算法求G的最小生成树T,请写出在算法执行过程中,依次加入T的边集TE中的 边.说明该算法的基本思想及贪心策略,并简要分析算法的时间复杂度
- wpf 切换搜狗输入法英文_搜狗输入法全新升级手写功能,中英数字自由写,告别切换丨本周新闻...
搜狗AI合成主播雅妮 为您带来搜狗本周新闻播报 新 闻 原 文 .01. 2019搜狗全年营收超80亿人民币,创历史新高 近期,搜狗公布了2019年第四季度及全年未经审计的财务报告.财报显示,2019 ...
最新文章
- 无盘服务器回写盘intel,无盘回写盘碎片清理工具 完美解决无盘回写盘碎片
- git checkout 远程分支_git的远程分支是干啥的,和本地的有什么区别?
- ionic 刷新页面的几种方法
- python编程入门电子书-《Python编程 从入门到实践》高清电子书免费下载
- Excel批量向下填充不连续的空白单元格工具
- 《第二次曲线创新》李善友教授
- 第三方服务接入云平台的统一方案
- java反射机制之Method invoke执行调用方法例子
- java基础编程题_Java基础练习题:编程练习(1) - 菜鸟头头
- MATLAB | MATLAB配色不够用 全网最全的colormap补充包来啦
- Java电商秒杀系统性能优化(八)——流量削峰技术-削峰填谷之神级操作
- Tomcat使用过滤器实现页面的限制访问,登录才能访问受限页面
- stm32f105vct6例程_STM32F105VCT6_USB_TEST
- 任意长度的python列表最后一个元素索引_任意长度的 Python 列表、元组和字符串中最后一个元素的下标为 ________ 。_学小易找答案...
- 感谢计算机设计大赛,创意来自爱好 成功缘于努力——记第六届大学生计算机设计大赛全国二等奖获得者张阳...
- html让下拉框自动选择,html下拉框设置连接 html怎么设置下拉列表必须选择
- javascript 判断美国现在是冬令时、夏令时
- 在VS17,VS19中使用VS15的库?
- 深度学习实战1(基本概念、全连接神经网络、CNN)
- golang同时使用命令行参数和配置文件