PowerDesigner实用技巧小结(2)

news/2024/7/3 13:53:40 标签: 数据库

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+左键单击即可。

转载于:https://www.cnblogs.com/sczw-maqing/p/3252714.html


http://www.niftyadmin.cn/n/545264.html

相关文章

ARM工作模式

1. 工作状态 从编程的角度看&#xff0c;ARM微处理器的工作状态一般有两种&#xff0c;并可在两种状态之间切换&#xff1a; 1&#xff09;第一种为ARM状态&#xff0c;此时处理器执行32位的字对齐ARM指令&#xff0c;绝大部分工作在此状态&#xff1b; 2&#xff09;第二种为…

高效IO之Dex加密(三)

更多Android高级架构进阶视频学习请点击&#xff1a;https://space.bilibili.com/474380680 apk加固原理之dex加密 原理其实不复杂&#xff0c;加固其实就是加密dex文件&#xff0c;防止dex专程jar 被阅读。后面才是热部署解密dex&#xff1b; 一、加密和解密方案 既然我们…

openssl基本原理 + 生成证书 + 使用实例

1. 基本原理 参考&#xff1a;http://www.cnblogs.com/phpinfo/archive/2013/08/09/3246376.html Begin http://www.cnblogs.com/phpinfo/archive/2013/08/09/3246376.html 公司一个项目要进行交易数据传输,因为这个项目银行那边也是刚刚开始启动,所有的支持只有一个传输字段…

高级UI晋升之触摸事件分发机制(一)

更多Android高级架构进阶视频学习请点击&#xff1a;https://space.bilibili.com/474380680 0. 前言 鉴于安卓分发机制较为复杂&#xff0c;故分为多个层次进行讲解&#xff0c;分别为基础篇、实践篇与高级篇。 &#xff08;一&#xff09;基础篇&#xff1a;从基本概念入手…

PHP中正则表达式学习及应用

PHP中正则表达式 1、正则表达式的介绍和作用2、PHP中两个常用的正则函数3、正则表达式中包括的元素4、正则表达式中的“原子” 1、正则表达式的介绍和作用 什么是正则表达式 在编写处理字符串的程序或网页时&#xff0c;经常会有查找符合某些复杂规则的字符串的需要。正则表达式…

jenkins构建自由风格项目[四]

标签&#xff08;linux&#xff09;&#xff1a; jenkins 笔者Q:972581034 交流群&#xff1a;605799367。有任何疑问可与笔者或加群交流 构建一个php项目 创建一个新的项目 选择从git获取源码 配置gitlab deploy keys 第一步&#xff1a;第二步&#xff1a;第三步&#xff1a;…

ARM寻址方式

所谓寻址方式就是处理器根据指令中给出的地址信息来寻找物理地址的方式。 ARM处理器的寻址方式 目前ARM处理器支持9种寻址方式&#xff0c;分别是立即数寻址、寄存器寻址、寄存器偏移寻址、寄存器间接寻址、基址变址寻址、多寄存器寻址、相对寻址、堆栈寻址和块拷贝寻址。 1. …

高级UI晋升之View渲染机制(二)

更多Android高级架构进阶视频学习请点击&#xff1a;https://space.bilibili.com/474380680 优化性能一般从渲染&#xff0c;运算与内存&#xff0c;电量三个方面进行&#xff0c;今天开始说聊一聊Android的渲染机制&#xff0c;我们要知道Android系统每隔16ms就重新绘制一次A…