HHH-7721 SQLFunctionRegistry findSQLFunction does not honor case
sensitivity
This commit is contained in:
parent
a9bc598042
commit
85fa6bc141
|
@ -2414,7 +2414,9 @@ public class Configuration implements Serializable {
|
|||
}
|
||||
|
||||
public void addSqlFunction(String functionName, SQLFunction function) {
|
||||
sqlFunctions.put( functionName, function );
|
||||
// HHH-7721: SQLFunctionRegistry expects all lowercase. Enforce,
|
||||
// just in case a user's customer dialect uses mixed cases.
|
||||
sqlFunctions.put( functionName.toLowerCase(), function );
|
||||
}
|
||||
|
||||
public TypeResolver getTypeResolver() {
|
||||
|
|
|
@ -598,7 +598,9 @@ public abstract class Dialect implements ConversionContext {
|
|||
// function support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
protected void registerFunction(String name, SQLFunction function) {
|
||||
sqlFunctions.put( name, function );
|
||||
// HHH-7721: SQLFunctionRegistry expects all lowercase. Enforce,
|
||||
// just in case a user's customer dialect uses mixed cases.
|
||||
sqlFunctions.put( name.toLowerCase(), function );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,7 +38,6 @@ public class SQLFunctionRegistry {
|
|||
}
|
||||
|
||||
public SQLFunction findSQLFunction(String functionName) {
|
||||
// TODO: lower casing done here. Was done "at random" before; maybe not needed at all ?
|
||||
String name = functionName.toLowerCase();
|
||||
SQLFunction userFunction = userFunctions.get( name );
|
||||
return userFunction != null
|
||||
|
@ -47,7 +46,6 @@ public class SQLFunctionRegistry {
|
|||
}
|
||||
|
||||
public boolean hasFunction(String functionName) {
|
||||
// TODO: toLowerCase was not done before. Only used in Template.
|
||||
String name = functionName.toLowerCase();
|
||||
return userFunctions.containsKey( name ) || dialect.getFunctions().containsKey( name );
|
||||
}
|
||||
|
|
|
@ -361,7 +361,7 @@ public class SessionFactoryHelper {
|
|||
* @return The sql function, or null if not found.
|
||||
*/
|
||||
public SQLFunction findSQLFunction(String functionName) {
|
||||
return sfi.getSqlFunctionRegistry().findSQLFunction( functionName.toLowerCase() );
|
||||
return sfi.getSqlFunctionRegistry().findSQLFunction( functionName );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue