mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improve parameterize sql
This commit is contained in:
@@ -175,6 +175,16 @@ public class ParameterizedOutputVisitorUtils {
|
||||
}
|
||||
|
||||
public static boolean visit(ParameterizedVisitor v, SQLNullExpr x) {
|
||||
SQLObject parent = x.getParent();
|
||||
if (parent instanceof SQLBinaryOpExpr) {
|
||||
SQLBinaryOpExpr binaryOpExpr = (SQLBinaryOpExpr) parent;
|
||||
if (binaryOpExpr.getOperator() == SQLBinaryOperator.IsNot
|
||||
|| binaryOpExpr.getOperator() == SQLBinaryOperator.Is) {
|
||||
v.print("NULL");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
v.print('?');
|
||||
v.incrementReplaceCunt();
|
||||
return false;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -47,7 +47,7 @@ public class OracleMergeTest7 extends OracleTest {
|
||||
OracleMergeStatement mergeStatement = (OracleMergeStatement) stmtList.get(0);
|
||||
String result = SQLUtils.toOracleString(mergeStatement);
|
||||
Assert.assertEquals("MERGE INTO copy_emp c" //
|
||||
+ "\nUSING employees e ON c.employee_id = e.employee_id" //
|
||||
+ "\nUSING employees e ON (c.employee_id = e.employee_id) " //
|
||||
+ "\nWHEN MATCHED THEN UPDATE SET c.first_name = e.first_name, c.last_name = e.last_name, c.department_id = e.department_id" //
|
||||
+ "\nWHEN NOT MATCHED THEN INSERT VALUES (e.employee_id, e.first_name, e.last_name, e.email, e.phone_number, e.hire_date, e.job_id, e.salary, e.commission_pct, e.manager_id, e.department_id)",
|
||||
result);
|
||||
|
||||
Reference in New Issue
Block a user