PowerDesigner 从数据库反向生成Pdm时把Comment复制到Name中,从PowerDesigner导入数据库时把Name复制到Comment

本文主要是介绍PowerDesigner 从数据库反向生成Pdm时把Comment复制到Name中,从PowerDesigner导入数据库时把Name复制到Comment,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

在使用PowerDesigner对数据库进行概念模型和物理模型设计时,一般在Name或Comment中写中文,在Code中写英文。Name用来显 示,Code在代码中使用,但Comment中的文字会保存到数据库Table或Column的Comment中,当Name已经存在的时候,再写一次 Comment很麻烦,可以使用以下代码来解决这个问题

在PowerDesigner中使用方法为:

   PowerDesigner->Tools->Execute Commands->Edit/Run Scripts

将代码Copy进去执行就可以了,是对整个CDM或PDM进行操作


'代码一:将Name中的字符COPY至Comment中  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   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  

另外在使用REVERSE ENGINEER从数据库反向生成PDM的时候,PDM中的表的NAME和CODE事实上都是CODE,为了把NAME替换为数据库中Table或Column的中文Comment,可以使用以下脚本:


'代码二:将Comment中的字符COPY至Name中   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   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   next  Dim   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  


这篇关于PowerDesigner 从数据库反向生成Pdm时把Comment复制到Name中,从PowerDesigner导入数据库时把Name复制到Comment的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/634297

相关文章

关于如何更好管理好数据库的一点思考

本文尝试从数据库设计理论、ER图简介、性能优化、避免过度设计及权限管理方面进行思考阐述。 一、数据库范式 以下通过详细的示例说明数据库范式的概念,将逐步规范化一个例子,逐级说明每个范式的要求和变换过程。 示例:学生课程登记系统 初始表格如下: 学生ID学生姓名课程ID课程名称教师教师办公室1张三101数学王老师101室2李四102英语李老师102室3王五101数学王老师101室4赵六103物理陈

数据库期末复习知识点

A卷 1. 选择题(30') 2. 判断范式(10') 判断到第三范式 3. 程序填空(20') 4. 分析填空(15') 5. 写SQL(25') 5'一题 恶性 B卷 1. 单选(30') 2. 填空 (20') 3. 程序填空(20') 4. 写SQL(30') 知识点 第一章 数据库管理系统(DBMS)  主要功能 数据定义功能 (DDL, 数据定义语

给数据库的表添加字段

周五有一个需求是这样的: 原来数据库有一个表B,现在需要添加一个字段C,我把代码中增删改查部分进行了修改, 比如insert中也添入了字段C。 但没有考虑到一个问题,数据库的兼容性。因为之前的版本已经投入使用了,再升级的话,需要进行兼容处理,当时脑子都蒙了,转不过来,后来同事解决了这个问题。 现在想想,思路就是,把数据库的表结构存入文件中,如xxx.sql 实时更新该文件: CREAT

android 带与不带logo的二维码生成

该代码基于ZXing项目,这个网上能下载得到。 定义的控件以及属性: public static final int SCAN_CODE = 1;private ImageView iv;private EditText et;private Button qr_btn,add_logo;private Bitmap logo,bitmap,bmp; //logo图标private st

人工智能机器学习算法总结神经网络算法(前向及反向传播)

1.定义,意义和优缺点 定义: 神经网络算法是一种模仿人类大脑神经元之间连接方式的机器学习算法。通过多层神经元的组合和激活函数的非线性转换,神经网络能够学习数据的特征和模式,实现对复杂数据的建模和预测。(我们可以借助人类的神经元模型来更好的帮助我们理解该算法的本质,不过这里需要说明的是,虽然名字是神经网络,并且结构等等也是借鉴了神经网络,但其原型以及算法本质上还和生物层面的神经网络运行原理存在

SQL Server中,查询数据库中有多少个表,以及数据库其余类型数据统计查询

sqlserver查询数据库中有多少个表 sql server 数表:select count(1) from sysobjects where xtype='U'数视图:select count(1) from sysobjects where xtype='V'数存储过程select count(1) from sysobjects where xtype='P' SE

SQL Server中,添加数据库到AlwaysOn高可用性组条件

1、将数据添加到AlwaysOn高可用性组,需要满足以下条件: 2、更多具体AlwaysOn设置,参考:https://msdn.microsoft.com/zh-cn/library/windows/apps/ff878487(v=sql.120).aspx 注:上述资源来自MSDN。

SQL Server中,用Restore DataBase把数据库还原到指定的路径

restore database 数据库名 from disk='备份文件路径' with move '数据库文件名' to '数据库文件放置路径', move '日志文件名' to '日志文件存放置路径' Go 如: restore database EaseWe from disk='H:\EaseWe.bak' with move 'Ease

python 在pycharm下能导入外面的模块,到terminal下就不能导入

项目结构如下,在ic2ctw.py 中导入util,在pycharm下不报错,但是到terminal下运行报错  File "deal_data/ic2ctw.py", line 3, in <module>     import util 解决方案: 暂时方案:在终端下:export PYTHONPATH=/Users/fujingling/PycharmProjects/PSENe

数据库原理与安全复习笔记(未完待续)

1 概念 产生与发展:人工管理阶段 → \to → 文件系统阶段 → \to → 数据库系统阶段。 数据库系统特点:数据的管理者(DBMS);数据结构化;数据共享性高,冗余度低,易于扩充;数据独立性高。DBMS 对数据的控制功能:数据的安全性保护;数据的完整性检查;并发控制;数据库恢复。 数据库技术研究领域:数据库管理系统软件的研发;数据库设计;数据库理论。数据模型要素 数据结构:描述数据库