提交 9603f3fa 编写于 作者: T terrymanu

refactor for increaseParametersIndex

上级 b44b6f16
......@@ -44,7 +44,12 @@ public abstract class AbstractParser {
@Setter
private int parametersIndex;
protected int increaseParametersIndex() {
/**
* 增加索引偏移量.
*
* @return 增加后的索引偏移量
*/
public int increaseParametersIndex() {
return ++parametersIndex;
}
......@@ -53,7 +58,6 @@ public abstract class AbstractParser {
*
* @return 小括号内所有的词法标记
*/
// TODO 判断? 增加param index
public final String skipParentheses() {
StringBuilder result = new StringBuilder("");
int count = 0;
......
......@@ -72,7 +72,7 @@ public final class MySQLInsertParser extends AbstractInsertParser {
sqlExpression = new SQLIgnoreExpression();
} else if (getSqlParser().equalAny(Symbol.QUESTION)) {
sqlExpression = new SQLPlaceholderExpression(getSqlParser().getParametersIndex());
getSqlParser().setParametersIndex(getSqlParser().getParametersIndex() + 1);
getSqlParser().increaseParametersIndex();
} else {
throw new UnsupportedOperationException("");
}
......
......@@ -103,7 +103,7 @@ public final class SQLServerParser extends SQLParser {
offsetValue = Integer.parseInt(getLexer().getCurrentToken().getLiterals());
} else if (equalAny(Symbol.QUESTION)) {
offsetIndex = getParametersIndex();
setParametersIndex(offsetIndex + 1);
increaseParametersIndex();
} else {
throw new SQLParsingException(getLexer());
}
......@@ -118,7 +118,7 @@ public final class SQLServerParser extends SQLParser {
rowCountValue = Integer.parseInt(getLexer().getCurrentToken().getLiterals());
} else if (equalAny(Symbol.QUESTION)) {
rowCountIndex = getParametersIndex();
setParametersIndex(rowCountIndex + 1);
increaseParametersIndex();
} else {
throw new SQLParsingException(getLexer());
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册