HHH-7721 SQLFunctionRegistry findSQLFunction does not honor case
sensitivity
This commit is contained in:
parent
c46c04631d
commit
4e434f6197
|
@ -2418,7 +2418,9 @@ public class Configuration implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSqlFunction(String functionName, SQLFunction function) {
|
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() {
|
public TypeResolver getTypeResolver() {
|
||||||
|
|
|
@ -598,7 +598,9 @@ public abstract class Dialect implements ConversionContext {
|
||||||
// function support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// function support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
protected void registerFunction(String name, SQLFunction function) {
|
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) {
|
public SQLFunction findSQLFunction(String functionName) {
|
||||||
// TODO: lower casing done here. Was done "at random" before; maybe not needed at all ?
|
|
||||||
String name = functionName.toLowerCase();
|
String name = functionName.toLowerCase();
|
||||||
SQLFunction userFunction = userFunctions.get( name );
|
SQLFunction userFunction = userFunctions.get( name );
|
||||||
return userFunction != null
|
return userFunction != null
|
||||||
|
@ -47,7 +46,6 @@ public class SQLFunctionRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasFunction(String functionName) {
|
public boolean hasFunction(String functionName) {
|
||||||
// TODO: toLowerCase was not done before. Only used in Template.
|
|
||||||
String name = functionName.toLowerCase();
|
String name = functionName.toLowerCase();
|
||||||
return userFunctions.containsKey( name ) || dialect.getFunctions().containsKey( name );
|
return userFunctions.containsKey( name ) || dialect.getFunctions().containsKey( name );
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,7 +361,7 @@ public class SessionFactoryHelper {
|
||||||
* @return The sql function, or null if not found.
|
* @return The sql function, or null if not found.
|
||||||
*/
|
*/
|
||||||
public SQLFunction findSQLFunction(String functionName) {
|
public SQLFunction findSQLFunction(String functionName) {
|
||||||
return sfi.getSqlFunctionRegistry().findSQLFunction( functionName.toLowerCase() );
|
return sfi.getSqlFunctionRegistry().findSQLFunction( functionName );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue