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. Python 正则表达式匹配小数

    不废话,直接上表达式 (\d+(\.\d+)?) 如: import re find_float = lambda x: re.search("\d+(\.\d+)?",x) .g ...

  2. OpenStack with Opendaylight Part 1: Intro to Pipeline

    Using Vagrant to create vm nodes; devstack to start openstack using Opendaylight as ML2. Openstack w ...

  3. MySql基础学习-mysql安装

    Linux环境下的安装 1检查是否已经安装 sudo service mysql start #若未安装,则提示: mysql: unrecognized service 2安装MySql #安装 M ...

  4. 将datagridview数据保为xml或txt文件

    using System.IOpublic void SaveFile()        {            //实例化一个保存文件对话框            SaveFileDialog s ...

  5. Hive mapreduce SQL实现原理——SQL最终分解为MR任务,而group by在MR里和单词统计MR没有区别了

    转自:http://blog.csdn.net/sn_zzy/article/details/43446027 SQL转化为MapReduce的过程 了解了MapReduce实现SQL基本操作之后,我 ...

  6. android 关于Toast重复显示解决方法

    解决思路:   不用计算Toast的时间之类的,就是定义一个全局的成员变量Toast, 这个Toast不为null的时候才去make,否则直接setText.为了按返回键后立即使Toast不再显示,重 ...

  7. L122

    These plants have much of the same nutritional value that a real plant has. Search giant Google says ...

  8. Leetcode 904. Fruit Into Baskets

    sliding window(滑动窗口)算法 class Solution(object): def totalFruit(self, tree): """ :type ...

  9. java入门学习(1)一简介及其基础特点

    分类: java基础 1.为什么java如此流行,为什么历史选择了它? 因为它拥有全新的编程思想,更接近人们的语言习惯,由于其编译器把代码编译成字节码,然后再不同的平台上运行分别用不同的虚拟机去解释字 ...

  10. HQ的测试流程

    测试流程如下图: