This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new b8b51bf support function parse on pg/og (#13570)
b8b51bf is described below
commit b8b51bfb156f6b711c4e037bd1c15d3761979653
Author: tuichenchuxin <[email protected]>
AuthorDate: Fri Nov 12 17:37:11 2021 +0800
support function parse on pg/og (#13570)
* support function parse on pg/og
* support function parse on pg/og
---
.../impl/OpenGaussStatementSQLVisitor.java | 56 +++++++-------
.../impl/PostgreSQLStatementSQLVisitor.java | 56 +++++++-------
.../src/main/resources/case/dml/select.xml | 86 +++++++++++++++++++++-
.../main/resources/sql/supported/dml/select.xml | 4 +-
4 files changed, 143 insertions(+), 59 deletions(-)
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussStatementSQLVisitor.java
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussStatementSQLVisitor.java
index 3274ab8..763b9ec 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussStatementSQLVisitor.java
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussStatementSQLVisitor.java
@@ -114,6 +114,7 @@ import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.BetweenE
import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.BinaryOperationExpression;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExistsSubqueryExpression;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExpressionSegment;
+import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.FunctionSegment;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.InExpression;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ListExpression;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.complex.CommonExpressionSegment;
@@ -345,8 +346,22 @@ public abstract class OpenGaussStatementSQLVisitor extends
OpenGaussStatementBas
@Override
public ASTNode visitFuncExpr(final FuncExprContext ctx) {
+ if (null != ctx.functionExprCommonSubexpr()) {
+ return visit(ctx.functionExprCommonSubexpr());
+ }
+ calculateParameterCount(getTargetRuleContextFromParseTree(ctx,
CExprContext.class));
+ // TODO replace aggregation segment
+ String aggregationType = ctx.funcApplication().funcName().getText();
+ if (AggregationType.isAggregationType(aggregationType)) {
+ return createAggregationSegment(ctx.funcApplication(),
aggregationType);
+ }
+ return new FunctionSegment(ctx.getStart().getStartIndex(),
ctx.getStop().getStopIndex(), ctx.funcApplication().funcName().getText(),
getOriginalText(ctx));
+ }
+
+ @Override
+ public ASTNode visitFunctionExprCommonSubexpr(final
FunctionExprCommonSubexprContext ctx) {
calculateParameterCount(getTargetRuleContextFromParseTree(ctx,
CExprContext.class));
- return new ExpressionProjectionSegment(ctx.getStart().getStartIndex(),
ctx.getStop().getStopIndex(), getOriginalText(ctx));
+ return new FunctionSegment(ctx.getStart().getStartIndex(),
ctx.getStop().getStopIndex(), ctx.getChild(0).getText(), getOriginalText(ctx));
}
private <T extends ParseTree> Collection<T>
getTargetRuleContextFromParseTree(final ParseTree parseTree, final Class<?
extends T> clazz) {
@@ -460,25 +475,6 @@ public abstract class OpenGaussStatementSQLVisitor extends
OpenGaussStatementBas
return new LiteralExpressionSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), ctx.getText());
}
- protected ProjectionSegment generateProjectFromFuncExpr(final
FuncExprContext ctx) {
- if (null != ctx.funcApplication()) {
- return generateProjectFromFuncApplication(ctx.funcApplication());
- }
- return
generateProjectFromFunctionExprCommonSubexpr(ctx.functionExprCommonSubexpr());
- }
-
- private ProjectionSegment generateProjectFromFuncApplication(final
FuncApplicationContext ctx) {
- String aggregationType = ctx.funcName().getText();
- if (AggregationType.isAggregationType(aggregationType)) {
- return createAggregationSegment(ctx, aggregationType);
- }
- return new ExpressionProjectionSegment(ctx.getStart().getStartIndex(),
ctx.getStop().getStopIndex(), getOriginalText(ctx));
- }
-
- private ProjectionSegment
generateProjectFromFunctionExprCommonSubexpr(final
FunctionExprCommonSubexprContext ctx) {
- return new ExpressionProjectionSegment(ctx.getStart().getStartIndex(),
ctx.getStop().getStopIndex(), getOriginalText(ctx));
- }
-
private ProjectionSegment createAggregationSegment(final
FuncApplicationContext ctx, final String aggregationType) {
AggregationType type =
AggregationType.valueOf(aggregationType.toUpperCase());
String innerExpression = ctx.start.getInputStream().getText(new
Interval(ctx.LP_().getSymbol().getStartIndex(), ctx.stop.getStopIndex()));
@@ -522,15 +518,18 @@ public abstract class OpenGaussStatementSQLVisitor
extends OpenGaussStatementBas
@Override
public final ASTNode visitSortby(final SortbyContext ctx) {
OrderDirection orderDirection = null != ctx.ascDesc() ?
generateOrderDirection(ctx.ascDesc()) : OrderDirection.ASC;
- ASTNode astNode = visit(ctx.aExpr());
- if (astNode instanceof ColumnSegment) {
- ColumnSegment column = (ColumnSegment) astNode;
+ ASTNode expr = visit(ctx.aExpr());
+ if (expr instanceof ColumnSegment) {
+ ColumnSegment column = (ColumnSegment) expr;
return new ColumnOrderByItemSegment(column, orderDirection);
}
- if (astNode instanceof LiteralExpressionSegment) {
- LiteralExpressionSegment index = (LiteralExpressionSegment)
astNode;
+ if (expr instanceof LiteralExpressionSegment) {
+ LiteralExpressionSegment index = (LiteralExpressionSegment) expr;
return new IndexOrderByItemSegment(index.getStartIndex(),
index.getStopIndex(), Integer.parseInt(index.getLiterals().toString()),
orderDirection);
}
+ if (expr instanceof ExpressionSegment) {
+ return new
ExpressionOrderByItemSegment(ctx.aExpr().getStart().getStartIndex(),
ctx.aExpr().getStop().getStopIndex(), ctx.aExpr().getText(), orderDirection,
(ExpressionSegment) expr);
+ }
return new
ExpressionOrderByItemSegment(ctx.aExpr().getStart().getStartIndex(),
ctx.aExpr().getStop().getStopIndex(), ctx.aExpr().getText(), orderDirection);
}
@@ -902,8 +901,11 @@ public abstract class OpenGaussStatementSQLVisitor extends
OpenGaussStatementBas
if (projection instanceof ColumnSegment) {
result = new ColumnProjectionSegment((ColumnSegment)
projection);
}
- if (null != expr.cExpr().funcExpr()) {
- result = generateProjectFromFuncExpr(expr.cExpr().funcExpr());
+ if (projection instanceof FunctionSegment) {
+ result = new
ExpressionProjectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
getOriginalText(expr), (FunctionSegment) projection);
+ }
+ if (projection instanceof AggregationProjectionSegment) {
+ result = (AggregationProjectionSegment) projection;
}
if (projection instanceof SubqueryExpressionSegment) {
SubqueryExpressionSegment subqueryExpression =
(SubqueryExpressionSegment) projection;
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLStatementSQLVisitor.java
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLStatementSQLVisitor.java
index 11a3298..16cc020 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLStatementSQLVisitor.java
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLStatementSQLVisitor.java
@@ -111,6 +111,7 @@ import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.BetweenE
import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.BinaryOperationExpression;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExistsSubqueryExpression;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExpressionSegment;
+import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.FunctionSegment;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.InExpression;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ListExpression;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.complex.CommonExpressionSegment;
@@ -342,8 +343,22 @@ public abstract class PostgreSQLStatementSQLVisitor
extends PostgreSQLStatementB
@Override
public ASTNode visitFuncExpr(final FuncExprContext ctx) {
+ if (null != ctx.functionExprCommonSubexpr()) {
+ return visit(ctx.functionExprCommonSubexpr());
+ }
+ calculateParameterCount(getTargetRuleContextFromParseTree(ctx,
CExprContext.class));
+ // TODO replace aggregation segment
+ String aggregationType = ctx.funcApplication().funcName().getText();
+ if (AggregationType.isAggregationType(aggregationType)) {
+ return createAggregationSegment(ctx.funcApplication(),
aggregationType);
+ }
+ return new FunctionSegment(ctx.getStart().getStartIndex(),
ctx.getStop().getStopIndex(), ctx.funcApplication().funcName().getText(),
getOriginalText(ctx));
+ }
+
+ @Override
+ public ASTNode visitFunctionExprCommonSubexpr(final
FunctionExprCommonSubexprContext ctx) {
calculateParameterCount(getTargetRuleContextFromParseTree(ctx,
CExprContext.class));
- return new ExpressionProjectionSegment(ctx.getStart().getStartIndex(),
ctx.getStop().getStopIndex(), getOriginalText(ctx));
+ return new FunctionSegment(ctx.getStart().getStartIndex(),
ctx.getStop().getStopIndex(), ctx.getChild(0).getText(), getOriginalText(ctx));
}
private <T extends ParseTree> Collection<T>
getTargetRuleContextFromParseTree(final ParseTree parseTree, final Class<?
extends T> clazz) {
@@ -457,25 +472,6 @@ public abstract class PostgreSQLStatementSQLVisitor
extends PostgreSQLStatementB
return new LiteralExpressionSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), ctx.getText());
}
- protected ProjectionSegment generateProjectFromFuncExpr(final
FuncExprContext ctx) {
- if (null != ctx.funcApplication()) {
- return generateProjectFromFuncApplication(ctx.funcApplication());
- }
- return
generateProjectFromFunctionExprCommonSubexpr(ctx.functionExprCommonSubexpr());
- }
-
- private ProjectionSegment generateProjectFromFuncApplication(final
FuncApplicationContext ctx) {
- String aggregationType = ctx.funcName().getText();
- if (AggregationType.isAggregationType(aggregationType)) {
- return createAggregationSegment(ctx, aggregationType);
- }
- return new ExpressionProjectionSegment(ctx.getStart().getStartIndex(),
ctx.getStop().getStopIndex(), getOriginalText(ctx));
- }
-
- private ProjectionSegment
generateProjectFromFunctionExprCommonSubexpr(final
FunctionExprCommonSubexprContext ctx) {
- return new ExpressionProjectionSegment(ctx.getStart().getStartIndex(),
ctx.getStop().getStopIndex(), getOriginalText(ctx));
- }
-
private ProjectionSegment createAggregationSegment(final
FuncApplicationContext ctx, final String aggregationType) {
AggregationType type =
AggregationType.valueOf(aggregationType.toUpperCase());
String innerExpression = ctx.start.getInputStream().getText(new
Interval(ctx.LP_().getSymbol().getStartIndex(), ctx.stop.getStopIndex()));
@@ -519,15 +515,18 @@ public abstract class PostgreSQLStatementSQLVisitor
extends PostgreSQLStatementB
@Override
public final ASTNode visitSortby(final SortbyContext ctx) {
OrderDirection orderDirection = null != ctx.ascDesc() ?
generateOrderDirection(ctx.ascDesc()) : OrderDirection.ASC;
- ASTNode astNode = visit(ctx.aExpr());
- if (astNode instanceof ColumnSegment) {
- ColumnSegment column = (ColumnSegment) astNode;
+ ASTNode expr = visit(ctx.aExpr());
+ if (expr instanceof ColumnSegment) {
+ ColumnSegment column = (ColumnSegment) expr;
return new ColumnOrderByItemSegment(column, orderDirection);
}
- if (astNode instanceof LiteralExpressionSegment) {
- LiteralExpressionSegment index = (LiteralExpressionSegment)
astNode;
+ if (expr instanceof LiteralExpressionSegment) {
+ LiteralExpressionSegment index = (LiteralExpressionSegment) expr;
return new IndexOrderByItemSegment(index.getStartIndex(),
index.getStopIndex(), Integer.parseInt(index.getLiterals().toString()),
orderDirection);
}
+ if (expr instanceof ExpressionSegment) {
+ return new
ExpressionOrderByItemSegment(ctx.aExpr().getStart().getStartIndex(),
ctx.aExpr().getStop().getStopIndex(), ctx.aExpr().getText(), orderDirection,
(ExpressionSegment) expr);
+ }
return new
ExpressionOrderByItemSegment(ctx.aExpr().getStart().getStartIndex(),
ctx.aExpr().getStop().getStopIndex(), ctx.aExpr().getText(), orderDirection);
}
@@ -871,8 +870,11 @@ public abstract class PostgreSQLStatementSQLVisitor
extends PostgreSQLStatementB
if (projection instanceof ColumnSegment) {
result = new ColumnProjectionSegment((ColumnSegment)
projection);
}
- if (null != expr.cExpr().funcExpr()) {
- result = generateProjectFromFuncExpr(expr.cExpr().funcExpr());
+ if (projection instanceof FunctionSegment) {
+ result = new
ExpressionProjectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
getOriginalText(expr), (FunctionSegment) projection);
+ }
+ if (projection instanceof AggregationProjectionSegment) {
+ result = (AggregationProjectionSegment) projection;
}
if (projection instanceof SubqueryExpressionSegment) {
SubqueryExpressionSegment subqueryExpression =
(SubqueryExpressionSegment) projection;
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dml/select.xml
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dml/select.xml
index 6f912d9..1718886 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dml/select.xml
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dml/select.xml
@@ -877,6 +877,84 @@
</where>
</select>
+ <select sql-case-id="select_count_like_concat_postgres"
parameters="'init', 1, 2, 9, 10">
+ <from>
+ <simple-table name="t_order" alias="o" start-index="37"
stop-index="45" />
+ </from>
+ <projections start-index="7" stop-index="30">
+ <aggregation-projection type="COUNT" inner-expression="(0)"
alias="orders_count" start-index="7" stop-index="14" />
+ </projections>
+ <where start-index="47" stop-index="142" literal-stop-index="148">
+ <expr>
+ <binary-operation-expression start-index="53" stop-index="142"
literal-stop-index="148">
+ <left>
+ <binary-operation-expression start-index="53"
stop-index="111" literal-stop-index="116">
+ <left>
+ <binary-operation-expression start-index="53"
stop-index="87" literal-stop-index="92">
+ <left>
+ <column name="status" start-index="53"
stop-index="60">
+ <owner name="o" start-index="53"
stop-index="53" />
+ </column>
+ </left>
+ <operator>LIKE</operator>
+ <right>
+ <list-expression start-index="67"
stop-index="87" literal-stop-index="92">
+ <items>
+ <function
function-name="CONCAT" literal-text="CONCAT('%%', 'init', '%%')"
start-index="67" stop-index="87" literal-stop-index="92" text="CONCAT('%%', ?,
'%%')" />
+ </items>
+ </list-expression>
+ </right>
+ </binary-operation-expression>
+ </left>
+ <operator>AND</operator>
+ <right>
+ <in-expression start-index="93"
stop-index="111" literal-start-index="98" literal-stop-index="116">
+ <not>false</not>
+ <left>
+ <column name="user_id"
start-index="93" stop-index="101" literal-start-index="98"
literal-stop-index="106">
+ <owner name="o" start-index="93"
stop-index="93" literal-start-index="98" literal-stop-index="98"/>
+ </column>
+ </left>
+ <right>
+ <list-expression start-index="106"
stop-index="111" literal-start-index="111" literal-stop-index="116">
+ <items>
+ <literal-expression value="1"
start-index="112" stop-index="112" />
+ <parameter-marker-expression
value="1" start-index="107" stop-index="107" />
+ </items>
+ <items>
+ <literal-expression value="2"
start-index="115" stop-index="115" />
+ <parameter-marker-expression
value="2" start-index="110" stop-index="110" />
+ </items>
+ </list-expression>
+ </right>
+ </in-expression>
+ </right>
+ </binary-operation-expression>
+ </left>
+ <operator>AND</operator>
+ <right>
+ <between-expression start-index="117" stop-index="142"
literal-start-index="122" literal-stop-index="148">
+ <not>false</not>
+ <left>
+ <column name="order_id" start-index="117"
stop-index="126" literal-start-index="122" literal-stop-index="131">
+ <owner name="o" start-index="117"
stop-index="117" literal-start-index="122" literal-stop-index="122" />
+ </column>
+ </left>
+ <between-expr>
+ <literal-expression value="9"
start-index="141" stop-index="141" />
+ <parameter-marker-expression value="3"
start-index="136" stop-index="136" />
+ </between-expr>
+ <and-expr>
+ <literal-expression value="10"
start-index="147" stop-index="148" />
+ <parameter-marker-expression value="4"
start-index="142" stop-index="142" />
+ </and-expr>
+ </between-expression>
+ </right>
+ </binary-operation-expression>
+ </expr>
+ </where>
+ </select>
+
<select sql-case-id="select_like_with_single_quotes" >
<from>
<simple-table name="admin" start-index="15" stop-index="19" />
@@ -926,7 +1004,7 @@
<right>
<list-expression start-index="65"
stop-index="85" literal-stop-index="90">
<items>
- <expression-projection
text="CONCAT('%%', ?, '%%')" literal-text="CONCAT('%%', 'init', '%%')"
start-index="65" stop-index="85" literal-stop-index="90"/>
+ <function
function-name="CONCAT" text="CONCAT('%%', ?, '%%')" literal-text="CONCAT('%%',
'init', '%%')" start-index="65" stop-index="85" literal-stop-index="90"/>
</items>
</list-expression>
</right>
@@ -1838,7 +1916,7 @@
</left>
<operator>=</operator>
<right>
- <expression-projection
text="ST_GeographyFromText('SRID=4326;POINT('||?||' '||?||')')"
literal-text="ST_GeographyFromText('SRID=4326;POINT('||100||' '||200||')')"
start-index="60" stop-index="115" literal-start-index="78"
literal-stop-index="137" />
+ <function
function-name="ST_GeographyFromText"
text="ST_GeographyFromText('SRID=4326;POINT('||?||' '||?||')')"
literal-text="ST_GeographyFromText('SRID=4326;POINT('||100||' '||200||')')"
start-index="60" stop-index="115" literal-start-index="78"
literal-stop-index="137" />
</right>
</binary-operation-expression>
</right>
@@ -1919,7 +1997,7 @@
</left>
<operator>=</operator>
<right>
- <expression-projection
text="ST_GeographyFromText('SRID=4326;POINT('||?||' '||?||')')"
literal-text="ST_GeographyFromText('SRID=4326;POINT('||100||' '||200||')')"
start-index="73" stop-index="128" literal-start-index="109"
literal-stop-index="168" />
+ <function
function-name="ST_GeographyFromText"
text="ST_GeographyFromText('SRID=4326;POINT('||?||' '||?||')')"
literal-text="ST_GeographyFromText('SRID=4326;POINT('||100||' '||200||')')"
start-index="73" stop-index="128" literal-start-index="109"
literal-stop-index="168" />
</right>
</binary-operation-expression>
</right>
@@ -2002,7 +2080,7 @@
</left>
<operator>=</operator>
<right>
- <expression-projection
text="ST_GeographyFromText('SRID=4326;POINT('||?||' '||?||')')"
literal-text="ST_GeographyFromText('SRID=4326;POINT('||100||' '||200||')')"
start-index="79" stop-index="134" literal-start-index="115"
literal-stop-index="174" />
+ <function
function-name="ST_GeographyFromText"
literal-text="ST_GeographyFromText('SRID=4326;POINT('||100||' '||200||')')"
text="ST_GeographyFromText('SRID=4326;POINT('||?||' '||?||')')"
start-index="79" stop-index="134" literal-start-index="115"
literal-stop-index="174" />
</right>
</binary-operation-expression>
</right>
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dml/select.xml
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dml/select.xml
index bcd7c5e..dc1e22c 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dml/select.xml
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dml/select.xml
@@ -39,7 +39,9 @@
<sql-case id="select_in_with_same_sharding_column" value="SELECT * FROM
t_order WHERE order_id IN (?, ?) AND order_id IN (?, ?) ORDER BY order_id" />
<sql-case id="select_with_N_string_in_expression" value="SELECT * FROM
t_order WHERE is_deleted = 'N'" />
<sql-case id="select_count_like" value="SELECT COUNT(*) FROM t_order WHERE
(user_id = ? AND status LIKE ?)" />
- <sql-case id="select_count_like_concat" value="SELECT count(0) AS
orders_count FROM t_order o WHERE o.status LIKE CONCAT('%%', ?, '%%') AND
o.user_id IN (?, ?) AND o.order_id BETWEEN ? AND ?" />
+ <sql-case id="select_count_like_concat" value="SELECT count(0) AS
orders_count FROM t_order o WHERE o.status LIKE CONCAT('%%', ?, '%%') AND
o.user_id IN (?, ?) AND o.order_id BETWEEN ? AND ?"
db-types="MySQL,SQLServer,Oracle,SQL92"/>
+ <!--TODO combine into select_count_like_concat-->
+ <sql-case id="select_count_like_concat_postgres" value="SELECT count(0) AS
orders_count FROM t_order o WHERE o.status LIKE CONCAT('%%', ?, '%%') AND
o.user_id IN (?, ?) AND o.order_id BETWEEN ? AND ?"
db-types="PostgreSQL,openGauss"/>
<sql-case id="select_like_with_single_quotes" value="select id from admin
where fullname like 'a%'" db-types="MySQL"/>
<sql-case id="select_count_tilde_concat" value="SELECT count(0) as
orders_count FROM t_order o WHERE o.status ~~ CONCAT('%%', ?, '%%') AND
o.user_id IN (?, ?) AND o.order_id BETWEEN ? AND ?"
db-types="PostgreSQL,openGauss" />
<sql-case id="select_sharding_route_with_binding_tables" 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 WHERE o.user_id IN (?, ?) AND o.order_id BETWEEN ? AND ? ORDER BY
i.item_id" />