如何在ER图中表示触发器和存储过程?

时间:2020-12-20 13:48:27

Is it a good idea to show triggers and stored procedures in an Entity Relationship Diagram? If yes, what is the notation? Information seems really scarce on this topic. Also, are there any UML diagrams you would use to represent triggers?

在实体关系图中显示触发器和存储过程是一个好主意吗?如果是,那么符号是什么?关于这一主题,信息似乎非常缺乏。此外,是否有任何UML图表用于表示触发器?

3 个解决方案

#1


3  

Since Triggers are based on actions in sequence, I haved used a UML sequence diagram rather than an ERD. The swimlanes would be the base tables and the messages would be the triggers firing. For stored procedures, the same approach could be taken if the stored procedures were centered around a certain table. If not, a collaboration diagram could be used.

由于触发器是基于顺序的动作,我使用了UML序列图而不是ERD。泳道将是基表,消息将是触发器触发。对于存储过程,如果存储过程以某个表为中心,则可以采用相同的方法。如果不是,则可以使用协作图。

#2


3  

As Steve said, you may represent the dynamic of a trigger or stored proc in a dynamic diagram. But for triggers specifically, if you just want to declare them, you can also add them as operations in classes used to represent the corresponding tables in your Entity Relationship Diagram. In this case, you might want to use relevant stereotypes on these operations, such as <<trigger>>.

正如Steve所说,您可以在动态图表中表示触发器或存储过程的动态。但是对于触发器,如果​​您只是想声明它们,您还可以将它们添加为用于表示实体关系图中相应表的类中的操作。在这种情况下,您可能希望在这些操作上使用相关的构造型,例如<< trigger >>。

#3


2  

ER diagrams have never been intended for that purpose and are therefore not very well suited.

ER图从未用于此目的,因此不太适合。

The UML event sequences (swimlanes) as suggested elsewhere, might be a tad better, but imo it's still problematic. The arrows cannot distinguish between an insert and a delete, hence you'd have to have several distinct charts for each table (one for what happens upon insert and one for what happens upon delete, and then there's still the gray area of update). I'm also not very sure whether the swimlanes charts allow to document very well what precisely happens to the other (targeted) tables. Insert or delete ? Of which row(s) exactly ? etc. etc.

其他地方建议的UML事件序列(泳道)可能有点好,但是它仍然存在问题。箭头无法区分插入和删除,因此每个表必须有几个不同的图表(一个用于插入时发生的情况,一个用于删除时发生的情况,然后仍然存在更新的灰色区域)。我也不太确定泳道图表是否能够很好地记录其他(目标)表格究竟发生了什么。插入还是删除?哪一行完全正确?等等

#1


3  

Since Triggers are based on actions in sequence, I haved used a UML sequence diagram rather than an ERD. The swimlanes would be the base tables and the messages would be the triggers firing. For stored procedures, the same approach could be taken if the stored procedures were centered around a certain table. If not, a collaboration diagram could be used.

由于触发器是基于顺序的动作,我使用了UML序列图而不是ERD。泳道将是基表,消息将是触发器触发。对于存储过程,如果存储过程以某个表为中心,则可以采用相同的方法。如果不是,则可以使用协作图。

#2


3  

As Steve said, you may represent the dynamic of a trigger or stored proc in a dynamic diagram. But for triggers specifically, if you just want to declare them, you can also add them as operations in classes used to represent the corresponding tables in your Entity Relationship Diagram. In this case, you might want to use relevant stereotypes on these operations, such as <<trigger>>.

正如Steve所说,您可以在动态图表中表示触发器或存储过程的动态。但是对于触发器,如果​​您只是想声明它们,您还可以将它们添加为用于表示实体关系图中相应表的类中的操作。在这种情况下,您可能希望在这些操作上使用相关的构造型,例如<< trigger >>。

#3


2  

ER diagrams have never been intended for that purpose and are therefore not very well suited.

ER图从未用于此目的,因此不太适合。

The UML event sequences (swimlanes) as suggested elsewhere, might be a tad better, but imo it's still problematic. The arrows cannot distinguish between an insert and a delete, hence you'd have to have several distinct charts for each table (one for what happens upon insert and one for what happens upon delete, and then there's still the gray area of update). I'm also not very sure whether the swimlanes charts allow to document very well what precisely happens to the other (targeted) tables. Insert or delete ? Of which row(s) exactly ? etc. etc.

其他地方建议的UML事件序列(泳道)可能有点好,但是它仍然存在问题。箭头无法区分插入和删除,因此每个表必须有几个不同的图表(一个用于插入时发生的情况,一个用于删除时发生的情况,然后仍然存在更新的灰色区域)。我也不太确定泳道图表是否能够很好地记录其他(目标)表格究竟发生了什么。插入还是删除?哪一行完全正确?等等