|
25 | 25 | import org.apache.shardingsphere.infra.binder.context.segment.insert.values.InsertSelectContext;
|
26 | 26 | import org.apache.shardingsphere.infra.binder.context.segment.insert.values.InsertValueContext;
|
27 | 27 | import org.apache.shardingsphere.infra.binder.context.segment.insert.values.OnDuplicateUpdateContext;
|
28 |
| -import org.apache.shardingsphere.infra.binder.context.segment.insert.values.OnConflictUpdateContext; |
29 | 28 | import org.apache.shardingsphere.infra.binder.context.segment.table.TablesContext;
|
30 | 29 | import org.apache.shardingsphere.infra.binder.context.statement.CommonSQLStatementContext;
|
31 | 30 | import org.apache.shardingsphere.infra.binder.context.type.TableAvailable;
|
|
44 | 43 | import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.assignment.InsertValuesSegment;
|
45 | 44 | import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.assignment.SetAssignmentSegment;
|
46 | 45 | import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.ColumnSegment;
|
47 |
| -import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.OnConflictKeyColumnsSegment; |
48 | 46 | import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.OnDuplicateKeyColumnsSegment;
|
49 | 47 | import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.combine.CombineSegment;
|
50 | 48 | import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.BinaryOperationExpression;
|
|
54 | 52 | import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.WithSegment;
|
55 | 53 | import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
|
56 | 54 | import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.InsertStatement;
|
57 |
| -import org.apache.shardingsphere.sql.parser.statement.core.extractor.TableExtractor; |
58 | 55 |
|
59 | 56 | import java.util.ArrayList;
|
60 | 57 | import java.util.Collection;
|
@@ -95,9 +92,6 @@ public final class InsertStatementContext extends CommonSQLStatementContext impl
|
95 | 92 | @Getter
|
96 | 93 | private OnDuplicateUpdateContext onDuplicateKeyUpdateValueContext;
|
97 | 94 |
|
98 |
| - @Getter |
99 |
| - private OnConflictUpdateContext onConflictKeyUpdateValueContext; |
100 |
| - |
101 | 95 | private GeneratedKeyContext generatedKeyContext;
|
102 | 96 |
|
103 | 97 | public InsertStatementContext(final ShardingSphereMetaData metaData, final List<Object> params, final InsertStatement sqlStatement, final String currentDatabaseName) {
|
@@ -185,18 +179,6 @@ private Optional<OnDuplicateUpdateContext> getOnDuplicateKeyUpdateValueContext(f
|
185 | 179 | return Optional.of(onDuplicateUpdateContext);
|
186 | 180 | }
|
187 | 181 |
|
188 |
| - private Optional<OnConflictUpdateContext> getOnConflictKeyUpdateValueContext(final List<Object> params, final AtomicInteger parametersOffset) { |
189 |
| - Optional<OnConflictKeyColumnsSegment> onConflictKeyColumnsSegment = getSqlStatement().getOnConflictKeyColumns(); |
190 |
| - if (!onConflictKeyColumnsSegment.isPresent()) { |
191 |
| - return Optional.empty(); |
192 |
| - } |
193 |
| - Collection<ColumnAssignmentSegment> onConflictKeyColumns = onConflictKeyColumnsSegment.get().getColumns(); |
194 |
| - Optional<WhereSegment> whereSegment = getSqlStatement().getOnConflictKeyColumns().flatMap(OnConflictKeyColumnsSegment::getWhere); |
195 |
| - OnConflictUpdateContext onConflictUpdateContext = new OnConflictUpdateContext(onConflictKeyColumns, params, parametersOffset.get(), whereSegment); |
196 |
| - parametersOffset.addAndGet(onConflictUpdateContext.getParameterCount()); |
197 |
| - return Optional.of(onConflictUpdateContext); |
198 |
| - } |
199 |
| - |
200 | 182 | private Collection<SimpleTableSegment> getAllSimpleTableSegments() {
|
201 | 183 | TableExtractor tableExtractor = new TableExtractor();
|
202 | 184 | tableExtractor.extractTablesFromInsert(getSqlStatement());
|
@@ -246,15 +228,6 @@ public List<Object> getOnDuplicateKeyUpdateParameters() {
|
246 | 228 | return null == onDuplicateKeyUpdateValueContext ? new ArrayList<>() : onDuplicateKeyUpdateValueContext.getParameters();
|
247 | 229 | }
|
248 | 230 |
|
249 |
| - /** |
250 |
| - * Get on duplicate key update parameters. |
251 |
| - * |
252 |
| - * @return on duplicate key update parameters |
253 |
| - */ |
254 |
| - public List<Object> getOnConflictKeyUpdateParameters() { |
255 |
| - return null == onConflictKeyUpdateValueContext ? new ArrayList<>() : onConflictKeyUpdateValueContext.getParameters(); |
256 |
| - } |
257 |
| - |
258 | 231 | /**
|
259 | 232 | * Get generated key context.
|
260 | 233 | *
|
@@ -342,7 +315,6 @@ public void setUpParameters(final List<Object> params) {
|
342 | 315 | insertValueContexts = getInsertValueContexts(params, parametersOffset, valueExpressions);
|
343 | 316 | insertSelectContext = getInsertSelectContext(metaData, params, parametersOffset, currentDatabaseName).orElse(null);
|
344 | 317 | onDuplicateKeyUpdateValueContext = getOnDuplicateKeyUpdateValueContext(params, parametersOffset).orElse(null);
|
345 |
| - onConflictKeyUpdateValueContext = getOnConflictKeyUpdateValueContext(params, parametersOffset).orElse(null); |
346 | 318 | ShardingSphereSchema schema = getSchema(metaData, currentDatabaseName);
|
347 | 319 | generatedKeyContext = new GeneratedKeyContextEngine(getSqlStatement(), schema).createGenerateKeyContext(insertColumnNamesAndIndexes, insertValueContexts, params).orElse(null);
|
348 | 320 | }
|
|
0 commit comments