常量抽离
parent
e5f001cd9e
commit
08a396fe40
|
@ -33,4 +33,7 @@ public class CommandConsTant {
|
|||
|
||||
public static final String VARIABLE_PREPARED_STATEMENT = "#{";
|
||||
|
||||
|
||||
public static final char[] COMMAND_PRE_FIX = new char[]{'m', 'y', '-'};
|
||||
|
||||
}
|
||||
|
|
|
@ -22,8 +22,6 @@ import java.util.Objects;
|
|||
*/
|
||||
public class ParseSqlUtil {
|
||||
|
||||
private final char[] commandPrefix = new char[]{'m', 'y', '-'};
|
||||
|
||||
|
||||
public final static ThreadLocal<Map<String, Object>> PARSE_PARAM_LOCALE = new ThreadLocal<>();
|
||||
public final static ThreadLocal<Map<String, Object>> PARSE_TEMP_PARAM_LOCALE = new ThreadLocal<>();
|
||||
|
@ -75,7 +73,7 @@ public class ParseSqlUtil {
|
|||
String tempSql = parseStatement(sqlBuilder.toString());
|
||||
sqlBuilder.delete(0, sqlBuilder.length());
|
||||
sqlBuilder.append(tempSql);
|
||||
i += commandPrefix.length + 1;
|
||||
i += CommandConsTant.COMMAND_PRE_FIX.length + 1;
|
||||
SqlCommandDefinition commandDefinition = parseCommand(chars, i);
|
||||
sqlBuilder.append(commandDefinition.getCommandContent());
|
||||
i += commandDefinition.getCommandLength();
|
||||
|
@ -139,10 +137,10 @@ public class ParseSqlUtil {
|
|||
}
|
||||
|
||||
private boolean checkCommand(char[] chars, int index) {
|
||||
if (index + commandPrefix.length + 1 >= chars.length) {
|
||||
if (index + CommandConsTant.COMMAND_PRE_FIX.length + 1 >= chars.length) {
|
||||
return false;
|
||||
}
|
||||
for (char prefix : commandPrefix) {
|
||||
for (char prefix : CommandConsTant.COMMAND_PRE_FIX) {
|
||||
if (prefix != chars[++index]) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue