Package io.codemodder.codemods
Class SQLParameterizer
java.lang.Object
io.codemodder.codemods.SQLParameterizer
Contains most of the logic for detecting and fixing parameterizable SQL statements for a given
MethodCallExpr.-
Constructor Summary
ConstructorsConstructorDescriptionSQLParameterizer(com.github.javaparser.ast.expr.MethodCallExpr methodCallExpr) -
Method Summary
Modifier and TypeMethodDescriptionOptional<com.github.javaparser.ast.expr.MethodCallExpr>Checks ifmethodCallis a query call that needs to be fixed and fixes if that's the case.Returns a set of fixable JDBC method names.static booleanisSupportedJdbcMethodCall(com.github.javaparser.ast.expr.MethodCallExpr methodCall) Returns true if this is a fixable JDBC method name.static com.github.javaparser.ast.expr.ExpressionresolveExpression(com.github.javaparser.ast.expr.Expression expr) Tries to find the source of an expression if it can be uniquely defined, otherwise, returns self.
-
Constructor Details
-
SQLParameterizer
public SQLParameterizer(com.github.javaparser.ast.expr.MethodCallExpr methodCallExpr)
-
-
Method Details
-
isSupportedJdbcMethodCall
public static boolean isSupportedJdbcMethodCall(com.github.javaparser.ast.expr.MethodCallExpr methodCall) Returns true if this is a fixable JDBC method name. -
fixableJdbcMethodNames
Returns a set of fixable JDBC method names. -
resolveExpression
public static com.github.javaparser.ast.expr.Expression resolveExpression(com.github.javaparser.ast.expr.Expression expr) Tries to find the source of an expression if it can be uniquely defined, otherwise, returns self. -
checkAndFix
Checks ifmethodCallis a query call that needs to be fixed and fixes if that's the case. If the parameterization happened, returns the PreparedStatement creation.
-