提交 180b8d52 编写于 作者: T tristaZero

delete sql token

上级 d4fa56ed
......@@ -18,7 +18,6 @@
package org.apache.shardingsphere.core.parse.sql.statement;
import com.google.common.base.Optional;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
......@@ -27,12 +26,9 @@ import org.apache.shardingsphere.core.constant.SQLType;
import org.apache.shardingsphere.core.parse.sql.context.condition.ParseCondition;
import org.apache.shardingsphere.core.parse.sql.context.table.Tables;
import org.apache.shardingsphere.core.parse.sql.segment.SQLSegment;
import org.apache.shardingsphere.core.parse.sql.token.SQLToken;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/**
* SQL statement abstract class.
......@@ -56,24 +52,10 @@ public abstract class AbstractSQLStatement implements SQLStatement {
private final ParseCondition encryptCondition = new ParseCondition();
@Getter(AccessLevel.NONE)
private final List<SQLToken> sqlTokens = new LinkedList<>();
private int parametersIndex;
private String logicSQL;
@Override
public final void addSQLToken(final SQLToken sqlToken) {
sqlTokens.add(sqlToken);
}
@Override
public final List<SQLToken> getSQLTokens() {
Collections.sort(sqlTokens);
return sqlTokens;
}
@Override
@SuppressWarnings("unchecked")
public final <T extends SQLSegment> Optional<T> findSQLSegment(final Class<T> sqlSegmentType) {
......
......@@ -22,10 +22,8 @@ import org.apache.shardingsphere.core.constant.SQLType;
import org.apache.shardingsphere.core.parse.sql.context.condition.ParseCondition;
import org.apache.shardingsphere.core.parse.sql.context.table.Tables;
import org.apache.shardingsphere.core.parse.sql.segment.SQLSegment;
import org.apache.shardingsphere.core.parse.sql.token.SQLToken;
import java.util.Collection;
import java.util.List;
/**
* SQL statement.
......@@ -69,20 +67,6 @@ public interface SQLStatement {
*/
ParseCondition getEncryptCondition();
/**
* Add SQL token.
*
* @param sqlToken SQL token
*/
void addSQLToken(SQLToken sqlToken);
/**
* Get SQL tokens.
*
* @return SQL tokens
*/
List<SQLToken> getSQLTokens();
/**
* Get index of parameters.
*
......
......@@ -90,7 +90,7 @@ public final class SQLRewriteEngine {
}
private List<SQLToken> createSQLTokens(final BaseRule baseRule, final SQLStatement sqlStatement) {
List<SQLToken> result = new LinkedList<>(sqlStatement.getSQLTokens());
List<SQLToken> result = new LinkedList<>();
result.addAll(new BaseTokenGenerateEngine().generateSQLTokens(sqlStatement, baseRule));
if (baseRule instanceof ShardingRule) {
ShardingRule shardingRule = (ShardingRule) baseRule;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册