You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by me...@apache.org on 2021/04/13 09:36:13 UTC
[shardingsphere] branch master updated: Revert "add owner t oken
and combination token (#10059)" (#10070)
This is an automated email from the ASF dual-hosted git repository.
menghaoran 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 3325b0b Revert "add owner t oken and combination token (#10059)" (#10070)
3325b0b is described below
commit 3325b0b1d10dc4cefa679dde92d18d182e19adfa
Author: Liang Zhang <te...@163.com>
AuthorDate: Tue Apr 13 17:35:50 2021 +0800
Revert "add owner t oken and combination token (#10059)" (#10070)
This reverts commit 9d5edbb414b8a8511e191cc3fa15e8ca54c85dae.
---
.../token/pojo/generic/CombinationalSQLToken.java | 60 ----------------
.../rewrite/sql/token/pojo/generic/OwnerToken.java | 79 ----------------------
2 files changed, 139 deletions(-)
diff --git a/shardingsphere-infra/shardingsphere-infra-rewrite/shardingsphere-infra-rewrite-engine/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/pojo/generic/CombinationalSQLToken.java b/shardingsphere-infra/shardingsphere-infra-rewrite/shardingsphere-infra-rewrite-engine/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/pojo/generic/CombinationalSQLToken.java
deleted file mode 100644
index 4929c2e..0000000
--- a/shardingsphere-infra/shardingsphere-infra-rewrite/shardingsphere-infra-rewrite-engine/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/pojo/generic/CombinationalSQLToken.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.rewrite.sql.token.pojo.generic;
-
-import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.SQLToken;
-import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.Substitutable;
-
-import java.util.Collection;
-import java.util.LinkedList;
-
-/**
- * Combinational sql token.
- */
-public final class CombinationalSQLToken extends SQLToken implements Substitutable {
-
- private final Collection<SQLToken> sqlTokens = new LinkedList<>();
-
- private final int stopIndex;
-
- public CombinationalSQLToken(final int startIndex, final int stopIndex) {
- super(startIndex);
- this.stopIndex = stopIndex;
- }
-
- /**
- * add sql token.
- * @param sqlToken sql token
- */
- public void addSQLToken(final SQLToken sqlToken) {
- this.sqlTokens.add(sqlToken);
- }
-
- /**
- * get sql tokens.
- * @return sql tokens
- */
- public Collection<SQLToken> getSQLTokens() {
- return sqlTokens;
- }
-
- @Override
- public int getStopIndex() {
- return stopIndex;
- }
-}
diff --git a/shardingsphere-infra/shardingsphere-infra-rewrite/shardingsphere-infra-rewrite-engine/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/pojo/generic/OwnerToken.java b/shardingsphere-infra/shardingsphere-infra-rewrite/shardingsphere-infra-rewrite-engine/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/pojo/generic/OwnerToken.java
deleted file mode 100644
index 638c48e..0000000
--- a/shardingsphere-infra/shardingsphere-infra-rewrite/shardingsphere-infra-rewrite-engine/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/pojo/generic/OwnerToken.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.rewrite.sql.token.pojo.generic;
-
-import lombok.Getter;
-import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.RouteUnitAware;
-import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.SQLToken;
-import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.Substitutable;
-import org.apache.shardingsphere.infra.route.context.RouteUnit;
-import org.apache.shardingsphere.sql.parser.sql.common.constant.QuoteCharacter;
-
-import java.util.Objects;
-import java.util.Set;
-
-/**
- * Owner token.
- */
-public final class OwnerToken extends SQLToken implements Substitutable, RouteUnitAware {
-
- @Getter
- private final int stopIndex;
-
- private final String ownerName;
-
- private final String tableName;
-
- private final QuoteCharacter quoteCharacter;
-
- public OwnerToken(final int startIndex, final int stopIndex, final String ownerName, final String tableName, final QuoteCharacter quoteCharacter) {
- super(startIndex);
- this.stopIndex = stopIndex;
- this.ownerName = ownerName;
- this.tableName = tableName;
- this.quoteCharacter = quoteCharacter;
- }
-
- @Override
- public String toString(final RouteUnit routeUnit) {
- if (Objects.nonNull(ownerName) && tableName.equals(ownerName)) {
- Set<String> actualTableNames = routeUnit.getActualTableNames(tableName);
- String actualTableName = actualTableNames.isEmpty() ? tableName.toLowerCase() : actualTableNames.iterator().next();
- return getQuoteCharacter().wrap(actualTableName) + ".";
- }
- return toString();
- }
-
- @Override
- public String toString() {
- return Objects.isNull(ownerName) ? "" : getQuoteCharacter().wrap(ownerName) + ".";
- }
-
- @Override
- public int getStopIndex() {
- return stopIndex;
- }
-
- /**
- * get QuoteCharacter.
- * @return column QuoteCharacter
- */
- public QuoteCharacter getQuoteCharacter() {
- return Objects.nonNull(quoteCharacter) ? quoteCharacter : QuoteCharacter.NONE;
- }
-}