Option   Explicit

ValidationMode   =   True

InteractiveMode =   im_Batch

Dim   mdl   '当前model

'获取当前活动model

Set   mdl   =   ActiveModel

If   (mdl   Is   Nothing)   Then

MsgBox   "There   is   no   current   Model "

ElseIf   Not   mdl.IsKindOf(PdcDM.cls_Model)   Then '如果是处理pdm,这里换成PdPDM.cls_Model

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   ref   '要处理的对象

for   each   ref   in  folder.relationships

if   not   ref.isShortcut   then

if instr(lcase(ref.code),"relationship_") =1  then

dim ctable '子表名称
                 ctable= lcase(ref.entity1.name)
                 dim ptable '父表名称
                 ptable=lcase(ref.entity2.name)
                
                 dim relation
                 if(len(ptable)>12) then
                 relation=         mid(ptable,1,8)+mid(ptable,len(ptable)-3)
                 else
                 relation=ptable
                 end if
                 relation=relation+"-"
                
                 if(len(ctable)>12) then
                 relation=relation+mid(ctable,1,8)+mid(ctable,len(ctable)-3)
                 else
                 relation=relation+ctable
                 end if
                 relation=ucase(relation)
                                 
                 output ref.name+">>>>"+ relation
                 ref.name=relation
                 ref.code=relation

end if

end if

next

'22222222222222222222222222222222222222222222222222222222222222222222222处理继承关系

for   each   ref   in  folder.inheritances

if   not   ref.isShortcut   then

'output ref.ParentEntity.name+"//"+ref.ChildrenList

dim ctable '子表名称

ctable= lcase(ref.ChildrenList)

dim ptable '父表名称

ptable=lcase(ref.ParentEntity.name)

dim relation

if(len(ptable)>12) then

relation=         mid(ptable,1,8)+mid(ptable,len(ptable)-3)

else

relation=ptable

end if

relation=relation+"-"

if(len(ctable)>12) then

relation=relation+mid(ctable,1,8)+mid(ctable,len(ctable)-3)

else

relation=relation+ctable

end if

relation=ucase(relation)

output folder.parent.name+"--->"+folder.name+"--->"+ref.name+"}}}}}"+ relation

ref.name=relation

ref.code=relation

end if

'  end if

next

'递归遍历子文件夹

Dim   f   '子文件夹

For   Each   f   In   folder.Packages

if   not   f.IsShortcut   then

ProcessFolder   f

end   if

Next

end   sub

将CDM中所有以Relatonship_开头的关系全部重命名,避免生成数据库因为重复关系名报错的更多相关文章

  1. 【mybatis】mybatis执行一个update方法,返回值为1,但是数据库中数据并未更新,粘贴sql语句直接在数据库执行,等待好久报错:Lock wait timeout exceeded; try restarting transaction

    今天使用mybatis和jpa的过程中,发现这样一个问题: mybatis执行一个update方法,返回值为1,但是数据库中数据并未更新,粘贴sql语句直接在数据库执行,等待好久报错:Lock wai ...

  2. MySql语句中select可以嵌套么,字段的重命名可以用中文么

    今天文档中看到的查询语句,SELECT后面又跟了一个SELECT嵌套,而且把字段重命名为中文,请问可以这样做么 MySql语句中select可以嵌套么,字段的重命名可以用中文么 >> my ...

  3. 如果在Yii中,使用AR查询,不直接写sql,则在使用的时候会报错

    如果在Yii中,使用AR查询,不直接写sql,则在使用的时候会报错 Student::find() ->select("id,name,from_unixtime(create_tim ...

  4. vue中"‘webpack-dev-server’不是内部或外部命令,也不是可运行的程序"的报错

    在vue项目中发现了这个报错  解决办法将项目里的“node_modules”文件夹删除,然后重新运行cnpm install

  5. NetCore 3.0 中使用Swagger生成Api说明文档及升级报错原因

    认识Swagger Swagger 是一个规范和完整的框架,用于生成.描述.调用和可视化 RESTful 风格的 Web 服务.总体目标是使客户端和文件系统作为服务器以同样的速度来更新.文件的方法,参 ...

  6. PDM生成数据库-0设置表名和字段名中不带双引号

    如果PDM直接导出脚本的话,所有的表和字段都会被加上双引号,非常不方便,去除双引号的办法: Database->Edit Current DBMS在弹出窗体中第一项General中找到 Scri ...

  7. 在myeclipse中maven项目关于ssh整合时通过pom.xml导入依赖是pom.xml头部会报错

    错误如下 ArtifactTransferException: Failure to transfer org.springframework:spring-jdbc:jar:3.0.5.RELEAS ...

  8. 利用Eclipse中的Maven构建Web项目报错(一)

    利用Eclipse中的Maven构建Web项目 1.在进行上述操作时,pom.xml一直报错 <project xmlns="http://maven.apache.org/POM/4 ...

  9. RN项目中使用react-native-elements报错: Unrecognized font family 'Material Icons'

    查询了一些方案,但各自的环境不尽相同,最后在google中找到了答案.主要问题在于 (1)版本问题 (2)Xcode配置问题 报错如下 解决步骤: 1 . 首先需要正确安装 npm i -S reac ...

随机推荐

  1. GDKOI2017游记

    去年的GDKOI在寒假(虽然我没参加),但由于一些机♂缘♂巧♂合♂,比赛时间变成了开学之后的第一周,于是直接导致了当我的同学们在认真学习的同时,我在广州无所事事地和同学谈♂笑♂风♂生♂.(太好了,可以 ...

  2. math.floor实现四舍五入

     lua math.floor 实现四舍五入: lua 中的math.floor函数是向下取整函数. math.floor(5.123) -- 5 math.floor(5.523) -- 5 用此特 ...

  3. JavaScript -- 广告随鼠标移动, 点击一次后关闭

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  4. QT (QSS) 编程, QSS语法概述。。setstylesheet

    http://www.cnblogs.com/davesla/archive/2011/01/30/1947928.html 转载] QT皮肤(QSS)编程 借用css 的灵感, Qt也支持Qt自己的 ...

  5. DataWarehouse- 从面试定位自己的水平

    1.讲一下什么是维度表和事实表.用户资料表算是什么类型表. 2. 维度建模属于第几范式,让你对维度建模改进,有什么思路吗. 3. 了解数据血缘分析吗,让你实现的话有什么技术方案,感觉难点在哪. 4. ...

  6. c++ STL库deque和vector的例子

    头文件wuyong.h: #pragma once #include<iostream> #include<vector> #include<deque> #inc ...

  7. underscore中template的使用Demo

    在客户端渲染数据时,一般可通过underscore中的template对数据模板进行渲染,例如: 定义模板,需要把type类型设置为“text/template” <script type=&q ...

  8. oracle decode函数 和 case when

    1.oracle decode分支函数 select decode(to_char(B.LQSJ, 'hh24:mi:ss'), '00:00:00', to_char(B.LQSJ, 'yyyy-m ...

  9. 201621123014《Java程序设计》第十四周学习总结

    1. 本周学习总结 1.1 以你喜欢的方式(思维导图或其他)归纳总结与数据库相关内容. 2. 使用数据库技术改造你的系统 2.1 简述如何使用数据库技术改造你的系统.要建立什么表?截图你的表设计. 答 ...

  10. Leetcode 969. Pancake Sorting

    每次找到当前最大数,转两下把最大数转到最右边.重复这个操作,直到都转完. 时间复杂度O(n**2) class Solution(object): def pancakeSort(self, A): ...