Chinaunix

标题: PreparedStatement [打印本页]

作者: bellszhu    时间: 2013-01-17 23:55
标题: PreparedStatement
The advantages of Prepared Statements are:

1. As the execution plan get cached, performance will be better.
2. It is a good way to code against SQL Injection as escapes the input values.
3. When it comes to a Statement with no unbound variables, the database is free to optimize to its full extent. The individual query will be faster, but the down side is that you need to do the database compilation all the time, and this is worse than the benefit of the faster query.

Other than training purpose it is better to use PreparedStatement to get full benefits and close all loopholes.

帮忙翻译下 第三条 和最后一句??
作者: 方兆国    时间: 2013-01-18 09:51
回复 1# bellszhu


    准备的语句的优点是:

1。由于执行计划得到缓存,性能会更好。
2。这是一个很好的方式对SQL注入代码逃脱的输入值。
3。当它没有绑定变量的声明,该数据库是免费的优化以充分发挥其程度。单个查询要快,但不好的一面是,你需要做的数据库编译所有的时间,这比利益更糟糕的是更快的查询。

除了训练的目的是更好地使用PreparedStatement得到充分的好处,并关闭所有的漏洞。

http://translate.google.cn/#en/z ... %20all%20loopholes.




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2