public static String renderWhereStringTemplate(String sqlWhereString, Dialect dialect, SQLFunctionRegistry functionRegistry) { return renderWhereStringTemplate(sqlWhereString, TEMPLATE, dialect, functionRegistry); }
/** * Same functionality as {@link #renderWhereStringTemplate(String, String, Dialect, SQLFunctionRegistry)}, * except that a SQLFunctionRegistry is not provided (i.e., only the dialect-defined functions are * considered). This is only intended for use by the annotations project until the * many-to-many/map-key-from-target-table feature is pulled into core. * * @deprecated Only intended for annotations usage; use {@link #renderWhereStringTemplate(String, String, Dialect, SQLFunctionRegistry)} instead */ @Deprecated @SuppressWarnings({ "JavaDoc" }) public static String renderWhereStringTemplate(String sqlWhereString, String placeholder, Dialect dialect) { return renderWhereStringTemplate( sqlWhereString, placeholder, dialect, new SQLFunctionRegistry( dialect, java.util.Collections.<String, SQLFunction>emptyMap() ) ); }
protected static String getTemplateFromString(String string, SessionFactoryImplementor factory) { return string == null ? null : Template.renderWhereStringTemplate( string, factory.getDialect(), factory.getSqlFunctionRegistry() ); }
@Override public String getTemplate(Dialect dialect, SQLFunctionRegistry functionRegistry) { String template = Template.renderWhereStringTemplate(formula, dialect, functionRegistry); return safeInterning( StringHelper.replace( template, "{alias}", Template.TEMPLATE ) ); }
final String source = renderWhereStringTemplate( extractUntil( tokens, ")" ), placeholder, renderWhereStringTemplate( trimOperands.trimSpec, placeholder, dialect, functionRegistry ) ); result.append( renderWhereStringTemplate( trimOperands.trimSource, placeholder, dialect, functionRegistry ) ) .append( ')' );
@Test public void testSqlTrimFunction() { String fragment = "trim( col )"; String template = Template.renderWhereStringTemplate( fragment, Template.TEMPLATE, DIALECT, FUNCTION_REGISTRY ); assertEquals( "trim(" + Template.TEMPLATE + ".col)", template ); fragment = "trim( from col )"; template = Template.renderWhereStringTemplate( fragment, Template.TEMPLATE, DIALECT, FUNCTION_REGISTRY ); assertEquals( "trim(from " + Template.TEMPLATE + ".col)", template ); fragment = "trim( both from col )"; template = Template.renderWhereStringTemplate( fragment, Template.TEMPLATE, DIALECT, FUNCTION_REGISTRY ); assertEquals( "trim(both from " + Template.TEMPLATE + ".col)", template ); fragment = "trim( leading from col )"; template = Template.renderWhereStringTemplate( fragment, Template.TEMPLATE, DIALECT, FUNCTION_REGISTRY ); assertEquals( "trim(leading from " + Template.TEMPLATE + ".col)", template ); fragment = "trim( TRAILING from col )"; template = Template.renderWhereStringTemplate( fragment, Template.TEMPLATE, DIALECT, FUNCTION_REGISTRY ); assertEquals( "trim(TRAILING from " + Template.TEMPLATE + ".col)", template ); fragment = "trim( 'b' from col )"; template = Template.renderWhereStringTemplate( fragment, Template.TEMPLATE, DIALECT, FUNCTION_REGISTRY ); assertEquals( "trim('b' from " + Template.TEMPLATE + ".col)", template ); fragment = "trim( both 'b' from col )"; template = Template.renderWhereStringTemplate( fragment, Template.TEMPLATE, DIALECT, FUNCTION_REGISTRY ); assertEquals( "trim(both 'b' from " + Template.TEMPLATE + ".col)", template ); }
@Test public void testSqlExtractFunction() { String fragment = "extract( year from col )"; String template = Template.renderWhereStringTemplate( fragment, Template.TEMPLATE, DIALECT, FUNCTION_REGISTRY ); assertEquals( "extract(year from " + Template.TEMPLATE + ".col)", template ); }
.useAutoAliasInjection() ) { filterConditions[filterCount] = safeInterning( Template.renderWhereStringTemplate( filter.getCondition(), FilterImpl.MARKER,
sqlWhereStringTemplate = sqlWhereString == null ? null : Template.renderWhereStringTemplate( sqlWhereString, dialect,
formulaString = Template.renderWhereStringTemplate( formulaString, "$alias$", new HSQLDialect() ); formulaString = "(select " + formulaString + fromAndWhere + ")"; formulaString = StringHelper.replace(
hasWhere = sqlWhereString != null; sqlWhereStringTemplate = hasWhere ? Template.renderWhereStringTemplate( sqlWhereString, dialect, factory.getSqlFunctionRegistry() ) : null; manyToManyWhereTemplate = manyToManyWhereString == null ? null : Template.renderWhereStringTemplate( manyToManyWhereString, factory.getDialect(), factory.getSqlFunctionRegistry() );
/** * Same functionality as {@link #renderWhereStringTemplate(String, String, Dialect, SQLFunctionRegistry)}, * except that a SQLFunctionRegistry is not provided (i.e., only the dialect-defined functions are * considered). This is only intended for use by the annotations project until the * many-to-many/map-key-from-target-table feature is pulled into core. * * @deprecated Only intended for annotations usage; use {@link #renderWhereStringTemplate(String, String, Dialect, SQLFunctionRegistry)} instead */ public static String renderWhereStringTemplate(String sqlWhereString, String placeholder, Dialect dialect) { return renderWhereStringTemplate( sqlWhereString, placeholder, dialect, new SQLFunctionRegistry( dialect, java.util.Collections.EMPTY_MAP ) ); }
public String getTemplate(Dialect dialect, SQLFunctionRegistry functionRegistry) { return Template.renderWhereStringTemplate(formula, dialect, functionRegistry); } public String getText(Dialect dialect) {
public String getTemplate(Dialect dialect) { return Template.renderWhereStringTemplate(formula, dialect); } public String getText(Dialect dialect) {
formulaString = Template.renderWhereStringTemplate( formulaString, "$alias$", new HSQLDialect() ); formulaString = "(select " + formulaString + fromAndWhere + ")"; formulaString = StringHelper.replace(
public String getTemplate(Dialect dialect, SQLFunctionRegistry functionRegistry) { return hasCustomRead() ? Template.renderWhereStringTemplate( customRead, dialect, functionRegistry ) : Template.TEMPLATE + '.' + getQuotedName( dialect ); }
@Override public String getTemplate(Dialect dialect, SqmFunctionRegistry functionRegistry) { String template = Template.renderWhereStringTemplate(formula, dialect, functionRegistry); return safeInterning( StringHelper.replace( template, "{alias}", Template.TEMPLATE ) ); }
protected static String getTemplateFromString(String string, SessionFactoryImplementor factory) { return string == null ? null : Template.renderWhereStringTemplate( string, factory.getDialect(), factory.getSqlFunctionRegistry() ); }
protected static String getTemplateFromString(String string, SessionFactoryImplementor factory) { return string == null ? null : Template.renderWhereStringTemplate( string, factory.getDialect(), factory.getSqlFunctionRegistry() ); }
public String getTemplate(Dialect dialect, SQLFunctionRegistry functionRegistry) { return hasCustomRead() ? Template.renderWhereStringTemplate( customRead, dialect, functionRegistry ) : Template.TEMPLATE + '.' + getQuotedName( dialect ); }