未验证 提交 fbee4776 编写于 作者: J Juan Pan(Trista) 提交者: GitHub

support parsing multiple parameter-marker from one expr (#4312)

* support parsing multiple parameter-marker from one expr

* delete annotation
上级 5b044489
......@@ -19,8 +19,7 @@
<sql-cases>
<sql-case id="update_without_alias" value="UPDATE t_order SET status = ? WHERE order_id = ? AND user_id = ?" />
<sql-case id="update_with_alias" value="UPDATE t_order AS o SET o.status = ? WHERE o.order_id = ? AND o.user_id = ?" db-types="MySQL,H2" />
<!-- FIXME cannot parse multiple parameter-marker from one expr -->
<!--<sql-case id="update_equal_with_geography" value="UPDATE t_order SET start_time = ?, status = 0, start_point = ST_GeographyFromText('SRID=4326;POINT('||?||' '||?||')'), rule = ?::jsonb, discount_type = ?, order_type = ? WHERE user_id = ? AND order_id = ?" db-types="PostgreSQL" />-->
<sql-case id="update_equal_with_geography" value="UPDATE t_order SET start_time = ?, status = 0, start_point = ST_GeographyFromText('SRID=4326;POINT('||?||' '||?||')'), rule = ?::jsonb, discount_type = ?, order_type = ? WHERE user_id = ? AND order_id = ?" db-types="PostgreSQL" />
<sql-case id="update_without_condition" value="UPDATE t_order o SET o.status = 'finished'" db-types="MySQL,H2" />
<sql-case id="update_with_extra_keywords" value="UPDATE LOW_PRIORITY IGNORE t_order SET status = ? WHERE order_id = ? AND user_id = ?" db-types="MySQL" />
<sql-case id="update_with_special_character" value="UPDATE `t_order` SET `status` = ? WHERE `order_id` = ? AND user_id = ?" db-types="MySQL" />
......
......@@ -41,12 +41,9 @@
<sql-case id="select_keyword_table_name_with_square_brackets" value="SELECT i.* FROM t_order o JOIN t_order_item i ON o.user_id = i.user_id AND o.order_id = i.order_id JOIN [select] c ON o.status = c.status WHERE o.user_id IN (?, ?) AND o.order_id BETWEEN ? AND ? AND c.status = ? ORDER BY i.item_id" db-types="SQLServer" />
<sql-case id="select_alias_as_keyword" value="SELECT length.item_id password FROM t_order_item length where length.item_id = ? " db-types="MySQL,H2,SQLServer,Oracle" />
<sql-case id="select_with_force_index_join" value="SELECT i.* FROM t_order o FORCE INDEX(order_index) JOIN t_order_item i ON o.order_id=i.order_id WHERE o.order_id = ?" db-types="MySQL" />
<!-- FIXME cannot parse multiple parameter-marker from one expr -->
<!--
<sql-case id="select_equal_with_geography" value="SELECT * FROM t_order WHERE rule = ?::jsonb AND start_point=ST_GeographyFromText('SRID=4326;POINT('||?||' '||?||')') AND user_id = ? AND order_id = ?" db-types="PostgreSQL" />
<sql-case id="select_in_with_geography" value="SELECT * FROM t_order WHERE rule IN (?::jsonb, ?::jsonb) AND start_point=ST_GeographyFromText('SRID=4326;POINT('||?||' '||?||')') AND user_id = ? AND order_id = ?" db-types="PostgreSQL" />
<sql-case id="select_between_with_geography" value="SELECT * FROM t_order WHERE rule BETWEEN ?::jsonb AND ?::jsonb AND start_point=ST_GeographyFromText('SRID=4326;POINT('||?||' '||?||')') AND order_id = ?" db-types="PostgreSQL" />
-->
<sql-case id="select_with_schema" value="SELECT * FROM db1.t_order" />
<sql-case id="select_special_function_nested" value="SELECT sum(if(status=0, 1, 0)) func_status FROM t_order WHERE user_id = ? AND order_id = ?" db-types="MySQL" />
<sql-case id="select_with_row_subquery_without_row_keyword" value="SELECT * FROM t_order WHERE (user_id,order_id) = (SELECT user_id,order_id FROM t_order_item WHERE id = 10)" db-types="MySQL" />
......
......@@ -27,6 +27,7 @@ import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.BitExpr
import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.BitValueLiteralsContext;
import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.BooleanLiteralsContext;
import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.BooleanPrimaryContext;
import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.CaseExpression_Context;
import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.CastFunctionContext;
import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.CharFunctionContext;
import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ColumnNameContext;
......@@ -382,7 +383,7 @@ public abstract class MySQLVisitor extends MySQLStatementBaseVisitor<ASTNode> {
if (null != ctx.columnName()) {
return visit(ctx.columnName());
}
return new CommonExpressionSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ctx.getText());
return visitRemainSimpleExpr(ctx);
}
@Override
......@@ -521,6 +522,24 @@ public abstract class MySQLVisitor extends MySQLStatementBaseVisitor<ASTNode> {
return new ExpressionProjectionSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ctx.getText());
}
private ASTNode visitRemainSimpleExpr(final SimpleExprContext ctx) {
if (null != ctx.caseExpression_()) {
return visit(ctx.caseExpression_());
}
for (ExprContext each : ctx.expr()) {
visit(each);
}
for (SimpleExprContext each : ctx.simpleExpr()) {
visit(each);
}
return new CommonExpressionSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ctx.getText());
}
@Override
public ASTNode visitCaseExpression_(final CaseExpression_Context ctx) {
return visit(ctx.simpleExpr());
}
@Override
public final ASTNode visitDataTypeName(final DataTypeNameContext ctx) {
return visit(ctx.identifier(0));
......
......@@ -27,6 +27,7 @@ import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.Bi
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.BitValueLiteralsContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.BooleanLiteralsContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.BooleanPrimaryContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.CaseExpression_Context;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.CastFunctionContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.CharFunctionContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.ColumnNameContext;
......@@ -362,7 +363,7 @@ public abstract class PostgreSQLVisitor extends PostgreSQLStatementBaseVisitor<A
if (null != ctx.columnName()) {
return visit(ctx.columnName());
}
return new CommonExpressionSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ctx.getText());
return visitRemainSimpleExpr(ctx);
}
@Override
......@@ -438,6 +439,24 @@ public abstract class PostgreSQLVisitor extends PostgreSQLStatementBaseVisitor<A
return new ExpressionProjectionSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ctx.getText());
}
private ASTNode visitRemainSimpleExpr(final SimpleExprContext ctx) {
if (null != ctx.caseExpression_()) {
return visit(ctx.caseExpression_());
}
for (ExprContext each : ctx.expr()) {
visit(each);
}
for (SimpleExprContext each : ctx.simpleExpr()) {
visit(each);
}
return new CommonExpressionSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ctx.getText());
}
@Override
public ASTNode visitCaseExpression_(final CaseExpression_Context ctx) {
return visit(ctx.simpleExpr());
}
@Override
public final ASTNode visitDataTypeName(final DataTypeNameContext ctx) {
return visit(ctx.identifier(0));
......
......@@ -763,122 +763,119 @@
</where>
</select>
<!-- FIXME cannot parse multiple parameter-marker from one expr -->
<!--<select sql-case-id="select_equal_with_geography" parameters="'{&quot;rule2&quot;:&quot;null2&quot;}', 100, 200, 1, 2">-->
<!--<table name="t_order" start-index="14" stop-index="20" />-->
<!--<projections start-index="7" stop-index="7">-->
<!--<shorthand-projection start-index="7" stop-index="7" />-->
<!--</projections>-->
<!--<where start-index="22" stop-index="148" literal-stop-index="170">-->
<!--<and-predicate>-->
<!--<predicate start-index="28" stop-index="42" literal-stop-index="60">-->
<!--<column-left-value name="rule" start-index="28" stop-index="31" />-->
<!--<operator type="=" />-->
<!--<compare-right-value>-->
<!--<parameter-marker-expression value="0" />-->
<!--<literal-expression value="{&quot;rule2&quot;:&quot;null2&quot;}'::json" />-->
<!--</compare-right-value>-->
<!--</predicate>-->
<!--<predicate start-index="48" stop-index="115" literal-start-index="66" literal-stop-index="137">-->
<!--<column-left-value name="start_point" start-index="48" stop-index="58" literal-start-index="66" literal-stop-index="76" />-->
<!--<operator type="=" />-->
<!--&lt;!&ndash; TODO assert expression &ndash;&gt;-->
<!--</predicate>-->
<!--<predicate start-index="121" stop-index="131" literal-start-index="143" literal-stop-index="153">-->
<!--<column-left-value name="user_id" start-index="121" stop-index="127" literal-start-index="143" literal-stop-index="149" />-->
<!--<operator type="=" />-->
<!--<compare-right-value>-->
<!--<parameter-marker-expression value="3" />-->
<!--<literal-expression value="1" />-->
<!--</compare-right-value>-->
<!--</predicate>-->
<!--<predicate start-index="137" stop-index="148" literal-start-index="159" literal-stop-index="170">-->
<!--<column-left-value name="order_id" start-index="137" stop-index="144" literal-start-index="159" literal-stop-index="166" />-->
<!--<operator type="=" />-->
<!--<compare-right-value>-->
<!--<parameter-marker-expression value="4" />-->
<!--<literal-expression value="2" />-->
<!--</compare-right-value>-->
<!--</predicate>-->
<!--</and-predicate>-->
<!--</where>-->
<!--</select>-->
<select sql-case-id="select_equal_with_geography" parameters="'{&quot;rule2&quot;:&quot;null2&quot;}', 100, 200, 1, 2">
<table name="t_order" start-index="14" stop-index="20" />
<projections start-index="7" stop-index="7">
<shorthand-projection start-index="7" stop-index="7" />
</projections>
<where start-index="22" stop-index="148" literal-stop-index="170">
<and-predicate>
<predicate start-index="28" stop-index="42" literal-stop-index="60">
<column-left-value name="rule" start-index="28" stop-index="31" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="0" />
<literal-expression value="{&quot;rule2&quot;:&quot;null2&quot;}'::json" />
</compare-right-value>
</predicate>
<predicate start-index="48" stop-index="115" literal-start-index="66" literal-stop-index="137">
<column-left-value name="start_point" start-index="48" stop-index="58" literal-start-index="66" literal-stop-index="76" />
<operator type="=" />
<!-- TODO assert expression -->
</predicate>
<predicate start-index="121" stop-index="131" literal-start-index="143" literal-stop-index="153">
<column-left-value name="user_id" start-index="121" stop-index="127" literal-start-index="143" literal-stop-index="149" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="3" />
<literal-expression value="1" />
</compare-right-value>
</predicate>
<predicate start-index="137" stop-index="148" literal-start-index="159" literal-stop-index="170">
<column-left-value name="order_id" start-index="137" stop-index="144" literal-start-index="159" literal-stop-index="166" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="4" />
<literal-expression value="2" />
</compare-right-value>
</predicate>
</and-predicate>
</where>
</select>
<!-- FIXME cannot parse multiple parameter-marker from one expr -->
<!--<select sql-case-id="select_in_with_geography" parameters="'{&quot;rule2&quot;:&quot;null2&quot;}', '{&quot;rule3&quot;:&quot;null3&quot;}', 100, 200, 1, 2">-->
<!--<table name="t_order" start-index="14" stop-index="20" />-->
<!--<projections start-index="7" stop-index="7">-->
<!--<shorthand-projection start-index="7" stop-index="7" />-->
<!--</projections>-->
<!--<where start-index="22" stop-index="161" literal-stop-index="201">-->
<!--<and-predicate>-->
<!--<predicate start-index="28" stop-index="55" literal-stop-index="91">-->
<!--<column-left-value name="rule" start-index="28" stop-index="31" />-->
<!--<in-right-value>-->
<!--<parameter-marker-expression value="0" />-->
<!--<parameter-marker-expression value="1" />-->
<!--<literal-expression value="{&quot;rule2&quot;:&quot;null2&quot;}'::json" />-->
<!--<literal-expression value="{&quot;rule3&quot;:&quot;null3&quot;}'::json" />-->
<!--</in-right-value>-->
<!--</predicate>-->
<!--<predicate start-index="61" stop-index="128" literal-start-index="97" literal-stop-index="168">-->
<!--<column-left-value name="start_point" start-index="61" stop-index="71" literal-start-index="97" literal-stop-index="107" />-->
<!--<operator type="=" />-->
<!--&lt;!&ndash; TODO assert expr &ndash;&gt;-->
<!--</predicate>-->
<!--<predicate start-index="134" stop-index="144" literal-start-index="174" literal-stop-index="184">-->
<!--<column-left-value name="user_id" start-index="134" stop-index="140" literal-start-index="174" literal-stop-index="180" />-->
<!--<operator type="=" />-->
<!--<compare-right-value>-->
<!--<parameter-marker-expression value="4" />-->
<!--<literal-expression value="1" />-->
<!--</compare-right-value>-->
<!--</predicate>-->
<!--<predicate start-index="150" stop-index="161" literal-start-index="190" literal-stop-index="201">-->
<!--<column-left-value name="order_id" start-index="150" stop-index="157" literal-start-index="190" literal-stop-index="197" />-->
<!--<operator type="=" />-->
<!--<compare-right-value>-->
<!--<parameter-marker-expression value="5" />-->
<!--<literal-expression value="2" />-->
<!--</compare-right-value>-->
<!--</predicate>-->
<!--</and-predicate>-->
<!--</where>-->
<!--</select>-->
<select sql-case-id="select_in_with_geography" parameters="'{&quot;rule2&quot;:&quot;null2&quot;}', '{&quot;rule3&quot;:&quot;null3&quot;}', 100, 200, 1, 2">
<table name="t_order" start-index="14" stop-index="20" />
<projections start-index="7" stop-index="7">
<shorthand-projection start-index="7" stop-index="7" />
</projections>
<where start-index="22" stop-index="161" literal-stop-index="201">
<and-predicate>
<predicate start-index="28" stop-index="55" literal-stop-index="91">
<column-left-value name="rule" start-index="28" stop-index="31" />
<in-right-value>
<parameter-marker-expression value="0" />
<parameter-marker-expression value="1" />
<literal-expression value="{&quot;rule2&quot;:&quot;null2&quot;}'::json" />
<literal-expression value="{&quot;rule3&quot;:&quot;null3&quot;}'::json" />
</in-right-value>
</predicate>
<predicate start-index="61" stop-index="128" literal-start-index="97" literal-stop-index="168">
<column-left-value name="start_point" start-index="61" stop-index="71" literal-start-index="97" literal-stop-index="107" />
<operator type="=" />
<!-- TODO assert expr -->
</predicate>
<predicate start-index="134" stop-index="144" literal-start-index="174" literal-stop-index="184">
<column-left-value name="user_id" start-index="134" stop-index="140" literal-start-index="174" literal-stop-index="180" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="4" />
<literal-expression value="1" />
</compare-right-value>
</predicate>
<predicate start-index="150" stop-index="161" literal-start-index="190" literal-stop-index="201">
<column-left-value name="order_id" start-index="150" stop-index="157" literal-start-index="190" literal-stop-index="197" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="5" />
<literal-expression value="2" />
</compare-right-value>
</predicate>
</and-predicate>
</where>
</select>
<!-- FIXME cannot parse multiple parameter-marker from one expr -->
<!--<select sql-case-id="select_between_with_geography" parameters="'{&quot;rule2&quot;:&quot;null2&quot;}', '{&quot;rule3&quot;:&quot;null3&quot;}', 100, 200, 1">-->
<!--<table name="t_order" start-index="14" stop-index="20" />-->
<!--<projections start-index="7" stop-index="7">-->
<!--<shorthand-projection start-index="7" stop-index="7" />-->
<!--</projections>-->
<!--<where start-index="22" stop-index="151" literal-stop-index="191">-->
<!--<and-predicate>-->
<!--<predicate start-index="28" stop-index="61" literal-stop-index="97">-->
<!--<column-left-value name="rule" start-index="28" stop-index="31" />-->
<!--<between-right-value>-->
<!--<between-parameter-marker-expression value="0" />-->
<!--<between-literal-expression value="{&quot;rule2&quot;:&quot;null2&quot;}'::json" />-->
<!--<and-parameter-marker-expression value="1" />-->
<!--<and-literal-expression value="{&quot;rule3&quot;:&quot;null3&quot;}'::json" />-->
<!--</between-right-value>-->
<!--</predicate>-->
<!--<predicate start-index="67" stop-index="134" literal-start-index="103" literal-stop-index="174">-->
<!--<column-left-value name="start_point" start-index="67" stop-index="77" literal-start-index="103" literal-stop-index="113" />-->
<!--<operator type="=" />-->
<!--&lt;!&ndash; TODO assert right value &ndash;&gt;-->
<!--</predicate>-->
<!--<predicate start-index="140" stop-index="151" literal-start-index="180" literal-stop-index="191">-->
<!--<column-left-value name="order_id" start-index="140" stop-index="147" literal-start-index="180" literal-stop-index="187" />-->
<!--<operator type="=" />-->
<!--<compare-right-value>-->
<!--<parameter-marker-expression value="4" />-->
<!--<literal-expression value="1" />-->
<!--</compare-right-value>-->
<!--</predicate>-->
<!--</and-predicate>-->
<!--</where>-->
<!--</select>-->
<select sql-case-id="select_between_with_geography" parameters="'{&quot;rule2&quot;:&quot;null2&quot;}', '{&quot;rule3&quot;:&quot;null3&quot;}', 100, 200, 1">
<table name="t_order" start-index="14" stop-index="20" />
<projections start-index="7" stop-index="7">
<shorthand-projection start-index="7" stop-index="7" />
</projections>
<where start-index="22" stop-index="151" literal-stop-index="191">
<and-predicate>
<predicate start-index="28" stop-index="61" literal-stop-index="97">
<column-left-value name="rule" start-index="28" stop-index="31" />
<between-right-value>
<between-parameter-marker-expression value="0" />
<between-literal-expression value="{&quot;rule2&quot;:&quot;null2&quot;}'::json" />
<and-parameter-marker-expression value="1" />
<and-literal-expression value="{&quot;rule3&quot;:&quot;null3&quot;}'::json" />
</between-right-value>
</predicate>
<predicate start-index="67" stop-index="134" literal-start-index="103" literal-stop-index="174">
<column-left-value name="start_point" start-index="67" stop-index="77" literal-start-index="103" literal-stop-index="113" />
<operator type="=" />
<!-- TODO assert right value -->
</predicate>
<predicate start-index="140" stop-index="151" literal-start-index="180" literal-stop-index="191">
<column-left-value name="order_id" start-index="140" stop-index="147" literal-start-index="180" literal-stop-index="187" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="4" />
<literal-expression value="1" />
</compare-right-value>
</predicate>
</and-predicate>
</where>
</select>
<select sql-case-id="select_with_double_quotes" parameters="1">
<table name="t_order_item" start-delimiter="&quot;" end-delimiter="&quot;" start-index="14" stop-index="27" />
......
......@@ -89,72 +89,71 @@
</where>
</update>
<!-- FIXME cannot parse multiple parameter-marker from one expr -->
<!--<update sql-case-id="update_equal_with_geography" parameters="'2017-06-07', 100, 200, '{&quot;rule2&quot;:&quot;null2&quot;}', 3, 5, 7, 200">-->
<!--<table name="t_order" start-index="7" stop-index="13" />-->
<!--<set start-index="15" stop-index="168" literal-stop-index="201">-->
<!--<assignment start-index="19" stop-index="32" literal-stop-index="43">-->
<!--<column name="start_time" start-index="19" stop-index="28" />-->
<!--<assignment-value>-->
<!--<parameter-marker-expression value="0" />-->
<!--<literal-expression value="2017-06-07" />-->
<!--</assignment-value>-->
<!--</assignment>-->
<!--<assignment start-index="35" stop-index="44" literal-start-index="46" literal-stop-index="55">-->
<!--<column name="status" start-index="35" stop-index="40" literal-start-index="46" literal-stop-index="51" />-->
<!--<assignment-value>-->
<!--<literal-expression value="0" />-->
<!--</assignment-value>-->
<!--</assignment>-->
<!--<assignment start-index="47" stop-index="116" literal-start-index="58" literal-stop-index="131">-->
<!--<column name="start_point" start-index="47" stop-index="57" literal-start-index="58" literal-stop-index="68" />-->
<!--<assignment-value>-->
<!--<common-expression text="ST_GeographyFromText('SRID=4326;POINT('||?||' '||?||')')" literal-text="ST_GeographyFromText('SRID=4326;POINT('||100||' '||200||')')" />-->
<!--</assignment-value>-->
<!--</assignment>-->
<!--<assignment start-index="119" stop-index="133" literal-start-index="134" literal-stop-index="166">-->
<!--<column name="rule" start-index="119" stop-index="122" literal-start-index="134" literal-stop-index="137" />-->
<!--<assignment-value>-->
<!--<parameter-marker-expression value="3" />-->
<!--<literal-expression value="{&quot;rule2&quot;:&quot;null2&quot;}'::json" />-->
<!--</assignment-value>-->
<!--</assignment>-->
<!--<assignment start-index="136" stop-index="152" literal-start-index="169" literal-stop-index="185">-->
<!--<column name="discount_type" start-index="136" stop-index="148" literal-start-index="169" literal-stop-index="181" />-->
<!--<assignment-value>-->
<!--<parameter-marker-expression value="4" />-->
<!--<literal-expression value="3" />-->
<!--</assignment-value>-->
<!--</assignment>-->
<!--<assignment start-index="155" stop-index="168" literal-start-index="188" literal-stop-index="201">-->
<!--<column name="order_type" start-index="155" stop-index="164" literal-start-index="188" literal-stop-index="197" />-->
<!--<assignment-value>-->
<!--<parameter-marker-expression value="5" />-->
<!--<literal-expression value="5" />-->
<!--</assignment-value>-->
<!--</assignment>-->
<!--</set>-->
<!--<where start-index="170" stop-index="203" literal-start-index="203" literal-stop-index="238">-->
<!--<and-predicate>-->
<!--<predicate start-index="176" stop-index="186" literal-start-index="209" literal-stop-index="219">-->
<!--<column-left-value name="user_id" start-index="176" stop-index="182" literal-start-index="209" literal-stop-index="215" />-->
<!--<operator type="=" />-->
<!--<compare-right-value>-->
<!--<parameter-marker-expression value="6" />-->
<!--<literal-expression value="7" />-->
<!--</compare-right-value>-->
<!--</predicate>-->
<!--<predicate start-index="192" stop-index="203" literal-start-index="225" literal-stop-index="238">-->
<!--<column-left-value name="order_id" start-index="192" stop-index="199" literal-start-index="225" literal-stop-index="232" />-->
<!--<operator type="=" />-->
<!--<compare-right-value>-->
<!--<parameter-marker-expression value="7" />-->
<!--<literal-expression value="200" />-->
<!--</compare-right-value>-->
<!--</predicate>-->
<!--</and-predicate>-->
<!--</where>-->
<!--</update>-->
<update sql-case-id="update_equal_with_geography" parameters="'2017-06-07', 100, 200, '{&quot;rule2&quot;:&quot;null2&quot;}', 3, 5, 7, 200">
<table name="t_order" start-index="7" stop-index="13" />
<set start-index="15" stop-index="168" literal-stop-index="201">
<assignment start-index="19" stop-index="32" literal-stop-index="43">
<column name="start_time" start-index="19" stop-index="28" />
<assignment-value>
<parameter-marker-expression value="0" />
<literal-expression value="2017-06-07" />
</assignment-value>
</assignment>
<assignment start-index="35" stop-index="44" literal-start-index="46" literal-stop-index="55">
<column name="status" start-index="35" stop-index="40" literal-start-index="46" literal-stop-index="51" />
<assignment-value>
<literal-expression value="0" />
</assignment-value>
</assignment>
<assignment start-index="47" stop-index="116" literal-start-index="58" literal-stop-index="131">
<column name="start_point" start-index="47" stop-index="57" literal-start-index="58" literal-stop-index="68" />
<assignment-value>
<common-expression text="ST_GeographyFromText('SRID=4326;POINT('||?||' '||?||')')" literal-text="ST_GeographyFromText('SRID=4326;POINT('||100||' '||200||')')" />
</assignment-value>
</assignment>
<assignment start-index="119" stop-index="133" literal-start-index="134" literal-stop-index="166">
<column name="rule" start-index="119" stop-index="122" literal-start-index="134" literal-stop-index="137" />
<assignment-value>
<parameter-marker-expression value="3" />
<literal-expression value="{&quot;rule2&quot;:&quot;null2&quot;}'::json" />
</assignment-value>
</assignment>
<assignment start-index="136" stop-index="152" literal-start-index="169" literal-stop-index="185">
<column name="discount_type" start-index="136" stop-index="148" literal-start-index="169" literal-stop-index="181" />
<assignment-value>
<parameter-marker-expression value="4" />
<literal-expression value="3" />
</assignment-value>
</assignment>
<assignment start-index="155" stop-index="168" literal-start-index="188" literal-stop-index="201">
<column name="order_type" start-index="155" stop-index="164" literal-start-index="188" literal-stop-index="197" />
<assignment-value>
<parameter-marker-expression value="5" />
<literal-expression value="5" />
</assignment-value>
</assignment>
</set>
<where start-index="170" stop-index="203" literal-start-index="203" literal-stop-index="238">
<and-predicate>
<predicate start-index="176" stop-index="186" literal-start-index="209" literal-stop-index="219">
<column-left-value name="user_id" start-index="176" stop-index="182" literal-start-index="209" literal-stop-index="215" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="6" />
<literal-expression value="7" />
</compare-right-value>
</predicate>
<predicate start-index="192" stop-index="203" literal-start-index="225" literal-stop-index="238">
<column-left-value name="order_id" start-index="192" stop-index="199" literal-start-index="225" literal-stop-index="232" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="7" />
<literal-expression value="200" />
</compare-right-value>
</predicate>
</and-predicate>
</where>
</update>
<update sql-case-id="update_without_condition">
<table name="t_order" alias="o" start-index="7" stop-index="13" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册