Skip to content

Commit ef0ee8f

Browse files
committed
Remove duplicated addParameterMarkers while using SQLStatementCopyUtils.copyAttributes(...) and add unit tests for associated situations
1 parent db58115 commit ef0ee8f

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/statement/SQLStatementCopyUtilsTest.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@
1717

1818
package org.apache.shardingsphere.infra.binder.engine.statement;
1919

20+
import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
21+
import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.simple.ParameterMarkerExpressionSegment;
2022
import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.CommentSegment;
2123
import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.ParameterMarkerSegment;
22-
import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.simple.ParameterMarkerExpressionSegment;
23-
import org.apache.shardingsphere.sql.parser.statement.core.enums.ParameterMarkerType;
2424
import org.apache.shardingsphere.sql.parser.statement.core.statement.SQLStatement;
25-
import org.apache.shardingsphere.test.fixture.database.MockedDatabaseType;
2625
import org.junit.jupiter.api.BeforeEach;
2726
import org.junit.jupiter.api.Test;
2827

@@ -39,6 +38,19 @@
3938
* Test for SQLStatementCopyUtils.
4039
*/
4140
class SQLStatementCopyUtilsTest {
41+
42+
public static class MockedDatabaseType implements DatabaseType {
43+
44+
@Override
45+
public Collection<String> getJdbcUrlPrefixes() {
46+
return Collections.singleton("jdbc:mock");
47+
}
48+
49+
@Override
50+
public String getType() {
51+
return "MOCKED";
52+
}
53+
}
4254

4355
private SQLStatement originalStatement;
4456
private SQLStatement targetStatement;

0 commit comments

Comments
 (0)