40 lines
1.1 KiB
Plaintext
40 lines
1.1 KiB
Plaintext
``++PreparedStatement++``s and ``++CallableStatement++``s (for stored procedures) are safer and more efficient than ``++Statement++``s and should always be preferred.
|
|
|
|
|
|
This rule raises an issue each time a ``++Statement++`` is declared.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
Statement stmt = null; // Noncompliant
|
|
// ...
|
|
----
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
PreparedStatement stmt = null;
|
|
// ...
|
|
----
|
|
|
|
|
|
== See
|
|
|
|
* http://cwe.mitre.org/data/definitions/89[MITRE, CWE-89] - Improper Neutralization of Special Elements used in an SQL Command
|
|
* http://cwe.mitre.org/data/definitions/564.html[MITRE, CWE-564] - SQL Injection: Hibernate
|
|
* http://cwe.mitre.org/data/definitions/20.html[MITRE, CWE-20] - Improper Input Validation
|
|
* http://cwe.mitre.org/data/definitions/943.html[MITRE, CWE-943] - Improper Neutralization of Special Elements in Data Query Logic
|
|
* https://www.owasp.org/index.php/Top_10_2013-A1-Injection[OWASP Top Ten 2013 Category A1] - Injection
|
|
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|