Defensive Database Programming with SQL Server

简介:
弹性t-sql代码是设计为持久的代码,并且可以被其他人安全地重用。防御性数据库编程和本书的目标是帮助您生成具有弹性的t-sql代码,这些代码可以稳健而优雅地处理意外使用的情况,并且可以对数据库环境的常见更改具有弹性。
作为开发人员,我们通常会在代码通过一些基本测试后立即停止工作,以确认它在给定的用例中产生了 “正确的结果”。我们不会停下来考虑将来可能使用代码的其他可能方式,或者我们的代码将如何响应数据库环境的常见更改,例如数据库语言设置的更改或表列的可为空值性的更改等。
在短期内,这种方法很有吸引力; 我们可以更快地完成工作。但是,如果我们的代码被设计为使用超过几个月,那么很可能会发生这样的变化,并且不可避免的结果是损坏的代码,或者更糟糕的是,代码默默地开始表现不同,或者产生不同的结果。发生这种情况时,我们数据的完整性受到威胁,关键业务决策通常所依据的报告的有效性也受到威胁。此时,几个月或几年后,以及在原始开发人员离开很久之后,开始了艰苦的故障排除和解决问题的过程。
英文简介:
Resilient T-SQL code is code that is designed to last, and to be safely reused by others. The goal of defensive database programming, and of this book, is to help you to produce resilient T-SQL code that robustly and gracefully handles cases of unintended use, and is resilient to common changes to the database environment.
Too often, as developers, we stop work as soon as our code passes a few basic tests to confirm that it produces the "right result" in a given use case. We do not stop to consider the other possible ways in which the code might be used in the future, or how our code will respond to common changes to the database environment, such as a change in the database language setting, or a change to the nullability of a table column, and so on.
In the short-term, this approach is attractive; we get things done faster. However, if our code is designed to be used for more than just a few months, then it is very likely that such changes can and will occur, and the inevitable result is broken code or, even worse, code that silently starts to behave differently, or produce different results. When this happens, the integrity of our data is threatened, as is the validity of the reports on which critical business decisions are often based. At this point, months or years later, and long after the original developer has left, begins the painstaking process of troubleshooting and fixing the problem.
- 书名
- Defensive Database Programming with SQL Server
- 译名
- 使用 SQL Server 进行防御性数据库编程
- 语言
- 英语
- 年份
- 2010
- 页数
- 373页
- 大小
- 21.24 MB
- 标签
- 数据库
- SQL
- 下载
Defensive Database Programming with SQL Server.pdf
- 密码
- 65536
最后更新:2025-04-12 23:58:08