PowerDesigner技巧集1

2024-06-06 11:18
文章标签 技巧 powerdesigner

本文主要是介绍PowerDesigner技巧集1,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

 

http://blog.csdn.net/huang_xw/article/details/5722981#

 

 

  1. NameCode同步的问题

    PowerDesigner中,修改了某个字段的name,其code也跟着修改,这个问题很讨厌,因为一般来说,name是中文的,code是字段名。

    解决方法如下:

    1、选择Tools->GeneralOptions...菜单,出现General Options对话框。

    2、从Category中选择Dialog项。

    3、取消右边"Name to Code mirroring"复选框。如下图:

     

  2. 批量根据对象的name生成comment的脚本

    执行方法:PD12 à 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  

 

 

但是这个脚本有点不足之处:就是将name的内容完全覆盖在comments上。有一些我写好的comments会被覆盖了,这样很不爽。因此,在原脚本的基础上,我判断comments的长度大于name,不覆盖。这样自己写的comments就会保留下来。脚本。在表、视图的基础了,增加用户、表空间、序列等数据库对象的注释。

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 not Len(tab.comment) > Len(tab.name) then  tab.comment = tab.name  end if  Dim col ' running column  for each col in tab.columns  if not Len(col.comment) > Len(col.name) then  col.comment= col.name  end if  next  end if  next  Dim view 'running view  for each view in folder.Views  if not view.isShortcut then  if not Len(view.comment) > Len(view.name) then  view.comment = view.name  end if  end if  next  Dim sequence 'running sequence  for each sequence in folder.Sequences  if not sequence.isShortcut then  if not Len(sequence.comment) > Len(sequence.name) then  sequence.comment = sequence.name  end if  end if  next  Dim myuser 'running user  for each myuser in folder.Users  if not myuser.isShortcut then  if not Len(myuser.comment) > Len(myuser.name) then  myuser.comment = myuser.name  end if  end if  next     Dim tablespace 'running tablespace  for each tablespace in folder.Tablespaces  if not tablespace.isShortcut then  if not Len(tablespace.comment) > Len(tablespace.name) then  tablespace.comment = tablespace.name  end if  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技巧集1的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



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

相关文章

MySQL 多列 IN 查询之语法、性能与实战技巧(最新整理)

《MySQL多列IN查询之语法、性能与实战技巧(最新整理)》本文详解MySQL多列IN查询,对比传统OR写法,强调其简洁高效,适合批量匹配复合键,通过联合索引、分批次优化提升性能,兼容多种数据库... 目录一、基础语法:多列 IN 的两种写法1. 直接值列表2. 子查询二、对比传统 OR 的写法三、性能分析

Python使用vllm处理多模态数据的预处理技巧

《Python使用vllm处理多模态数据的预处理技巧》本文深入探讨了在Python环境下使用vLLM处理多模态数据的预处理技巧,我们将从基础概念出发,详细讲解文本、图像、音频等多模态数据的预处理方法,... 目录1. 背景介绍1.1 目的和范围1.2 预期读者1.3 文档结构概述1.4 术语表1.4.1 核

Java中的雪花算法Snowflake解析与实践技巧

《Java中的雪花算法Snowflake解析与实践技巧》本文解析了雪花算法的原理、Java实现及生产实践,涵盖ID结构、位运算技巧、时钟回拨处理、WorkerId分配等关键点,并探讨了百度UidGen... 目录一、雪花算法核心原理1.1 算法起源1.2 ID结构详解1.3 核心特性二、Java实现解析2.

深度解析Python装饰器常见用法与进阶技巧

《深度解析Python装饰器常见用法与进阶技巧》Python装饰器(Decorator)是提升代码可读性与复用性的强大工具,本文将深入解析Python装饰器的原理,常见用法,进阶技巧与最佳实践,希望可... 目录装饰器的基本原理函数装饰器的常见用法带参数的装饰器类装饰器与方法装饰器装饰器的嵌套与组合进阶技巧

Go语言代码格式化的技巧分享

《Go语言代码格式化的技巧分享》在Go语言的开发过程中,代码格式化是一个看似细微却至关重要的环节,良好的代码格式化不仅能提升代码的可读性,还能促进团队协作,减少因代码风格差异引发的问题,Go在代码格式... 目录一、Go 语言代码格式化的重要性二、Go 语言代码格式化工具:gofmt 与 go fmt(一)

如何在Mac上彻底删除Edge账户? 手动卸载Edge浏览器并清理残留文件技巧

《如何在Mac上彻底删除Edge账户?手动卸载Edge浏览器并清理残留文件技巧》Mac上的Edge账户里存了不少网站密码和个人信息,结果同事一不小心打开了,简直尴尬到爆炸,想要卸载edge浏览器并清... 如果你遇到 Microsoft Edge 浏览器运行迟缓、频繁崩溃或网页加载异常等问题,可以尝试多种方

qt5cored.dll报错怎么解决? 电脑qt5cored.dll文件丢失修复技巧

《qt5cored.dll报错怎么解决?电脑qt5cored.dll文件丢失修复技巧》在进行软件安装或运行程序时,有时会遇到由于找不到qt5core.dll,无法继续执行代码,这个问题可能是由于该文... 遇到qt5cored.dll文件错误时,可能会导致基于 Qt 开发的应用程序无法正常运行或启动。这种错

mtu设置多少网速最快? 路由器MTU设置最佳网速的技巧

《mtu设置多少网速最快?路由器MTU设置最佳网速的技巧》mtu设置多少网速最快?想要通过设置路由器mtu获得最佳网速,该怎么设置呢?下面我们就来看看路由器MTU设置最佳网速的技巧... 答:1500 MTU值指的是在网络传输中数据包的最大值,合理的设置MTU 值可以让网络更快!mtu设置可以优化不同的网

MySQL JSON 查询中的对象与数组技巧及查询示例

《MySQLJSON查询中的对象与数组技巧及查询示例》MySQL中JSON对象和JSON数组查询的详细介绍及带有WHERE条件的查询示例,本文给大家介绍的非常详细,mysqljson查询示例相关知... 目录jsON 对象查询1. JSON_CONTAINS2. JSON_EXTRACT3. JSON_TA

Spring @RequestMapping 注解及使用技巧详解

《Spring@RequestMapping注解及使用技巧详解》@RequestMapping是SpringMVC中定义请求映射规则的核心注解,用于将HTTP请求映射到Controller处理方法... 目录一、核心作用二、关键参数说明三、快捷组合注解四、动态路径参数(@PathVariable)五、匹配请