Package org.hibernate.dialect.function

Examples of org.hibernate.dialect.function.AnsiTrimEmulationFunction.render()


    final String expectedTrimPrep = "replace(replace(a.column,' ','${space}$'),'-',' ')";
    final String expectedPostTrimPrefix = "replace(replace(";
    final String expectedPostTrimSuffix = ",' ','-'),'${space}$',' ')";

    // -> trim(LEADING '-' FROM a.column)
    String rendered = function.render( null, argList( "LEADING", "'-'", "FROM", trimSource ), null );
    String expected = expectedPostTrimPrefix + "ltrim(" + expectedTrimPrep + ")" + expectedPostTrimSuffix;
    assertEquals( expected, rendered );

    // -> trim(TRAILING '-' FROM a.column)
    rendered = function.render( null, argList( "TRAILING", "'-'", "FROM", trimSource ), null );
View Full Code Here


    String rendered = function.render( null, argList( "LEADING", "'-'", "FROM", trimSource ), null );
    String expected = expectedPostTrimPrefix + "ltrim(" + expectedTrimPrep + ")" + expectedPostTrimSuffix;
    assertEquals( expected, rendered );

    // -> trim(TRAILING '-' FROM a.column)
    rendered = function.render( null, argList( "TRAILING", "'-'", "FROM", trimSource ), null );
    expected = expectedPostTrimPrefix + "rtrim(" + expectedTrimPrep + ")" + expectedPostTrimSuffix;
    assertEquals( expected, rendered );

    // -> trim(BOTH '-' FROM a.column)
    rendered = function.render( null, argList( "BOTH", "'-'", "FROM", trimSource ), null );
View Full Code Here

    rendered = function.render( null, argList( "TRAILING", "'-'", "FROM", trimSource ), null );
    expected = expectedPostTrimPrefix + "rtrim(" + expectedTrimPrep + ")" + expectedPostTrimSuffix;
    assertEquals( expected, rendered );

    // -> trim(BOTH '-' FROM a.column)
    rendered = function.render( null, argList( "BOTH", "'-'", "FROM", trimSource ), null );
    expected = expectedPostTrimPrefix + "ltrim(rtrim(" + expectedTrimPrep + "))" + expectedPostTrimSuffix;
    assertEquals( expected, rendered );

    // -> trim('-' FROM a.column)
    rendered = function.render( null, argList( "'-'", "FROM", trimSource ), null );
View Full Code Here

    rendered = function.render( null, argList( "BOTH", "'-'", "FROM", trimSource ), null );
    expected = expectedPostTrimPrefix + "ltrim(rtrim(" + expectedTrimPrep + "))" + expectedPostTrimSuffix;
    assertEquals( expected, rendered );

    // -> trim('-' FROM a.column)
    rendered = function.render( null, argList( "'-'", "FROM", trimSource ), null );
    expected = expectedPostTrimPrefix + "ltrim(rtrim(" + expectedTrimPrep + "))" + expectedPostTrimSuffix;
    assertEquals( expected, rendered );
  }

  public void testBasicSybaseProcessing() {
View Full Code Here

    final String expectedTrimPrep = "str_replace(str_replace(a.column,' ','${space}$'),'-',' ')";
    final String expectedPostTrimPrefix = "str_replace(str_replace(";
    final String expectedPostTrimSuffix = ",' ','-'),'${space}$',' ')";

    // -> trim(LEADING '-' FROM a.column)
    String rendered = function.render( null, argList( "LEADING", "'-'", "FROM", trimSource ), null );
    String expected = expectedPostTrimPrefix + "ltrim(" + expectedTrimPrep + ")" + expectedPostTrimSuffix;
    assertEquals( expected, rendered );

    // -> trim(TRAILING '-' FROM a.column)
    rendered = function.render( null, argList( "TRAILING", "'-'", "FROM", trimSource ), null );
View Full Code Here

    String rendered = function.render( null, argList( "LEADING", "'-'", "FROM", trimSource ), null );
    String expected = expectedPostTrimPrefix + "ltrim(" + expectedTrimPrep + ")" + expectedPostTrimSuffix;
    assertEquals( expected, rendered );

    // -> trim(TRAILING '-' FROM a.column)
    rendered = function.render( null, argList( "TRAILING", "'-'", "FROM", trimSource ), null );
    expected = expectedPostTrimPrefix + "rtrim(" + expectedTrimPrep + ")" + expectedPostTrimSuffix;
    assertEquals( expected, rendered );

    // -> trim(BOTH '-' FROM a.column)
    rendered = function.render( null, argList( "BOTH", "'-'", "FROM", trimSource ), null );
View Full Code Here

    rendered = function.render( null, argList( "TRAILING", "'-'", "FROM", trimSource ), null );
    expected = expectedPostTrimPrefix + "rtrim(" + expectedTrimPrep + ")" + expectedPostTrimSuffix;
    assertEquals( expected, rendered );

    // -> trim(BOTH '-' FROM a.column)
    rendered = function.render( null, argList( "BOTH", "'-'", "FROM", trimSource ), null );
    expected = expectedPostTrimPrefix + "ltrim(rtrim(" + expectedTrimPrep + "))" + expectedPostTrimSuffix;
    assertEquals( expected, rendered );

    // -> trim('-' FROM a.column)
    rendered = function.render( null, argList( "'-'", "FROM", trimSource ), null );
View Full Code Here

    rendered = function.render( null, argList( "BOTH", "'-'", "FROM", trimSource ), null );
    expected = expectedPostTrimPrefix + "ltrim(rtrim(" + expectedTrimPrep + "))" + expectedPostTrimSuffix;
    assertEquals( expected, rendered );

    // -> trim('-' FROM a.column)
    rendered = function.render( null, argList( "'-'", "FROM", trimSource ), null );
    expected = expectedPostTrimPrefix + "ltrim(rtrim(" + expectedTrimPrep + "))" + expectedPostTrimSuffix;
    assertEquals( expected, rendered );
  }

  private void performBasicSpaceTrimmingTests(AnsiTrimEmulationFunction function) {
View Full Code Here

    final String expectedTrimPrep = "replace(replace(a.column,' ','${space}$'),'-',' ')";
    final String expectedPostTrimPrefix = "replace(replace(";
    final String expectedPostTrimSuffix = ",' ','-'),'${space}$',' ')";

    // -> trim(LEADING '-' FROM a.column)
    String rendered = function.render( argList( "LEADING", "'-'", "FROM", trimSource ), null );
    String expected = expectedPostTrimPrefix + "ltrim(" + expectedTrimPrep + ")" + expectedPostTrimSuffix;
    assertEquals( expected, rendered );

    // -> trim(TRAILING '-' FROM a.column)
    rendered = function.render( argList( "TRAILING", "'-'", "FROM", trimSource ), null );
View Full Code Here

    String rendered = function.render( argList( "LEADING", "'-'", "FROM", trimSource ), null );
    String expected = expectedPostTrimPrefix + "ltrim(" + expectedTrimPrep + ")" + expectedPostTrimSuffix;
    assertEquals( expected, rendered );

    // -> trim(TRAILING '-' FROM a.column)
    rendered = function.render( argList( "TRAILING", "'-'", "FROM", trimSource ), null );
    expected = expectedPostTrimPrefix + "rtrim(" + expectedTrimPrep + ")" + expectedPostTrimSuffix;
    assertEquals( expected, rendered );

    // -> trim(BOTH '-' FROM a.column)
    rendered = function.render( argList( "BOTH", "'-'", "FROM", trimSource ), null );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.