|
|
| Line 342: |
Line 342: |
| 请注意,外部模块可以将它们(DELETE CASCADE 和 UPDATE CASCADE)用于Dolibarr表及其模块表之间的链接,但最好的推荐解决方案是在删除父表的记录时使用 Dolibarr PHP 触发器来实现其子表记录的删除。 | | 请注意,外部模块可以将它们(DELETE CASCADE 和 UPDATE CASCADE)用于Dolibarr表及其模块表之间的链接,但最好的推荐解决方案是在删除父表的记录时使用 Dolibarr PHP 触发器来实现其子表记录的删除。 |
|
| |
|
| ==Using Database triggers== | | ==使用数据库触发器== |
| Using Database triggers is not allowed into the code of Dolibarr, so you should have no troubles with Database triggers.
| | Dolibarr的代码中不允许使用数据库触发器,因此您应该不会遇到数据库触发器的问题。 |
| Database triggers are not portable. Compatibility may be broken when upgrading your version of your database, database triggers are often not included into backup tools, database triggers need permissions that you may not have (and should not have) on a common secured database, database triggers means also that you include some "business rules" of your application into the database where most other rules are managed by the code itself (this can create conflict or code that can't be debugged with a step by step debugger), database triggers execute code using the timezone of the database instead of the reference timezone of application that may be different (generating offset into database) ...
| | |
| There is tons of reason why we do not recommend to use database triggers in your own development.
| | 数据库触发器不可移植。在升级数据库版本时,兼容性可能会被破坏,数据库触发器通常不包含在备份工具中,数据库触发器需要您可能没有(也不应该有)的操作公共安全的数据库权限,数据库触发器还意味着将应用程序的一些“业务规则”放置在了数据库中,其中大多数其他规则由代码本身管理(这可能会产生冲突或无法使用步进调试程序调试代码),数据库触发器使用数据库的时区执行代码,而不是使用可能不同的应用程序的参考时区(生成数据库偏移量)... |
| Using Database triggers can save you time when you make development but is a very bad practice, so is forbidden as it is not compatible with the high level of quality of code expected by Dolibarr team. External modules that uses Database triggers may also be refused on the market place since it won't work for more than 50% of users.
| | |
| | 我们有很多理由不建议在您自己的开发中使用数据库触发器。 |
| | |
| | 使用数据库触发器可以在进行开发时节省您的时间,但这是一种非常糟糕的做法,因此被禁止,因为它与Dolibarr团队所期望的高质量代码不兼容。使用数据库触发器的外部模块在市场上也可能被拒绝,因为它不能为超过50%的用户正常工作。 |
|
| |
|
| ==Mysql 特点== | | ==Mysql 特点== |