Top Description Inners Constructors Methods
org.hibernate.engine.query.spi

public Class ParameterParser

extends Object
Class Inheritance
Imports
org.hibernate.QueryException, org.hibernate.hql.internal.classic.ParserHelper, org.hibernate.internal.util.StringHelper

The single available method parse is responsible for parsing a query string and recognizing tokens in relation to parameters (either named, JPA-style, or ordinal) and providing callbacks about such recognitions.
Author
Steve Ebersole

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
ParameterParser.Recognizer

Maybe better named a Journaler.

Constructor Summary

AccessConstructor and Description
private
ParameterParser()

Direct instantiation of ParameterParser disallowed.

Method Summary

Modifier and TypeMethod and Description
public static void
parse(String
The string to be parsed/tokenized.
sqlString
,
ParameterParser.Recognizer
The thing which handles recognition events.
recognizer
)

Performs the actual parsing and tokenizing of the query string making appropriate callbacks to the given recognizer upon recognition of the various tokens.

public static boolean

Returns:

true/false
startsWithEscapeCallTemplate
(String
The SQL string to check
sqlString
)

Exposed as public solely for use from tests

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ParameterParserback to summary
private ParameterParser()

Direct instantiation of ParameterParser disallowed.

Method Detail

parseback to summary
public static void parse(String sqlString, ParameterParser.Recognizer recognizer) throws QueryException

Performs the actual parsing and tokenizing of the query string making appropriate callbacks to the given recognizer upon recognition of the various tokens.

Note that currently, this only knows how to deal with a single output parameter (for callable statements). If we later add support for multiple output params, this, obviously, needs to change.

Parameters
sqlString:String

The string to be parsed/tokenized.

recognizer:ParameterParser.Recognizer

The thing which handles recognition events.

Exceptions
QueryException:
Indicates unexpected parameter conditions.
startsWithEscapeCallTemplateback to summary
public static boolean startsWithEscapeCallTemplate(String sqlString)

Exposed as public solely for use from tests

Parameters
sqlString:String

The SQL string to check

Returns:boolean

true/false

org.hibernate.engine.query.spi back to summary

public Interface ParameterParser.Recognizer

Known Direct Implementers
org.hibernate.engine.query.spi.ParamLocationRecognizer, org.hibernate.loader.custom.sql.SQLQueryParser.ParameterSubstitutionRecognizer

Maybe better named a Journaler. Essentially provides a callback contract for things that recognize parameters

Method Summary

Modifier and TypeMethod and Description
public void
public void
jpaPositionalParameter(int
The identifier (name) of the JPA-style parameter
identifier
,
int
The position within the query
position
)

Called when a JPA-style named parameter is recognized

public void
namedParameter(String
The recognized parameter name
name
,
int
The position within the query
position
)

Called when a named parameter is recognized

public void
ordinalParameter(int
The position within the query
position
)

Called when an ordinal parameter is recognized

public void
other(char
The recognized character
character
)

Called when a character that is not a parameter (or part of a parameter definition) is recognized.

public void
outParameter(int
The position within the query
position
)

Called when an output parameter is recognized

Method Detail

completeback to summary
public void complete()
jpaPositionalParameterback to summary
public void jpaPositionalParameter(int identifier, int position)

Called when a JPA-style named parameter is recognized

Parameters
identifier:int

The identifier (name) of the JPA-style parameter

position:int

The position within the query

namedParameterback to summary
public void namedParameter(String name, int position)

Called when a named parameter is recognized

Parameters
name:String

The recognized parameter name

position:int

The position within the query

ordinalParameterback to summary
public void ordinalParameter(int position)

Called when an ordinal parameter is recognized

Parameters
position:int

The position within the query

otherback to summary
public void other(char character)

Called when a character that is not a parameter (or part of a parameter definition) is recognized.

Parameters
character:char

The recognized character

outParameterback to summary
public void outParameter(int position)

Called when an output parameter is recognized

Parameters
position:int

The position within the query