PowerDesigner 设计数据库中常用脚本
PowerDesigner 设计数据库中常用脚本
物理模型设置
Name转Comment脚本
'******************************************************************************
'* File: name2comment.vbs
'* Title: Name to Comment Conversion
'* Model: Physical Data Model
'* Objects: Table, Column, View
'* Author: steveguoshao
'* Created: 2013-11-29
'* Mod By:
'* Modified:
'* Version: 1.0
'* Memo: Modify from name2code.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 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
if trim(tab.comment)="" then'如果有表的注释,则不改变它.如果没有表注释.则把name添加到注释里面.
tab.comment = tab.name
Dim col ' running column
for each col in tab.columns
if trim(col.comment)="" then '如果col的comment为空,则填入name,如果已有注释,则不添加;这样可以避
col.comment= col.name
next
end if
next
Dim view 'running view
for each view in folder.Views
if not view.isShortcut and trim(view.comment)="" 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
注释转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
'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
if len(tab.comment) <> 0 then
tab.name = tab.comment
end if
On Error Resume Next
Dim col 'running column
for each col in tab.columns
if len(col.comment) <>0 then
col.name =col.comment
end if
On Error Resume Next
next
end if
next
end sub
able加前缀脚本
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 //如果为概念模型 为PdCDM.cls_Model
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
if InStr(tab.code,"tb_") = 0 then
tab.code="tb_"+tab.code
end if
end if
next
end sub
对应数据类型
类型 | 数据库类型 | 内容 | 长度 |
---|---|---|---|
Integer int / INTEGER | 32-bit integer | — | |
Short Integer | int / INTEGER | 32-bit integer | — |
Byte | tinyint / SMALLINT | 256 values | — |
Number | numeric / NUMBER | Numbers with a fixed decimal point | Fixed |
Decimal | decimal / NUMBER | Numbers with a fixed decimal point | Fixed |
Float | float / FLOAT | 32-bit floating point numbers | Fixed |
Short Float | real / FLOAT | Less than 32-bit point decimal number | — |
Long Float | double precision / BINARY DOUBLE | 64-bit floating point numbers | — |
Money | money / NUMBER | Numbers with a fixed decimal point | Fixed |
Serial | numeric / NUMBER | Automatically incremented numbers | Fixed |
Boolean | bit / SMALLINT | Two opposing values (true/false; yes/no; 1/0) | — |
— | |||
Characters | char / CHAR | Character strings | Fixed |
Variable Characters | varchar / VARCHAR2 | Character strings | Maximum |
Long Characters | varchar / CLOB | Character strings | Maximum |
Long Var Characters | text / CLOB | Character strings | Maximum |
Text | text / CLOB | Character strings | Maximum |
Multibyte | nchar / NCHAR | Multibyte character strings | Fixed |
Variable Multibyte | nvarchar / NVARCHAR2 | Multibyte character strings | Maximum |
— | |||
Date | date / DATE | Day, month, year | — |
Time | time / DATE | Hour, minute, and second | — |
Date & Time | datetime / DATE | Date and time | — |
Timestamp | timestamp / TIMESTAMP | System date and time | — |
— | |||
Binary | binary / RAW | Binary strings | Maximum |
Long Binary | image / BLOB | Binary strings | Maximum |
Bitmap | image / BLOB | Images in bitmap format (BMP) | Maximum |
Image | image / BLOB | Images | Maximum |
OLE | image / BLOB | OLE links | Maximum |
Other | — | User-defined data type | — |
概念模型
Name转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(PdCDM.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 Entity 'running table
for each Entity in folder.entities
if not Entity.isShortcut then
if trim(Entity.comment)="" then'如果有表的注释,则不改变它.如果没有表注释.则把name添加到注释里面.
Entity.comment = Entity.name
end if
Dim Attr ' running column
for each Attr in Entity.Attributes
if trim(Attr.comment)="" then '如果col的comment为空,则填入name,如果已有注释,则不添加;这样可以避
Attr.comment= Attr.name
end if
Next
end if
Next
' go into the sub-packages
Dim f ' running folder
For Each f In folder.Packages
MsgBox folder.Packages
if not f.IsShortcut then
ProcessFolder f
end if
Next
end sub
PowerDesigner 设计数据库中常用脚本的更多相关文章
- 采用PowerDesigner 设计数据库
PowerDesigner设计数据库的教程网上都有,最好的是我一位同学写的,地址: 点击这里 我的大致流程如下: 首先要以管理员的身份打开PowerDesigner,如果没这么做,将导致后面无法创建S ...
- 使用POWERDESIGNER设计数据库的20条技巧(转)
1.PowerDesigner使用MySQL的auto_increment ◇问题描述: PD怎样能使主键id使用MySQL的auto_increment呢? ◇解决方法: 打开table prope ...
- 新手学习数据库(一)用Powerdesigner设计数据库
说明: 一.学会用开发语言进行数据库编程,其关键是在于学会sql语言,开发语言只不过给程序员提供了一个操作数据库的接口罢了. 二. 本人也是初学者,采用的数据库设计软件是powerdesigner.利 ...
- 利用PowerDesigner设计数据库
PowerDesigner非常强大, 可以利用它完成数据库的设计. 1.下载地址:http://pan.baidu.com/s/1DsLrg 2.表设计: 建立概念数据模型(Conceptual Da ...
- mysql数据库中常用操作汇总
一.查询数据库的基本信息: 1. /* 查询数据库 ‘boss’ 所有表及注释 */SELECT TABLE_NAME,TABLE_COMMENT FROM information_schema ...
- SQL2008数据库优化常用脚本
--查询某个数据库的连接数 select count(*) from Master.dbo.SysProcesses where dbid=db_id() --前10名其他等待类型 SELECT TO ...
- Powerdesigner设计表生成SQL脚本(带有注释)
网上搜索查阅地址:https://www.2cto.com/database/201704/628659.html 步骤: Powerdesigner中选择Tools---->Excute co ...
- 使用PowerDesigner设计数据库
1.快捷键CTRL+N 创建 New Model 选择如下图,并设置 Model name 单击OK 2.使用工具添加实体 双击Entity_1,填上如下图信息 切换选项卡,添加属性信息 其中 M ...
- MySQL数据库中常用的引擎有几种?有什么区别?
1.常用的3种 2.InnoDB Myisam Memory 3.InnoDB跟Myisam的默认索引是B+tree,Memory的默认索引是hash 区别: 1.InnoDB支持事务,支持外键,支 ...
随机推荐
- Codeforces #620 div2 B
题目: Returning back to problem solving, Gildong is now studying about palindromes. He learned that a ...
- 新疆大学ACM新生赛(公开赛) E.异或 (思维,位运算)
题意:RT 题解: \(i\ mod \ k=0\),即所有事\(k\)的倍数的位置都要进行异或,根据异或的性质,我们知道如果相同的异或的数个数是偶数的话,得出的结果是\(0\),所以每次询问,我们判 ...
- Linux系统编程【2】——编写who命令
学到的知识点 通过实现who命令,学到了: 1.使用man命令寻找相关信息 2.基于文件编程 3.体会到c库函数与系统调用的不同 4.加深对缓冲技术的理解 who命令的作用 who命令的使用 在控制终 ...
- Pdf和Office相关归集
Spire 支持Pdf.Office等的诸多操作,使用方便,需收费,免费版本仅支持10页以内的操作,在 这里 可以下载库. 优点 测试过打印效果佳,操作简便. 缺点 PDF打印慢,免费版本仅支持10页 ...
- 使用networkx库可视化对称矩阵的网络图形
首先我的数据是.mat格式,讲讲如何用python读取.mat格式的数据(全套来) 我是python3版本 第一种读取方法: import h5py features_struct = h5py.Fi ...
- 流媒体传输协议之 RTP(下篇)
本系列文章将整理各个流媒体传输协议,包括 RTP/RTCP,RTMP,希望通过深入梳理协议的设计细节,能够给流媒体领域的开发者带来一定的启发. 作者:逸殊 审核:泰一 接上篇:< 流媒体传输协议 ...
- Explain 索引优化分析
Explain 语法 # 语法 explain + DQL语句 mysql> explain select * from city where countrycode ='CHN' or cou ...
- 数据库之postgreSQL入门操作指南
一.增 二.删 三.改 四.查 五.SQL操作表 1.增加列 ALTER TABLE table_name ADD column_name datatype; 2.删除一列 ALTER TABLE t ...
- Windows下TeamViewer远程控制的安装与使用
Windows下远程控制的安装与使用 由于疫情,在家里写论文,资料数据都在学校,只能远程控制了,选的是TeamViewer. 分为控制机和被控制机,安装使用略有不同. 从该网址安装:https://w ...
- bzoj4695 最假女选手(势能线段树/吉司机线段树)题解
题意: 已知\(n\)个数字,进行以下操作: \(1.\)给一个区间\([L,R]\) 加上一个数\(x\) \(2.\)把一个区间\([L,R]\) 里小于\(x\) 的数变成\(x\) \(3.\ ...