提交 16f43776 authored 作者: Thomas Mueller's avatar Thomas Mueller

ParameterMetaData now also returns the right data type for most

        conditions, as in WHERE ID=?.
上级 20ea18c2
...@@ -136,10 +136,18 @@ public class Comparison extends Condition { ...@@ -136,10 +136,18 @@ public class Comparison extends Condition {
} else { } else {
right = right.optimize(session); right = right.optimize(session);
try { try {
if (left instanceof ExpressionColumn && right.isConstant()) { if (left instanceof ExpressionColumn) {
if (right.isConstant()) {
right = getCast(right, left.getType(), left.getPrecision(), left.getScale(), left.getDisplaySize(), session); right = getCast(right, left.getType(), left.getPrecision(), left.getScale(), left.getDisplaySize(), session);
} else if (right instanceof ExpressionColumn && left.isConstant()) { } else if (right instanceof Parameter) {
((Parameter) right).setColumn(((ExpressionColumn) left).getColumn());
}
} else if (right instanceof ExpressionColumn) {
if (left.isConstant()) {
left = getCast(left, right.getType(), right.getPrecision(), right.getScale(), right.getDisplaySize(), session); left = getCast(left, right.getType(), right.getPrecision(), right.getScale(), right.getDisplaySize(), session);
} else if (left instanceof Parameter) {
((Parameter) left).setColumn(((ExpressionColumn) right).getColumn());
}
} }
} catch (SQLException e) { } catch (SQLException e) {
int code = e.getErrorCode(); int code = e.getErrorCode();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论