提交 a5b8aca5 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Partially revert d04b4cb7

上级 160306dc
...@@ -490,7 +490,7 @@ Instead, use a prepared statement with arrays as in the following example: ...@@ -490,7 +490,7 @@ Instead, use a prepared statement with arrays as in the following example:
</p> </p>
<pre> <pre>
PreparedStatement prep = conn.prepareStatement( PreparedStatement prep = conn.prepareStatement(
"SELECT * FROM TEST WHERE ID IN(UNNEST(?))"); "SELECT * FROM TEST WHERE ID = ANY(?)");
prep.setObject(1, new Object[] { "1", "2" }); prep.setObject(1, new Object[] { "1", "2" });
ResultSet rs = prep.executeQuery(); ResultSet rs = prep.executeQuery();
</pre> </pre>
......
...@@ -24,7 +24,7 @@ import org.h2.value.ValueBoolean; ...@@ -24,7 +24,7 @@ import org.h2.value.ValueBoolean;
import org.h2.value.ValueNull; import org.h2.value.ValueNull;
/** /**
* A condition with parameter as {@code IN(UNNEST(?))}. * A condition with parameter as {@code = ANY(?)}.
*/ */
public class ConditionInParameter extends Condition { public class ConditionInParameter extends Condition {
private static final class ParameterList extends AbstractList<Expression> { private static final class ParameterList extends AbstractList<Expression> {
...@@ -104,12 +104,12 @@ public class ConditionInParameter extends Condition { ...@@ -104,12 +104,12 @@ public class ConditionInParameter extends Condition {
} }
/** /**
* Create a new {@code IN(UNNEST(?))} condition. * Create a new {@code = ANY(?)} condition.
* *
* @param database * @param database
* the database * the database
* @param left * @param left
* the expression before {@code IN(UNNEST(?))} * the expression before {@code = ANY(?)}
* @param parameter * @param parameter
* parameter * parameter
*/ */
...@@ -162,8 +162,8 @@ public class ConditionInParameter extends Condition { ...@@ -162,8 +162,8 @@ public class ConditionInParameter extends Condition {
@Override @Override
public StringBuilder getSQL(StringBuilder builder) { public StringBuilder getSQL(StringBuilder builder) {
builder.append('('); builder.append('(');
left.getSQL(builder).append(" IN(UNNEST("); left.getSQL(builder).append(" = ANY(");
return parameter.getSQL(builder).append(")))"); return parameter.getSQL(builder).append("))");
} }
@Override @Override
......
...@@ -60,8 +60,8 @@ SELECT X, X IN(UNNEST(ARRAY[2, 4])) FROM SYSTEM_RANGE(1, 5); ...@@ -60,8 +60,8 @@ SELECT X, X IN(UNNEST(ARRAY[2, 4])) FROM SYSTEM_RANGE(1, 5);
SELECT X, X IN(UNNEST(?)) FROM SYSTEM_RANGE(1, 5); SELECT X, X IN(UNNEST(?)) FROM SYSTEM_RANGE(1, 5);
{ {
2 2
> X X IN(UNNEST(?1)) > X X = ANY(?1)
> - ---------------- > - -----------
> 1 FALSE > 1 FALSE
> 2 TRUE > 2 TRUE
> 3 FALSE > 3 FALSE
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论