Search in sources :

Example 6 with ParamLocationRecognizer

use of org.hibernate.engine.query.spi.ParamLocationRecognizer in project hibernate-orm by hibernate.

the class ParameterParserTest method testSlashStarInCharLiteral.

@Test
public void testSlashStarInCharLiteral() {
    ParamLocationRecognizer recognizer = new ParamLocationRecognizer(0);
    ParameterParser.parse("select coalesce(i.name, '/*NONE') as itname  from Item i where i.intVal=? ", recognizer);
    assertEquals(1, recognizer.getOrdinalParameterDescriptionMap().size());
}
Also used : ParamLocationRecognizer(org.hibernate.engine.query.spi.ParamLocationRecognizer) Test(org.junit.Test)

Example 7 with ParamLocationRecognizer

use of org.hibernate.engine.query.spi.ParamLocationRecognizer in project hibernate-orm by hibernate.

the class ParameterParserTest method testApostropheInOracleAlias.

@Test
public void testApostropheInOracleAlias() {
    ParamLocationRecognizer recognizer = new ParamLocationRecognizer(0);
    ParameterParser.parse("SELECT column as \"Table's column\" FROM Table WHERE column <> :param", recognizer);
    assertTrue(recognizer.getNamedParameterDescriptionMap().containsKey("param"));
}
Also used : ParamLocationRecognizer(org.hibernate.engine.query.spi.ParamLocationRecognizer) Test(org.junit.Test)

Example 8 with ParamLocationRecognizer

use of org.hibernate.engine.query.spi.ParamLocationRecognizer in project hibernate-orm by hibernate.

the class ParameterParserTest method testContractionInComment.

@Test
public void testContractionInComment() {
    ParamLocationRecognizer recognizer = new ParamLocationRecognizer(0);
    ParameterParser.parse("-- This shouldn't fail the test.\n" + "SELECT column FROM Table WHERE column <> :param", recognizer);
    assertTrue(recognizer.getNamedParameterDescriptionMap().containsKey("param"));
}
Also used : ParamLocationRecognizer(org.hibernate.engine.query.spi.ParamLocationRecognizer) Test(org.junit.Test)

Aggregations

ParamLocationRecognizer (org.hibernate.engine.query.spi.ParamLocationRecognizer)8 Test (org.junit.Test)7 HashMap (java.util.HashMap)1 NamedParameterDescriptor (org.hibernate.engine.query.spi.NamedParameterDescriptor)1 OrdinalParameterDescriptor (org.hibernate.engine.query.spi.OrdinalParameterDescriptor)1 ParameterMetadataImpl (org.hibernate.query.internal.ParameterMetadataImpl)1