[转]PowerDesigner 把Comment写到name中 和把name写到Comment中 pd7以后版本可用
http://www.cnblogs.com/cxd4321/archive/2009/03/07/1405475.html
在使用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 把Comment写到name中 和把name写到Comment中 pd7以后版本可用
在使用PowerDesigner对数据库进行概念模型和物理模型设计时,一般在NAME或Comment中写中文,在Code中写英文.Name用来显 示,Code在代码中使用,但Comment中的文字会保 ...
- PowerDesigner 把Comment写到name中 和把name写到Comment中
在使用PowerDesigner对数据库进行概念模型和物理模型设计时,一般在NAME或Comment中写中文,在Code中写英文.Name用来显 示,Code在代码中使用,但Comment中的文字会保 ...
- powerdesigner 将表中name列值复制到comment列 (保留原有comment)
/** * PowerDesigner里面将表中name列值复制到comment列 * @see --------------------------------------------------- ...
- PowerDesigner里面将表中name列值拷贝到comment列
完整版见https://jadyer.github.io/2015/06/03/powerdesigner-copy-name-to-comment/ /** * PowerDesigner里面将表中 ...
- JavaScript对象中的属性(可写,可配置,可枚举,value,getter,setter)
JavaScript中,对象包括3个特性,分别为,可扩展性,class标识符,属性. 如果对象的可扩展性为false,则不可为对象动态的添加属性. 对象包含分为存取器属性和值属性.存取属性为 {g ...
- CI中的控制器中要用model中的方法,是统一写在构造器方法中,还是在每一个方法中分别写
Q: CI中的控制器中要用model中的方法,是统一写在构造器方法中,还是在每一个方法中分别写 A: 建议统一写,CI框架会自动识别已经加载过的类,所以不用担心重复加载的问题 class C_User ...
- JavaSE复习日记 : 继承关系和super关键字以及继承关系中方法的覆写
/* * 类的继承和super关键字 * * 软件开发的三大目的: * 可拓展性; * 可维护性; * 可重用性; * * 这里单说下可重用性这一项: * 为了代码复用,复用方式有: * 函数的调用复 ...
- Java 写一段字符到指定的文本文档中,如果该文本文档不存在,则创建该文本文档
写一段字符到指定的文本文档中,如果该文本文档不存在,则创建该文本文档 import java.io.File; import java.io.FileNotFoundException; import ...
- NIO 中的读和写
概述 读和写是I/O的基本过程.从一个通道中读取很简单:只需创建一个缓冲区,然后让通道将数据读到这个缓冲区中.写入也相当简单:创建一个缓冲区,用数据填充它,然后让通道用这些数据来执行写入操作. 从文件 ...
随机推荐
- HOJ Recoup Traveling Expenses(最长递减子序列变形)
A person wants to travel around some places. The welfare in his company can cover some of the airfar ...
- 软件IT
软件IT 周期: 攻防:攻击性板块 范畴:科技板块 业务:软件,互联网,人工智能,区块链... 行情主要因素: 主要问题:新领域,成长不确定性高 投资策略: 个股:科大讯飞,中国软件,用友网络,浪潮信 ...
- Spring boot官方文档学习(一)
个人说明:本文内容都是从为知笔记上复制过来的,样式难免走样,以后再修改吧.另外,本文可以看作官方文档的选择性的翻译(大部分),以及个人使用经验及问题. 其他说明:如果对Spring Boot没有概念, ...
- talib 中文文档(十一):Cycle Indicator Functions 周期指标
Cycle Indicator Functions 不是很懂,欢迎指教 HT_DCPERIOD - Hilbert Transform - Dominant Cycle Period 函数名:HT_D ...
- talib 中文文档(七):Overlap Studies Functions
Overlap Studies Functions 重叠指标 BBANDS - Bollinger Bands 函数名:BBANDS 名称: 布林线指标 简介:其利用统计原理,求出股价的标准差及其信赖 ...
- 七夕节---hdu1215(打表求因子和)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1215 给你一个数n(1<=n<=50w)求n的所有因子和, 由于n的范围比较大,所以要采用 ...
- paramiko与ssh
一.paramiko模块的安装 paramiko模块依赖PyCrypto模块,而PyCrypto需要GCC库编译,不过一般发行版的源里带有该模块.这里以centos6为例,直接借助以下命令可以直接完成 ...
- Python 读取写入配置文件 —— ConfigParser
Python 读取写入配置文件 —— ConfigParser Python 读取写入配置文件很方便,可使用内置的 configparser 模块:可查看源码,如博主本机地址: “C:/python2 ...
- mysql索引详解(转)
什么是索引 索引用来快速地寻找那些具有特定值的记录,所有MySQL索引都以B-树的形式保存.如果没有索引,执行查询时MySQL必须从第一个记录开始扫描整个表的所有记录,直至找到符合要求的记录.表里面的 ...
- python模块之xlrd(excl调用模块)
一.安装xlrd模块 到python官网下载http://pypi.python.org/pypi/xlrd模块安装,前提是已经安装了python 环境. 二.使用介绍 1.导入模块 import x ...