/** * Locate a registered sql function by name. * * @param functionName The name of the function to locate * * @return The sql function, or null if not found. */ public SQLFunction findSQLFunction(String functionName) { return sfi.getSqlFunctionRegistry().findSQLFunction( functionName ); }
private static boolean isFunction(String lcToken, String nextToken, SQLFunctionRegistry functionRegistry) { // checking for "(" is currently redundant because it is checked before getting here; // doing the check anyhow, in case that earlier check goes away; if ( "(".equals( nextToken ) ) { return true; } SQLFunction function = functionRegistry.findSQLFunction(lcToken); if ( function == null ) { // lcToken does not refer to a function return false; } // if function.hasParenthesesIfNoArguments() is true, then assume // lcToken is not a function (since it is not followed by '(') return ! function.hasParenthesesIfNoArguments(); }
private SQLFunction getFunction(String name, QueryTranslatorImpl q) { return q.getFactory().getSqlFunctionRegistry().findSQLFunction( name ); }
protected SQLFunction getFunction(CriteriaQuery criteriaQuery) { final SQLFunctionRegistry sqlFunctionRegistry = criteriaQuery.getFactory().getSqlFunctionRegistry(); final SQLFunction function = sqlFunctionRegistry.findSQLFunction( "count" ); if ( function == null ) { throw new HibernateException( "Unable to locate count function mapping" ); } return function; }
protected SQLFunction getFunction(String functionName, CriteriaQuery criteriaQuery) { final SQLFunction function = criteriaQuery.getFactory() .getSqlFunctionRegistry() .findSQLFunction( functionName ); if ( function == null ) { throw new HibernateException( "Unable to locate mapping for function named [" + functionName + "]" ); } return function; }
@Override @SuppressWarnings("SimplifiableIfStatement") protected boolean isFunctionName(AST ast) { /* * Semantic predicate used to determine whether a given AST node represents a function call */ AST child = ast.getFirstChild(); // assume it is a function if it has parameters if ( child != null && "{param list}".equals( child.getText() ) ) { return true; } // otherwise, in order for this to be a function logically it has to be a function that does not // have arguments. So try to assert that using the registry of known functions final SQLFunction function = context.getSqlFunctionRegistry().findSQLFunction( ast.getText() ); if ( function == null ) { // no registered function, so we cannot know for certain return false; } else { // if function.hasParenthesesIfNoArguments() is true, then assume the node is not a function return !function.hasParenthesesIfNoArguments(); } }
final SQLFunction function = context.getSqlFunctionRegistry().findSQLFunction( functionName ); if ( function == null ) { String text = functionName;
@Test public void testNoArgFcnAndColumnSameNameAsNoArgFunctionHQL() { SQLFunction function = sessionFactory().getSqlFunctionRegistry().findSQLFunction( "current_date" ); if ( function == null || function.hasParenthesesIfNoArguments() ) { SkipLog.reportSkip( "current_date reuires ()", "tests noarg function that does not require ()" );
@Test public void testGetMultiColumnSameNameAsNoArgFunctionHQL() throws Exception { SQLFunction function = sessionFactory().getSqlFunctionRegistry().findSQLFunction( "current_date" ); if ( function == null || function.hasParenthesesIfNoArguments() ) { SkipLog.reportSkip( "current_date reuires ()", "tests noarg function that does not require ()" );
@Test public void testGetMultiColumnSameNameAsNoArgFunctionCriteria() { SQLFunction function = sessionFactory().getSqlFunctionRegistry().findSQLFunction( "current_date" ); if ( function == null || function.hasParenthesesIfNoArguments() ) { SkipLog.reportSkip( "current_date reuires ()", "tests noarg function that does not require ()" );
/** * Locate a registered sql function by name. * * @param functionName The name of the function to locate * @return The sql function, or null if not found. */ public SQLFunction findSQLFunction(String functionName) { return sfi.getSqlFunctionRegistry().findSQLFunction( functionName.toLowerCase() ); }
/** * Locate a registered sql function by name. * * @param functionName The name of the function to locate * @return The sql function, or null if not found. */ public SQLFunction findSQLFunction(String functionName) { return sfi.getSqlFunctionRegistry().findSQLFunction( functionName.toLowerCase() ); }
private static boolean isFunction(String lcToken, String nextToken, SQLFunctionRegistry functionRegistry) { // checking for "(" is currently redundant because it is checked before getting here; // doing the check anyhow, in case that earlier check goes away; if ("(".equals(nextToken)) { return true; } SQLFunction function = functionRegistry.findSQLFunction(lcToken); if (function == null) { // lcToken does not refer to a function return false; } // if function.hasParenthesesIfNoArguments() is true, then assume // lcToken is not a function (since it is not followed by '(') return !function.hasParenthesesIfNoArguments(); }
private SQLFunction getFunction(String name, QueryTranslatorImpl q) { return q.getFactory().getSqlFunctionRegistry().findSQLFunction( name ); }
private SQLFunction getFunction(String name, QueryTranslatorImpl q) { return q.getFactory().getSqlFunctionRegistry().findSQLFunction( name ); }
private SQLFunction getFunction(CriteriaQuery criteriaQuery) { return criteriaQuery.getFactory().getSqlFunctionRegistry() .findSQLFunction(CONCAT_FUNCTION_NAME); }
protected SQLFunction getFunction(CriteriaQuery criteriaQuery) { SQLFunction function = criteriaQuery.getFactory() .getSqlFunctionRegistry() .findSQLFunction( "count" ); if ( function == null ) { throw new HibernateException( "Unable to locate count function mapping" ); } return function; } }
protected SQLFunction getFunction(String functionName, CriteriaQuery criteriaQuery) { SQLFunction function = criteriaQuery.getFactory() .getSqlFunctionRegistry() .findSQLFunction( functionName ); if ( function == null ) { throw new HibernateException( "Unable to locate mapping for function named [" + functionName + "]" ); } return function; }
protected SQLFunction getFunction(String functionName, CriteriaQuery criteriaQuery) { SQLFunction function = criteriaQuery.getFactory() .getSqlFunctionRegistry() .findSQLFunction( functionName ); if ( function == null ) { throw new HibernateException( "Unable to locate mapping for function named [" + functionName + "]" ); } return function; }
protected SQLFunction getFunction(CriteriaQuery criteriaQuery) { SQLFunction function = criteriaQuery.getFactory() .getSqlFunctionRegistry() .findSQLFunction( "count" ); if ( function == null ) { throw new HibernateException( "Unable to locate count function mapping" ); } return function; } }