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_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

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

以上两段代码都是VB脚本,在PowerDesigner中使用方法为:

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

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

时间: 2024-08-11 03:35:23

PowerDesigner 把Comment写到name中 和把name写到Comment中 pd7以后版本可用的相关文章

PowerDesigner里面将表中name列值复制到comment列

/** * PowerDesigner里面将表中name列值复制到comment列 * @see -------------------------------------------------------------------------------------------------------------------- * @see pd中的pdm默认生成sql时,字段是没有注释的..想要注释的话,有2个方法 * @see 1.也是推荐的 * @see pdm中双击打开一个Table,

jquery 中$('.ui-selecter',this)这样写 是什么意思 求解释 见到都是这种$("div")

如果用$("div")是拿选择所有的div$('.ui-selecter',this)选择的是现在选项中的child里面class是ui-selecter的意思跟jQuery(this).find(".ui-selecter");等同 $('span',this)等同于$(this).find('span') jquery 中$('.ui-selecter',this)这样写 是什么意思 求解释 见到都是这种$("div")

标准动作中犯的错误,使用过程中忘记写结束符号所发生的错误

例如 错误写法: <jsp:getProperty property="userName" name="user" > 正确写法:<jsp:getProperty property="userName" name="user" /> 导致的异常: HTTP Status 500 - type Exception report message description The server encounte

在Java中如何逐行地写文件?

下边是写东西到一个文件中的Java代码.运行后每一次,一个新的文件被创建,并且之前一个也将会被新的文件替代.这和给文件追加内容是不同的. public static void writeFile1() throws IOException { File fout = new File("out.txt"); FileOutputStream fos = new FileOutputStream(fout); BufferedWriter bw = new BufferedWriter(

JS中函数之外不能写return

JS中return有时会遇到这种情况,具体表现为:google浏览器等浏览器可以继续执行,IE浏览器不能执行return,并且google浏览器:执行时会显示SyntaxError: Illegal return statement:IE浏览器:问题原因:'return' 语句在函数之外.JS语法中return是不能写在函数外的,例如说<html><body><script>var a=“精益六西格玛公开班”;return a;</script></b

finally中调用unlockWrite对写出健壮代码是很重要的

一般用于某张表的补充,比如用户基本信息是一张表,但并非每一个用户都需要有登录的权限,不需要记录用户名和密码,此时,合理的做法就是新建一张记录登录信息的表,与用户信息进行一对一的关联,可以方便的从子表查询母表信息或反向查询 外键:有很多的应用场景,比如每个员工归属于一个部门,那么就可以让员工表的部门字段与部门表进行一对多关联,可以查询到一个员工归属于哪个部门,也可反向查出某一部门有哪些员工 如果某个线程想要读取资源,只要没有线程正在对该资源进行写操作且没有线程请求对该资源的写操作即可.我们假设对写

把txt文件中的json字符串写到plist文件中

- (void)json2Plist { NSString *filePath = [self applicationDocumentsDirectoryFileName:@"json"]; NSMutableArray *tempArray = [[NSMutableArray alloc] initWithContentsOfFile:filePath]; //第一次添加数据时,数组为空 if (tempArray.count == 0) { tempArray = [NSMuta

NIO入门系列之第3章:从理论到实践:NIO 中的读和写

3.1  概述 读和写是 I/O 的基本过程.从一个通道中读取很简单:只需创建一个缓冲区,然后让通道将数据读到这个缓冲区中.写入也相当简单:创建一个缓冲区,用数据填充它,然后让通道用这些数据来执行写入操作. 在本节中,我们将学习有关在Java 程序中读取和写入数据的一些知识.我们将回顾 NIO 的主要组件(缓冲区.通道和一些相关的方法),看看它们是如何交互以进行读写的.在接下来的几节中,我们将更详细地分析这其中的每个组件以及其交互. 3.2  从文件中读取 在我们第一个练习中,我们将从一个文件中

JavaScript对象中的属性(可写,可配置,可枚举,value,getter,setter)

JavaScript中,对象包括3个特性,分别为,可扩展性,class标识符,属性. 如果对象的可扩展性为false,则不可为对象动态的添加属性. 对象包含分为存取器属性和值属性.存取属性为 {get r(){/*函数实现*/},set r(){/*函数实现*/}} 存取器属性自身不能保存值,set相当于对对象中其他的属性进行更改.get中也可以返回其他属性的值.属性的特性值为 可写性,可配置性,value,可枚举性.存取器属性使用get,set属性来替换可写性和value. 在没有实现ES5的