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. 在与SQLServer建立连接时出现与网络相关的或特定于实例的错误

    标题: 连接到服务器 ------------------------------ 无法连接到 (local). ------------------------------ 其他信息: 在与 SQL ...

  2. JSON解析字符串

    JSON解析字符串 JSON 解析字符串时,应按严格的标准,否则无法解析: str1 = '{"str":"string","number" ...

  3. 到底EJB是什么

    到底EJB是什么   到底EJB是什么?被口口相传的神神秘秘的,百度一番,总觉得没有讲清楚的,仍觉得一头雾水.百度了很久,也从网络的文章的只言片语中,渐渐有了头绪. 用通俗话说,EJB就是:" ...

  4. hihoCoder挑战赛27题目一 福字 (dp)

    题目: 一个n × n的矩阵,其中每个位置都是一个非负整数. 一个福字被定义成是大小为 k 的正方形,满足其中的每个位置上的数都恰好比他的左边的那个和上边的那个大1(如果左边或上边的那个不存在的话就无 ...

  5. PAT1028. List Sorting (25)

    id用int,避免了id的strcmp,不然用string就超时. #include <iostream> #include <vector> #include <alg ...

  6. Quartz实现定时任务实例

    1首先实现Job接口,创建任务 public class HelloJob implements Job{ @Override public void execute(JobExecutionCont ...

  7. Codeforces 870E Points, Lines and Ready-made Titles:并查集【两个属性二选一】

    题目链接:http://codeforces.com/problemset/problem/870/E 题意: 给出平面坐标系上的n个点. 对于每个点,你可以画一条经过这个点的横线或竖线或什么都不画. ...

  8. ImageSwitch图像切换控件

    ImageSwitch图像切换控件 继承ViewAnimator所以可以做动画 继承ViewGroup所以可以装别的控件,所以ImageSwitch里面装的就是image,不过要找个ImageView ...

  9. Android项目的目录结构 初学者记录

    Android项目的目录结构 Activity:应用被打开时显示的界面 src:项目代码 R.java:项目中所有资源文件的资源id Android.jar:Android的jar包,导入此包方可使用 ...

  10. 三张图较为好理解JavaScript的原型对象与原型链

    最近从网上看到别人详细得讲解了js的原型对象和原型链,看完感觉是看得最清晰的一个,于是,摘录到自己博客里 对于新人来说,JavaScript的原型是一个很让人头疼的事情,一来prototype容易与_ ...