PowerDesigner中批量根据对象的name生成comment的脚本(转)

AI权益加码!Claude Code、Cursor等20+工具免费用! 购周边限时加赠Coding Plan Lite,畅享主流AI工具!学习进阶更高效! 阅读详情
利用PowerDesigner批量生成测试数据
主要解决方法:
A:在PowerDesigner 建表
B:然后给每一个表的字段建立相应的摘要文件
步骤如下:
Model->Test Data Profiles配置每一个字段摘要文件General:输入Name、Code、
选择Class(数字、字符、时间)类型
选择Generation Source: Automatic、List、ODBC、File Detail:配置字段相关信息
所有字段摘要文件配置完成后双击该表->选择字段->Detail->选择Test Data Parameters 摘要文件如果字段值与其它字段有关系在: Computed Expression 中输入计算列--生成测试数据:
DataBase->Generation Test Data->
选择:Genration 类型(Sript、ODBC)
Selection(选择要生成的表)
Test Data Genration(Default number of rows 生成记录行数)


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/majin_com/archive/2009/08/18/4459304.aspx

近用powerDesinger遇到一些小问题,遇到好几次同样的问题了,写在这里,以备查用:

--------------------------------------------------------------------------------------------------

sql语句中表名与字段名前的引号去除:

打开cdm的情况下,进入Tools-Model Options-Naming Convention,把Name和Code的标签的Charcter case选项设置成Uppercase或者Lowercase,只要不是Mixed Case就行!
或者选择Database->Edit current database->Script->Sql->Format,有一项CaseSensitivityUsingQuote,它的 comment为“Determines if the case sensitivity for identifiers is managed using double quotes”,表示是否适用双引号来规定标识符的大小写, 可以看到右边的values默认值为“YES”,改为“No”即可!
或者在打开pdm的情况下,进入Tools-Model Options-Naming Convention,把Name和Code的标签的Charcter case选项设置成Uppercase就可以!



在修改name的时候,code的值将跟着变动,很不方便

修改方法:PowerDesign中的选项菜单里修改,在[Tool]-->[General Options]->[Dialog]->[Operating modes]->[Name to Code mirroring],这里默认是让名称和代码同步,将前面的复选框去掉就行了。



由pdm生成建表脚本时,字段超过15字符就发生错误(oracle)

原因未知,解决办法是打开PDM后,会出现Database的菜单栏,进入Database - Edit Current DBMS -script-objects-column-maxlen,把value值调大(原为30),比如改成60。出现表或者其它对象的长度也有这种错误的 话都可以选择对应的objects照此种方法更改!
或者使用下面的这种方法:
生成建表脚本时会弹出Database generation提示框:把options - check model的小勾给去掉,就是不进行检查(不推荐)!
或者可以修改C:/Program Files/Sybase/PowerDesigner Trial 11/Resource Files/DBMS/oracl9i2.xdb文件
修改好后,再cdm转为pdm时,选择“Copy the DBMS definition in model”把把这个资源文件拷贝到模型中。



由CDM生成PDM时,自动生成的外键的重命名

PDM Generation Options->Detail->FK index names默认是%REFR%_FK,改为FK_%REFRCODE%,其中%REFRCODE%指的就是CDM中Relationship的code! 另外自动生成的父字段的规则是PDM Generation Options->Detail->FK column name template中设置的,默认是%.3:PARENT%_%COLUMN%,可以改为Par%COLUMN%表示是父字段!



建立一个表后,为何检测出现Existence of index的警告
A table should contain at least one column, one index, one key, and one reference.
可以不检查 Existence of index 这项,也就没有这个警告错误了!
意思是说没有给表建立索引,而一个表一般至少要有一个索引,这是一个警告,不用管也没有关系!



如何防止一对一的关系生成两个引用(外键)
要定义关系的支配方向,占支配地位的实体(有D标志)变为父表。
在cdm中双击一对一关系->Detail->Dominant role选择支配关系



修改报表模板中一些术语的定义
即文件:C:/Program Files/Sybase/PowerDesigner Trial 11/Resource Files/Report Languages/Chinese.xrl
Tools-Resources-Report Languages-选择Chinese-单击Properties或双击目标
修改某些对象的名称:Object Attributes/Physical Data Model/Column/
ForeignKey:外键
Mandatory:为空
Primary:主键
Table:表
用查找替换,把“表格”替换成“表”
修改显示的内容为别的:Values Mapping/Lists/Standard,添加TRUE的转化列为是,FALSE的转化列为空
另外Report-Title Page里可以设置标题信息


1 PowerDesigner中批量根据对象的name生成comment的脚本

执行方法:Open PDM -- Tools -- Execute Commands -- Run 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
tab.comment = tab.name
Dim col 'running column
for each col in tab.columns
col.comment= col.name
next
end if
next

Dim 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

-----------------------------------------------------------------------

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

执行方法:Open PDM -- Tools -- Execute Commands -- Run 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

PowerDesigner(PDMExcel、Comment同步Name) 工具:powerdesigner 16.5快捷键:ctrl+shift+x执行:点击“run”说明1:可复制以下脚本,执行pdmexcel;说明2:表名长度不可超过31个字符,否则执行会中断;说明3:以下格式仅用于支持当前需求,如果需要调整样式及导出顺序,可参考目录3、目录4中vbs对excel的操作,修改函数 ExportTable 或 函数 AddSheet。 阅读详情

相关推荐

PowerDesigner书签(03)显示comment字段注释内容

楔子:我来告诉你真相吧。所谓姻缘的红线是要两个人共同编织的。只有在两人牵手走到最后,其中一方死去时,这条红线才算完成,他们才算是真正被牵到一起了。- 东野圭吾《黎明之街》 1.今日书签 PowerDesigner 16.5 对表字段设置显示 comment 注释,解决视图模型看不到表字段 comment 中文注释的问题。   2.拨云见日 2.1.操作环境 操作系统:Win10 PowerDesigner 版本:16.5   2.2.操作步骤 无论 PowerDesigner 15 .

有时有味的博客 5380

PowerDesigner里复制comment列到name

PowerDesigner里执行脚本命令,把comment列的内容批量复制到name列。

PowerDesignernamecomment 互换脚本

PowerDesignernamecomment 互换脚本,可以使用。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

PowerDesigner MySQL 根据字段name 自动生成 comment 注释

PowerDesigner MySQL 根据字段name 自动生成 comment 注释

蒲公英的博客 1132

PowerDesigner comment跟着name变动

PowerDesigner comment跟着name变动

qq_38217747的博客 442

powerdesigner脚本 name自动替换成comment

powerdesigner设计数据库 name自动替换成comment

waper97的博客 395

PowerDesigner设计Name和注释相互替换

而设计时候常把comment写成中文,name保留跟code一致,保存完毕后,可以把comment替换到name上。当然也可以用name替换commentName是名称(字段描述),Code是字段名称,Comment是注释名称,ER图中显示的是Name。一般设计时,Namecomment都设计成描述,PowerDesigner设计 设计的表。1 将comment覆盖name。2 将name覆盖comment。3 将code覆盖name

qq_42209596的博客 1332

PowerDesigner 中的namecomment()

1 PowerDesigner批量根据对象name生成comment脚本 自:http://blog.itpub.net/10972173/viewspace-702775/执行方法:Open PDM -- Tools -- Execute Commands -- Run Script Vb script代码 Option Explicit ValidationMode ...

l23456789o的博客 480

PowerDesignerComment写到name中 和把name写到Comment中 (

PowerDesignerComment写到name中 和把name写到Comment中 pd7以后版本可用 PowerDesigner->Tools->Execute Commands->Edit/Run Scripts 在使用PowerDesigner对数据库进行概念模型和物理模型设计时,一般在NAMEComment中写中文,在Code中写英文。Name...

diaowo5577的专栏 185

PowerDesigner批量name添加到comment里面的方法

原文链接:https://zheyiw.iteye.com/blog/762848 目的:name有值,comment中没有内容,想将name的值直接写入comment中。 使用方法: PowerDesigner-&gt;Tools-&gt;Execute Commands-&gt;Edit/Run Scripts 将如下代码,贴入上述文本框运行即可。 '如果comme...

叮咚侠的博客 1618

PowerDesigner11中批量根据对象name生成comment脚本

 PowerDesigner11中批量根据对象name生成comment脚本******************************************************************************* File:     name2comment.vbs* Purpose:  Database generation cannot use object

jinzhili的专栏 887

给PDM所有表相同字段一次性添加Comment

打开PowerDesigner, ctrl+shift+x ,复制文本内容,修改对应comment,run。其余字段也可使用此脚本

powerdesigner report模板

powerdesigner 的 report功能可以生成HTML和RTF的数据库文档,找到一个不错的报表模板

PowerDesigner 的常用报告样板

PowerDesigner 的常用报告样板,包括ER图,数据表的统计,各表的表结构(字段名、描述、类型、是否为空)

PowerDesigner Report 报表模板(精简后)

PowerDesigner Report模板,经过本人亲自优化和整理,保留关键信息,生成的模板简洁清晰

PowerDesigner批量根据对象name生成comment脚本

PowerDesigner中将对象中的name写到comment中,如果comment不为空,将name加在comment前面   执行方法:Open PDM -- Tools -- Execute Commands -- Run Script Vb script代码 Option Explicit ValidationMode = True InteractiveMode

leizhoubin的专栏 1455

PowerDesigner反向生成PDM和name与注释互换

自:https://blog.csdn.net/linybo/article/details/49329535 1 PowerDesigner批量根据对象name生成comment脚本 执行方法:Open PDM -- Tools -- Execute Commands -- Run Script Vb script代码 Option Explicit ValidationMod...

世间万物皆系于一键之上 207
上一篇: apache和subversion for windows配置详解
下一篇: 看完这20部电影,你可以去全球任何一家公司做董事长或总经理
caiqiling
博客等级 码龄19年 2粉丝 3原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值