Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
package net.sf.jsqlparser.expression;

import java.util.Locale;
import net.sf.jsqlparser.expression.operators.relational.ExpressionList;
import net.sf.jsqlparser.parser.ASTNodeAccessImpl;
import net.sf.jsqlparser.statement.select.Limit;
Expand Down Expand Up @@ -243,7 +244,8 @@ public AnalyticExpression setHavingClause(Function.HavingClause havingClause) {

public AnalyticExpression setHavingClause(String havingType, Expression expression) {
this.havingClause = new Function.HavingClause(
Function.HavingClause.HavingType.valueOf(havingType.trim().toUpperCase()),
Function.HavingClause.HavingType
.valueOf(havingType.trim().toUpperCase(Locale.ROOT)),
expression);
return this;
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/net/sf/jsqlparser/expression/AnalyticType.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
*/
package net.sf.jsqlparser.expression;

import java.util.Locale;

public enum AnalyticType {
OVER, WITHIN_GROUP, WITHIN_GROUP_OVER, FILTER_ONLY;

public static AnalyticType from(String type) {
return Enum.valueOf(AnalyticType.class, type.toUpperCase());
return Enum.valueOf(AnalyticType.class, type.toUpperCase(Locale.ROOT));
}
}
4 changes: 3 additions & 1 deletion src/main/java/net/sf/jsqlparser/expression/AnyType.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
*/
package net.sf.jsqlparser.expression;

import java.util.Locale;

public enum AnyType {
ANY, SOME, ALL;

public static AnyType from(String type) {
return Enum.valueOf(AnyType.class, type.toUpperCase());
return Enum.valueOf(AnyType.class, type.toUpperCase(Locale.ROOT));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
package net.sf.jsqlparser.expression;

import java.util.Locale;
import net.sf.jsqlparser.parser.ASTNodeAccessImpl;
import net.sf.jsqlparser.statement.create.table.ColDataType;
import net.sf.jsqlparser.statement.create.table.ColumnDefinition;
Expand Down Expand Up @@ -276,7 +277,8 @@ public enum DataType {
ARRAY, BIT, BITSTRING, BLOB, BYTEA, BINARY, VARBINARY, BYTES, BOOLEAN, BOOL, ENUM, INTERVAL, LIST, MAP, STRUCT, TINYINT, INT1, SMALLINT, INT2, SHORT, INTEGER, INT4, INT, SIGNED, BIGINT, INT8, LONG, HUGEINT, UTINYINT, USMALLINT, UINTEGER, UBIGINT, UHUGEINT, DECIMAL, NUMBER, NUMERIC, REAL, FLOAT4, FLOAT, DOUBLE, DOUBLE_PRECISION, FLOAT8, FLOAT64, UUID, VARCHAR, NVARCHAR, CHAR, NCHAR, BPCHAR, STRING, TEXT, CLOB, DATE, TIME, TIME_WITHOUT_TIME_ZONE, TIMETZ, TIME_WITH_TIME_ZONE, TIMESTAMP_NS, TIMESTAMP, TIMESTAMP_WITHOUT_TIME_ZONE, DATETIME, TIMESTAMP_MS, TIMESTAMP_S, TIMESTAMPTZ, TIMESTAMP_WITH_TIME_ZONE, UNKNOWN, VARBYTE, JSON;

public static DataType from(String typeStr) {
Matcher matcher = PATTERN.matcher(typeStr.trim().replaceAll("\\s+", "_").toUpperCase());
Matcher matcher = PATTERN.matcher(
typeStr.trim().replaceAll("\\s+", "_").toUpperCase(Locale.ROOT));
if (matcher.find()) {
try {
return Enum.valueOf(DataType.class, matcher.group(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
package net.sf.jsqlparser.expression;

import java.util.Locale;
import net.sf.jsqlparser.parser.ASTNodeAccessImpl;

public class DateTimeLiteralExpression extends ASTNodeAccessImpl implements Expression {
Expand Down Expand Up @@ -56,7 +57,7 @@ public enum DateTime {
DATE, DATETIME, TIME, TIMESTAMP, TIMESTAMPTZ;

public static DateTime from(String dateTimeStr) {
return Enum.valueOf(DateTime.class, dateTimeStr.toUpperCase());
return Enum.valueOf(DateTime.class, dateTimeStr.toUpperCase(Locale.ROOT));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
package net.sf.jsqlparser.expression;

import java.util.Locale;
import net.sf.jsqlparser.parser.ASTNodeAccessImpl;

import java.util.Objects;
Expand Down Expand Up @@ -44,7 +45,7 @@ public enum DateUnit {
CENTURY, DECADE, YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, SECOND, MILLISECOND, MICROSECOND, NANOSECOND;

public static DateUnit from(String UnitStr) {
return Enum.valueOf(DateUnit.class, UnitStr.toUpperCase());
return Enum.valueOf(DateUnit.class, UnitStr.toUpperCase(Locale.ROOT));
}
}
}
4 changes: 3 additions & 1 deletion src/main/java/net/sf/jsqlparser/expression/Function.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
package net.sf.jsqlparser.expression;

import java.util.Locale;
import net.sf.jsqlparser.expression.operators.relational.ExpressionList;
import net.sf.jsqlparser.expression.operators.relational.NamedExpressionList;
import net.sf.jsqlparser.parser.ASTNodeAccessImpl;
Expand Down Expand Up @@ -152,7 +153,8 @@ public Function setHavingClause(HavingClause havingClause) {

public Function setHavingClause(String havingType, Expression expression) {
this.havingClause = new HavingClause(
HavingClause.HavingType.valueOf(havingType.trim().toUpperCase()), expression);
HavingClause.HavingType.valueOf(havingType.trim().toUpperCase(Locale.ROOT)),
expression);
return this;
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/net/sf/jsqlparser/expression/HexValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
package net.sf.jsqlparser.expression;

import java.util.Locale;
import net.sf.jsqlparser.parser.ASTNodeAccessImpl;

import java.nio.charset.StandardCharsets;
Expand Down Expand Up @@ -60,7 +61,7 @@ public String toString() {
}

public String getDigits() {
return value.toUpperCase().startsWith("0X")
return value.toUpperCase(Locale.ROOT).startsWith("0X")
? value.substring(2)
: value.substring(2, value.length() - 1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
package net.sf.jsqlparser.expression;

import java.util.List;
import java.util.Locale;
import java.util.Objects;

import net.sf.jsqlparser.statement.select.OrderByElement;
Expand Down Expand Up @@ -73,7 +74,7 @@ public void setType(String typeName) {
.valueOf(Objects
.requireNonNull(typeName,
"The Type of the JSON Aggregate Function must not be null")
.toUpperCase());
.toUpperCase(Locale.ROOT));
}

public JsonAggregateFunction withType(JsonFunctionType type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@

package net.sf.jsqlparser.expression;

import java.util.Locale;

/**
* @author <a href="mailto:andreas@manticore-projects.com">Andreas Reichel</a>
*/
public enum JsonAggregateOnNullType {
NULL, ABSENT;

public static JsonAggregateOnNullType from(String type) {
return Enum.valueOf(JsonAggregateOnNullType.class, type.toUpperCase());
return Enum.valueOf(JsonAggregateOnNullType.class, type.toUpperCase(Locale.ROOT));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@

package net.sf.jsqlparser.expression;

import java.util.Locale;

/**
* @author <a href="mailto:andreas@manticore-projects.com">Andreas Reichel</a>
*/
public enum JsonAggregateUniqueKeysType {
WITH, WITHOUT;

public static JsonAggregateUniqueKeysType from(String type) {
return Enum.valueOf(JsonAggregateUniqueKeysType.class, type.toUpperCase());
return Enum.valueOf(JsonAggregateUniqueKeysType.class, type.toUpperCase(Locale.ROOT));
}
}
3 changes: 2 additions & 1 deletion src/main/java/net/sf/jsqlparser/expression/JsonFunction.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
package net.sf.jsqlparser.expression;

import java.util.ArrayList;
import java.util.Locale;
import java.util.Objects;

import net.sf.jsqlparser.parser.ASTNodeAccessImpl;
Expand Down Expand Up @@ -355,7 +356,7 @@ public void setType(String typeName) {
this.functionType = JsonFunctionType.valueOf(
Objects.requireNonNull(typeName,
"The Type of the JSON Aggregate Function must not be null")
.toUpperCase());
.toUpperCase(Locale.ROOT));
}

public JsonFunction withType(JsonFunctionType type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

package net.sf.jsqlparser.expression;

import java.util.Locale;

/**
* @author <a href="mailto:andreas@manticore-projects.com">Andreas Reichel</a>
*/
Expand All @@ -29,6 +31,6 @@ public enum JsonFunctionType {
MYSQL_OBJECT;

public static JsonFunctionType from(String type) {
return Enum.valueOf(JsonFunctionType.class, type.toUpperCase());
return Enum.valueOf(JsonFunctionType.class, type.toUpperCase(Locale.ROOT));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
package net.sf.jsqlparser.expression;

import java.util.Locale;
import net.sf.jsqlparser.schema.Table;

import java.util.Collections;
Expand Down Expand Up @@ -74,7 +75,7 @@ public enum OnDelete {
CASCADE, NO_ACTION;

public static OnDelete from(String action) {
return Enum.valueOf(OnDelete.class, action.toUpperCase());
return Enum.valueOf(OnDelete.class, action.toUpperCase(Locale.ROOT));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
package net.sf.jsqlparser.expression;

import java.util.Locale;
import net.sf.jsqlparser.parser.ASTNodeAccessImpl;
import net.sf.jsqlparser.statement.create.table.ColDataType;

Expand All @@ -22,7 +23,7 @@ public class TranscodingFunction extends ASTNodeAccessImpl implements Expression
private String transcodingName;

public TranscodingFunction(String keyword, Expression expression, String transcodingName) {
this.keyword = Objects.requireNonNullElse(keyword, "CONVERT").toUpperCase();
this.keyword = Objects.requireNonNullElse(keyword, "CONVERT").toUpperCase(Locale.ROOT);
this.expression = expression;
this.transcodingName = transcodingName;
}
Expand All @@ -34,7 +35,7 @@ public TranscodingFunction(Expression expression, String transcodingName) {

public TranscodingFunction(String keyword, ColDataType colDataType, Expression expression,
String transcodingName) {
this.keyword = Objects.requireNonNullElse(keyword, "CONVERT").toUpperCase();
this.keyword = Objects.requireNonNullElse(keyword, "CONVERT").toUpperCase(Locale.ROOT);
this.colDataType = colDataType;
this.expression = expression;
this.transcodingName = transcodingName;
Expand All @@ -58,7 +59,7 @@ public String getKeyword() {
}

public TranscodingFunction setKeyword(String keyword) {
this.keyword = Objects.requireNonNullElse(keyword, "CONVERT").toUpperCase();
this.keyword = Objects.requireNonNullElse(keyword, "CONVERT").toUpperCase(Locale.ROOT);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
package net.sf.jsqlparser.expression;

import java.io.Serializable;
import java.util.Locale;

public class WindowElement implements Serializable {

Expand Down Expand Up @@ -73,7 +74,7 @@ public enum Type {
ROWS, RANGE;

public static Type from(String type) {
return Enum.valueOf(Type.class, type.toUpperCase());
return Enum.valueOf(Type.class, type.toUpperCase(Locale.ROOT));
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/net/sf/jsqlparser/expression/WindowOffset.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
package net.sf.jsqlparser.expression;

import java.io.Serializable;
import java.util.Locale;

public class WindowOffset implements Serializable {

Expand Down Expand Up @@ -79,7 +80,7 @@ public enum Type {
PRECEDING, FOLLOWING, CURRENT, EXPR;

public static Type from(String type) {
return Enum.valueOf(Type.class, type.toUpperCase());
return Enum.valueOf(Type.class, type.toUpperCase(Locale.ROOT));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
package net.sf.jsqlparser.expression.operators.relational;

import java.util.Locale;
import net.sf.jsqlparser.expression.BinaryExpression;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.ExpressionVisitor;
Expand Down Expand Up @@ -120,7 +121,8 @@ public enum KeyWord {
LIKE, ILIKE, RLIKE, REGEXP_LIKE, REGEXP, SIMILAR_TO, MATCH_ANY, MATCH_ALL, MATCH_PHRASE, MATCH_PHRASE_PREFIX, MATCH_REGEXP;

public static KeyWord from(String keyword) {
return Enum.valueOf(KeyWord.class, keyword.toUpperCase().replaceAll("\\s+", "_"));
return Enum.valueOf(KeyWord.class,
keyword.toUpperCase(Locale.ROOT).replaceAll("\\s+", "_"));
}
}
}
3 changes: 2 additions & 1 deletion src/main/java/net/sf/jsqlparser/schema/Sequence.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import net.sf.jsqlparser.parser.ASTNodeAccessImpl;

Expand Down Expand Up @@ -177,7 +178,7 @@ public enum ParameterType {
INCREMENT_BY, INCREMENT, START_WITH, START, RESTART_WITH, MAXVALUE, NOMAXVALUE, MINVALUE, NOMINVALUE, CYCLE, NOCYCLE, CACHE, NOCACHE, ORDER, NOORDER, KEEP, NOKEEP, SESSION, GLOBAL;

public static ParameterType from(String type) {
return Enum.valueOf(ParameterType.class, type.toUpperCase());
return Enum.valueOf(ParameterType.class, type.toUpperCase(Locale.ROOT));
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/net/sf/jsqlparser/statement/DBMSType.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
package net.sf.jsqlparser.statement;

import java.util.Locale;
import net.sf.jsqlparser.expression.StringValue;

public class DBMSType implements SourceDestinationType {
Expand All @@ -20,7 +21,7 @@ public DBMSType(String dbmsType) {
}

public DBMSType(String dbmsType, String jdbcDriverDefinition) {
this.dbmsType = Kind.valueOf(dbmsType.toUpperCase());
this.dbmsType = Kind.valueOf(dbmsType.toUpperCase(Locale.ROOT));
if (jdbcDriverDefinition != null) {
this.jdbcDriverDefinition = new StringValue(jdbcDriverDefinition);
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/net/sf/jsqlparser/statement/DeclareType.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
*/
package net.sf.jsqlparser.statement;

import java.util.Locale;

/**
* @author tobens
*/
public enum DeclareType {
TABLE, AS, TYPE;

public static DeclareType from(String type) {
return Enum.valueOf(DeclareType.class, type.toUpperCase());
return Enum.valueOf(DeclareType.class, type.toUpperCase(Locale.ROOT));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;
import net.sf.jsqlparser.schema.Table;

Expand Down Expand Up @@ -144,7 +145,7 @@ public enum OptionType {
ANALYZE, VERBOSE, COSTS, BUFFERS, FORMAT, PLAN, PLAN_FOR;

public static OptionType from(String type) {
return Enum.valueOf(OptionType.class, type.toUpperCase());
return Enum.valueOf(OptionType.class, type.toUpperCase(Locale.ROOT));
}
}

Expand Down
Loading
Loading