PowerDesigner中Name与Code同步的问题

转自:http://blog.sina.com.cn/u/48932504010005t9

PowerDesigner中,但修改了某个字段的name,其code也跟着修改,这个问题很讨厌,因为一般来说,name是中文的,code是字段名。
解决方法如下:
1、选择Tools->GeneralOptions...菜单,出现General Options对话框。
2、从Category中选择Dialog项。
3、取消右边“Name to Code mirroring”复选框。如下图:
--------------------------------------------------------------------------------------------
PowerDesigner comment与name相互复制

转自:http://www.cnblogs.com/cxd4321/archive/2009/03/07/1405475.html

作者:剑飘红

在使用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进行操作

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

PowerDesigner中配置外键关系时,

如果要删除配置的外键关系,

默认设置会一同删除外键列.

要更改此设置,

需在菜单栏tools中打开Model Options,

在Model Settings中点击Reference,

然后把"Auto-migrate columns"[自动移除列]这个checkbox的勾去掉,即可.

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

让PowerDesigner自动使用Name作为备注

Database->Database Generation

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

去掉 Chinese_PRC

今天在使用PowerDesigner 16设计数据库时,导出的sql语句在SqlServer中执行时,意外的让人悲催、抓狂、甚至想自杀!!!

其中就有如题这样的一个错误,看下面sql语句:

      create table dbo.t_call_note (             id             int                  identity(100,1),              name           char(19)             collate Chinese_PRC_Stroke_90_CS_AS_KS_WS not null,             pwd            char(19)             collate Chinese_PRC_Stroke_90_CS_AS_KS_WS null,            constraint PK_T_CALL_INFO primary key (id)   on "PRIMARY"        )        on "PRIMARY"        go  

其中SqlServer报错:collate chinese_prc_ci_as意外。。。

上面的sql包含collate Chinese_PRC_Stroke_90_CS_AS_KS_WS not null,这是一种排序方式。

但是在执行sql时就会出现错误.如果column为int时就会报错。那么我们如果如下设置,问题不再是问题了。

解决方案:

  1.点击:工具栏-》database-》edit current DBMS

2.选择数据源(以SqlServer2005为例)

Microsoft SQLServer2005\Script\Objects\Column\Add

将如下代改

%20:COLUMN% [%COMPUTE%?AS [(]%COMPUTE%[)]:[%.L:DATATYPE%=xml?xml[%XMLSchemaCollection%?([%ContentType% ]%XMLSchemaCollection.GeneratedName%):]:%20:DATATYPE%][.Z:[ collate %ExtCollation%][%allowFilestream%?[%FileStream%? filestream]][%ExtRowGuidCol%? RowGuidCol][%Mandatory%?:[%Sparse%? sparse]][%IDENTITY%? %IDENTITY%[[(%ExtIdentitySeedInc%)][%ExtIdtNotForReplication%? not for replication]]:[%ExtNullConstName%? constraint %ExtNullConstName%][ %NULL%][ %NOTNULL%]][[%ExtDeftConstName%? constraint %ExtDeftConstName%] default %DEFAULT%]]
   [%CONSTDEFN%]]
 

改为下面代码:

 %20:COLUMN% 
[%COMPUTE%?AS (%COMPUTE%):
[%.L:DATATYPE%=xml?xml
[%XMLSchemaCollection%?(
[%ContentType% ]%XMLSchemaCollection.GeneratedName%):]:%20:DATATYPE%]
[%ExtRowGuidCol%? RowGuidCol]
[%IDENTITY%? %IDENTITY%[[(%ExtIdentitySeedInc%)]
[%ExtIdtNotForReplication%? not for replication]]:[%ExtNullConstName%? constraint %ExtNullConstName%]
[ %NULL%][ %NOTNULL%]][
[%ExtDeftConstName%? constraint %ExtDeftConstName%] default %DEFAULT%]
[%CONSTDEFN%]]

保存即可。

重新生成。。。发现已经没有了。。collate chinese_prc_ci_as

惊喜!!!!

PowerDesigner 常用配置修改的更多相关文章

  1. Tomcat常用配置修改

    Tomcat常用配置修改 说明 运行需要设置环境变量 JAVA_HOME 即JDK安装目录 tomcat 默认登录地址 http://localhost:8080 配置tomcat 1.端口设置 打开 ...

  2. putty常用配置修改

    1.修改putty默认的颜色方案 初次使用putty时,发现默认的配色的方案看得非常难受,特别是黑色背景,深蓝色的字体,根本看不清楚,下面介绍如何更改默认的配色方案: (1)下载配置文件 首先下载注册 ...

  3. django->基本操作和新建项目常用配置

    一.安装django pip install django==2.1.5 -U #安装django/升级最新版本 二.创建.启动django项目 django-admin startproject m ...

  4. PLSQL常用配置之窗口/版面保存、SQL格式化/美化、SQL注释\去掉注释等快捷键配置、登陆历史修改配置

    http://blog.csdn.net/hyeidolon/article/details/8251791   PLSQL常用配置之窗口/版面保存.SQL格式化/美化.SQL注释\去掉注释等快捷键配 ...

  5. 【转】logback logback.xml常用配置详解(二)<appender>

    原创文章,转载请指明出处:http://aub.iteye.com/blog/1101260, 尊重他人即尊重自己 详细整理了logback常用配置, 不是官网手册的翻译版,而是使用总结,旨在更快更透 ...

  6. 【转】logback logback.xml常用配置详解(一)<configuration> and <logger>

    原创文章,转载请指明出处:http://aub.iteye.com/blog/1101260, 尊重他人即尊重自己 详细整理了logback常用配置, 不是官网手册的翻译版,而是使用总结,旨在更快更透 ...

  7. .net学习笔记----WebConfig常用配置节点介绍

    一.配置文件入门 .Net提供了一种保存项目配置信息的办法,就是利用配置文件,配置文件的后缀一般是.config.在WinForm程序中配置文件一般是App.config.在Asp.net中一般默认是 ...

  8. struts2 笔记01 登录、常用配置参数、Action访问Servlet API 和设置Action中对象的值、命名空间和乱码处理、Action中包含多个方法如何调用

    Struts2登录 1. 需要注意:Struts2需要运行在JRE1.5及以上版本 2. 在web.xml配置文件中,配置StrutsPrepareAndExecuteFilter或FilterDis ...

  9. VMware中安装CentOS7网络配置静态IP地址,常用配置和工具安装

    VMware中安装CentOS7网络配置静态IP地址,常用配置和工具安装在阿里云开源镜像地址下载镜像Index of /centos/7.2.1511/isos/x86_64/http://mirro ...

随机推荐

  1. 结合 RunLoop 和 Instrument 定位卡顿

    iOS 应用,丝般顺滑的理想情况就是 60FPS (对于 iPad Pro 是 240FPS),即在 16ms 之内完成一次渲染.如果找到在每次渲染花费了多久,究竟做了什么事情,那么就可以进行针对性的 ...

  2. 【BZOJ2127】happiness 最小割

    题目大意:有一个$n\times m$的矩阵,矩阵的每个位置上有一个同学,经过一个学期的相处,每个同学和前后左右相邻的同学互相成为了好朋友.这学期要分文理科了,每个同学对于选择文科与理科有着自己的喜悦 ...

  3. JavaScript父子页面之间的相互调用

    父页面: <!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head>< ...

  4. 死锁、Lock锁、等待唤醒机制、线程组、线程池、定时器、单例设计模式_DAY24

    1:线程(理解) (1)死锁 概念: 同步中,多个线程使用多把锁之间存在等待的现象. 原因分析: a.线程1将锁1锁住,线程2将锁2锁住,而线程1要继续执行锁2中的代码,线程2要继续执行锁1中的代码, ...

  5. django框架--cookie/session

    目录 一.http协议无状态问题 二.会话跟踪技术--cookie 1.对cookie的理解 2.cookie的使用接口 3.cookie的属性 4.使用cookie的问题 三.会话跟踪技术--ses ...

  6. JavaScript -- Constructor、Prototype

    ----- 012-constructor.html ----- <!DOCTYPE html> <html> <head> <meta http-equiv ...

  7. C/C++ -- Gui编程 -- Qt库的使用 -- 理解主窗体构造函数

    MyWidget做父窗体 MyWidget的构造函数中可以手动添加组件 Ui::MyWidget存放子部件 Ui::MyWidget执行setupUi()函数为子部件开辟空间,指定父窗体 MyWidg ...

  8. 解决linux安装软件依赖的曲线救国方案

    相信大家在一台无法连接外网的linux上安装软件时,对于软件依赖的安装,都会特别头疼,因为软件依赖的安装,不论是其数量,还是安装的复杂度都比软件本身要高出一个维度! 今天就和大家分享一个,解决linu ...

  9. GBDT多分类示例

    相当于每次都是用2分类,然后不停的训练,最后把所有的弱分类器来进行汇总 样本编号 花萼长度(cm) 花萼宽度(cm) 花瓣长度(cm) 花瓣宽度 花的种类 1 5.1 3.5 1.4 0.2 山鸢尾 ...

  10. [转] Ubuntu 14.04/14.10下安装VMware Workstation 11图文教程

    点击这里查看原文 译者:GuiltyMan 本文由 Linux公社翻译组 原创翻译  Linux公社 诚意奉献 更多请访问此处博客网站 VMware workstation 是一个可以进行桌面操作的虚 ...