PowerDesigner实用技巧小结(2)
PowerDesigner实用技巧小结
1、ORACLE数据库建模时,由于ORACLE的表名、字段名如果是小写会有一定的麻烦,需要将小写转化为大写?
(1)在打开pdm的情况下,进入Tools-Model Options-Naming Convention,把Name和Code的标签的Charcter case选项设置成Uppercase就可以!
(2)如果仅想在preview这一层实现,也可以选择Database->Edit current database->Script->Sql->Format,有一项CaseSensitivityUsingQuote,它的 comment为"Determines if the case sensitivity for identifiers is managed using double quotes",表示是否适用双引号来规定标识符的大小写, 可以看到右边的values默认值为"YES",改为"No"即可!
建议使用方法(1)。
2、在PDM里,发现某些字段的类型不可改?
这可能是引用了DOMAIN的缘故,可以双击此列,进行更改。
3、PDM连接的数据库类型更改?
Database-Change/Edit Current Dbms...
4、如何根据字段的中文NAME,以其汉语拼音首字母取得CODE英文名?
在tools--> execute command 下执行 run script 的VB脚本:
chn_to_ps.vbs
Option Explicit
ValidationMode = True
InteractiveMode = im_Batch
' get the current active model
Dim mdl ' the current model
Set mdl = ActiveModel
If (mdl Is Nothing) Then
MsgBox "There is no Active Model"
Else
ListObjects(mdl)
End If
'-----------------------------------------------------------------------------
' Sub procedure to scan current package and print information on objects from current package
' and call again the same sub procedure on all children pacakge
' of the current package
'-----------------------------------------------------------------------------
Private Sub ListObjects(fldr) '列出所有的对象
output "Scanning " & fldr.code
Dim obj ' running object
For Each obj In fldr.children
' Calling sub procedure to print out information on the object
'DescribeObject obj
TableSetNameToCode obj
Next
' go into the sub-packages
Dim f ' running folder
For Each f In fldr.Packages '递归调用列出所有的对象
'calling sub procedure to scan children package
ListObjects f
Next
End Sub
'-----------------------------------------------------------------------------
' Sub procedure to print information on current object in output
'-----------------------------------------------------------------------------
Private Sub DescribeObject(CurrentObject)
if not CurrentObject.Iskindof(cls_NamedObject) then exit sub
output "Found "+CurrentObject.ClassName+" """+CurrentObject.Name+""", Created by "+CurrentObject.Creator+" On "+Cstr(CurrentObject.CreationDate)
End Sub
'常数 值 描述
'vbCr Chr(13) 回车符。
'vbCrLf Chr(13) & Chr(10) 回车符与换行符。
'vbFormFeed Chr(12) 换页符;在 Microsoft Windows 中不适用。
'vbLf Chr(10) 换行符。
'vbNewLine Chr(13) & Chr(10) 或 Chr(10) 平台指定的新行字符;适用于任何平台。
'vbNullChar Chr(0) 值为 0 的字符。
'vbNullString 值为 0 的字符串 与零长度字符串 ("") 不同;用于调用外部过程。
'vbTab Chr(9) 水平附签。
'vbVerticalTab Chr(11) 垂直附签;在 Microsoft Windows 中不适用。
Private Sub TableSetNameToCode(CurrentObject)
if not CurrentObject.Iskindof(cls_Table) then exit sub
'output "Found "+CurrentObject.ClassName+" """+CurrentObject.Name+""", Created by "+CurrentObject.Creator+" On "+Cstr(CurrentObject.CreationDate)
if not CurrentObject.isShortcut then
output CurrentObject.name
CurrentObject.code = "T_"&GetPy( CurrentObject.name)
CurrentObject.comment = CurrentObject.name & "_"&CurrentObject.code
Dim col ' running column
dim index1
index1 = 0
for each col in CurrentObject.columns
dim str11
str11 = GetPy( col.name)
col.code = str11 & cstr(index1 )
col.Comment = col.name & "_" & col.code
index1 = index1 + 1
next
end if
End Sub
'//生成汉字串首字母串
function GetPy(strxx)
dim i
dim getpy1
for i=1 to len(strxx)
getpy1=getpy1 & getpychar(mid(strxx,i,1))
next
output getpy1
GetPy = getpy1
End function
'//获取汉字的首字母
function getpychar(char)
'0---9 , a---z , A---Z
if ((asc(char) >= asc("0") and asc(char) <= asc("9")) or (asc(char) >= asc("A") and asc(char) <= asc("Z")) or (asc(char) >= asc("a") and asc(char) <= asc("Z")) or asc(char) = asc("_") ) then
getpychar = char
else
dim tmpp:tmpp=65536+asc(char)
if(tmpp>=45217 and tmpp<=45252) then
getpychar= "A"
elseif(tmpp>=45253 and tmpp<=45760) then
getpychar= "B"
elseif(tmpp>=45761 and tmpp<=46317) then
getpychar= "C"
elseif(tmpp>=46318 and tmpp<=46825) then
getpychar= "D"
elseif(tmpp>=46826 and tmpp<=47009) then
getpychar= "E"
elseif(tmpp>=47010 and tmpp<=47296) then
getpychar= "F"
elseif(tmpp>=47297 and tmpp<=47613) then
getpychar= "G"
elseif(tmpp>=47614 and tmpp<=48118) then
getpychar= "H"
elseif(tmpp>=48119 and tmpp<=49061) then
getpychar= "J"
elseif(tmpp>=49062 and tmpp<=49323) then
getpychar= "K"
elseif(tmpp>=49324 and tmpp<=49895) then
getpychar= "L"
elseif(tmpp>=49896 and tmpp<=50370) then
getpychar= "M"
elseif(tmpp>=50371 and tmpp<=50613) then
getpychar= "N"
elseif(tmpp>=50614 and tmpp<=50621) then
getpychar= "O"
elseif(tmpp>=50622 and tmpp<=50905) then
getpychar= "P"
elseif(tmpp>=50906 and tmpp<=51386) then
getpychar= "Q"
elseif(tmpp>=51387 and tmpp<=51445) then
getpychar= "R"
elseif(tmpp>=51446 and tmpp<=52217) then
getpychar= "S"
elseif(tmpp>=52218 and tmpp<=52697) then
getpychar= "T"
elseif(tmpp>=52698 and tmpp<=52979) then
getpychar= "W"
elseif(tmpp>=52980 and tmpp<=53688) then
getpychar= "X"
elseif(tmpp>=53689 and tmpp<=54480) then
getpychar= "Y"
elseif(tmpp>=54481 and tmpp<=62289) then
getpychar= "Z"
else '如果不是中文,则用''代替
getpychar=""
end if
end if
output getpychar + "---->" + cstr(tmpp)
End Function
注:可以根据实际情况需要,对脚本进行微调,如:根据名称生成注释等。
5、在查看编辑表时,可以一次选中多个列,然后对选中列的字段类型、主键等统一操作。
6、逻辑图形的显示
Tools/Model Options选项可以选择图形上是显示Name、Code;
Tools/Display Preferences可以选择图形上显示的项目,如数据类型等;
7、在修改name的时候,code的值将跟着变动
Tools/General Options 打开Dialog将Operating modes中的 Name To Code mirroring 將前面的勾去掉
8、sql语句中表名与字段名前的引号去除
进入Tools-Model Options-Naming Convention,把Name和Code的标签的Charcter case选项设置成Uppercase或者Lowercase,只要不是Mixed Case就行
9、批量生成测试数据
DataBase->Generation Test Data-> 在此项内,可自由选择、设置
10、根据中文名生成注释(通过4修改一下也可以,但效率太低)
cat Create_Comment_src_chn.vbs
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 code 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
11、PDM或CDM连线添加或删除结点
CTRL+左键单击即可。
PowerDesigner实用技巧小结(2)的更多相关文章
- PowerDesigner实用技巧小结(3)
PowerDesigner实用技巧小结(3) PowerDesigner 技巧小结 sqlserver数据库databasevbscriptsqldomain 1.PowerDesigner 使用 M ...
- PowerDesigner实用技巧小结(4)
下述十四个技巧,是许多人在大量的数据库分析与设计实践中,逐步总结出来的.对于这些经验的运用,读者不能生帮硬套,死记硬背,而要消化理解,实事求是,灵活掌握.并逐步做到:在应用中发展,在发展中应用. 1. ...
- CentOS系统中的passwd命令实用技巧小结
这篇文章主要介绍了Linux系统中的passwd命令实用技巧小结,是Linux入门学习中的基础知识,需要的朋友可以参考下 先来回顾一下passwd命令的基本用法: Linux passwd命令用来 ...
- PowerDesigner实用方法小结(1)
PowerDesigner使用方法小结 PowerDesigner多用来进行数据库模型设计,具有SQL语句自动生成等功能.当然,也有不少缺点,比如团队分享. 一.设置PowerDesigner模型视图 ...
- JavaScript 实用技巧和写法建议
1.前言 从大学到现在,接触前端已经有几年了,感想方面,就是对于程序员而言,想要提高自己的技术水平和编写易于阅读和维护的代码,我觉得不能每天都是平庸的写代码,更要去推敲,去摸索和优化代码,总结当中的技 ...
- Notepad++ 实用技巧
Notepad++是一款开源的文本编辑器,功能强大.很适合用于编辑.注释代码.它支持绝大部分主流的编程语言. 本文主要列举了本人在实际使用中遇到的一些技巧. 快捷键 自定义快捷键 首先,需要知道的是: ...
- javascript实用技巧、javascript高级技巧
字号+作者:H5之家 来源:H5之家 2016-10-31 11:00 我要评论( ) 三零网提供网络编程. JavaScript 的技术文章javascript实用技巧.javascript高级技巧 ...
- iOS开发实用技巧—Objective-C中的各种遍历(迭代)方式
iOS开发实用技巧—Objective-C中的各种遍历(迭代)方式 说明: 1)该文简短介绍在iOS开发中遍历字典.数组和集合的几种常见方式. 2)该文对应的代码可以在下面的地址获得:https:// ...
- iOS开发实用技巧—在手机浏览器头部弹出app应用下载提示
iOS开发实用技巧—在手机浏览器头部弹出app应用下载提示 本文介绍其简单使用: 第一步:在本地建立一个访问的服务端. 打开本地终端,在本地新建一个文件夹,在该文件夹中存放测试的html页面. ...
随机推荐
- JavaScript跨站脚本攻击
跨站脚本攻击(Cross-Site Scrpting)简称为XSS,指的是向其他域中的页面的DOM注入一段脚本,该域对其他用户可见.恶意用户可能会试图利用这一弱点记录用户的击键或操作行为,以窃取用户的 ...
- 织梦dede_archives文章主表详细介绍
dede_archives文章主表,存放着各频道文章的主要信息,比如创建时间,所属栏目,所属频道,作者等详细的信息. ID int(11) 自动编号typeid int(11) 所属主栏目编号 ...
- LibLinear(SVM包)使用说明之(二)MATLAB接口
LibLinear(SVM包)使用说明之(二)MATLAB接口 LibLinear(SVM包)使用说明之(二)MATLAB接口 zouxy09@qq.com http://blog.csdn.net/ ...
- PHP漏洞全解(五)-SQL注入攻击
本文主要介绍针对PHP网站的SQL注入攻击.所谓的SQL注入攻击,即一部分程序员在编写代码的时候,没有对用户输入数据的合法性进行判断,使应用程序存在安全隐患.用户可以提交一段数据库查询代码,根据程序返 ...
- Burp Suite Walkthrough(英文版)
Burp Suite is one of the best tools available for web application testing. Its wide variety of featu ...
- 【NOIP 2014 DAY1 T3】飞扬的小鸟(DP)
题目描述 Flappy Bird 是一款风靡一时的休闲手机游戏.玩家需要不断控制点击手机屏幕的频率来调节小鸟的飞行高度,让小鸟顺利通过画面右方的管道缝隙.如果小鸟一不小心撞到了水管或者掉在地上的话,便 ...
- 汇编函数调用中bp和sp是指什么?
bp为基址寄存器,一般在函数中用来保存进入函数时的sp的栈顶基址sp是栈顶指针,它每次指向栈顶.每次子函数调用时,系统在开始时都会保存这个两个指针并在函数结束时恢复sp和bp的值.像下面这样:在函数进 ...
- PO > Create PO时关于汇率问题需要注意的步骤
为了使得RMB采购的PO在审核时不会提示汇率丢失(如下图),在创建PO时需要注意几个步骤. 1)手动创建PO:在建立PO行之前,应该选择好正确的"地点","币 ...
- openwrt开发
之前写过一篇日志,是关于如何搭建自己的OpenWRT开发环境.经过最近一段时间的开发学习和实践,对OpenWRT环境的开发有了一定的了解.在这里将我的开发心得做个整理. 1.搭建开发环境 首先,我们需 ...
- oracle的一种字符串处理机制。
orcale会把空字符串当成Null进行存储,sqlserver直接存储空字符串