org.sqlproc.engine.impl
Class SqlInputValue

java.lang.Object
  extended by org.sqlproc.engine.impl.SqlInputValue

 class SqlInputValue
extends java.lang.Object

The entity for a dynamic input value.

Author:
Vladimir Hudec

Nested Class Summary
(package private) static class SqlInputValue.Case
          Enumeration for no/upper/lower case conversion.
 
Field Summary
private  SqlInputValue.Case caseConversion
          Which conversion should be done on inputValue.
private  java.lang.Object identity
          A calculated identity.
private  java.lang.Object inputValue
          A dynamic input value.
(package private)  java.lang.Class<?> inputValueType
          An input value type.
private  java.lang.String likeChar
          A wildcard character for SQL statement like.
(package private)  org.slf4j.Logger logger
          The internal slf4j logger.
private  int minLikeLength
          The minimum length of inputValue to enable likeChar special treatment.
private  java.lang.String sequence
          A database sequence for an identity column.
private  SqlType type
          A dynamic input value type.
 
Constructor Summary
SqlInputValue(java.lang.Object inputValue, java.lang.Class<?> inputValueType, SqlInputValue.Case caseConversion, SqlType type)
          Creates a new instance of this entity.
SqlInputValue(java.lang.Object inputValue, java.lang.Class<?> inputValueType, java.lang.String sequence, SqlType type)
          Creates a new instance of this entity.
 
Method Summary
private  java.lang.String processLike(java.lang.Object val)
          A special treatment of dynamic input value for SQL statement like.
(package private)  void setIdentity(java.lang.String paramName)
          Sets the generated identity value to an input value attribute.
(package private)  void setLike(java.lang.String likeChar, java.lang.Integer minLikeLength)
          Sets a special treatment of dynamic input value
(package private)  void setQueryParam(org.hibernate.Session session, org.hibernate.SQLQuery query, java.lang.String paramName)
          Bind a dynamic input value to a named query parameter.
 java.lang.String toString()
          For debug purposes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

final org.slf4j.Logger logger
The internal slf4j logger.


caseConversion

private SqlInputValue.Case caseConversion
Which conversion should be done on inputValue.


inputValue

private java.lang.Object inputValue
A dynamic input value.


inputValueType

java.lang.Class<?> inputValueType
An input value type.


likeChar

private java.lang.String likeChar
A wildcard character for SQL statement like. It can be added to inputValue as a prefix and/or as a suffix.


minLikeLength

private int minLikeLength
The minimum length of inputValue to enable likeChar special treatment.


type

private SqlType type
A dynamic input value type.


sequence

private java.lang.String sequence
A database sequence for an identity column.


identity

private java.lang.Object identity
A calculated identity.

Constructor Detail

SqlInputValue

SqlInputValue(java.lang.Object inputValue,
              java.lang.Class<?> inputValueType,
              SqlInputValue.Case caseConversion,
              SqlType type)
Creates a new instance of this entity. Used from inside ANTLR parser.

Parameters:
inputValue - a dynamic input value
inputValueType - a dynamic input value type
caseConversion - which conversion should be done on inputValue
type - a META type of a dynamic input value

SqlInputValue

SqlInputValue(java.lang.Object inputValue,
              java.lang.Class<?> inputValueType,
              java.lang.String sequence,
              SqlType type)
Creates a new instance of this entity. Used from inside ANTLR parser.

Parameters:
inputValue - a dynamic input value
inputValueType - a dynamic input value type
sequence - a sequence used to generate an identity value
type - a META type of a dynamic input value
Method Detail

setQueryParam

void setQueryParam(org.hibernate.Session session,
                   org.hibernate.SQLQuery query,
                   java.lang.String paramName)
Bind a dynamic input value to a named query parameter.

Parameters:
session - Hibernate session, first level cache and the SQL query execution context
query - the object-oriented representation of a Hibernate query
paramName - the name of the parameter (= the attribute name)

setIdentity

void setIdentity(java.lang.String paramName)
Sets the generated identity value to an input value attribute.

Parameters:
paramName - the name of the parameter (= the attribute name)

setLike

void setLike(java.lang.String likeChar,
             java.lang.Integer minLikeLength)
Sets a special treatment of dynamic input value

Parameters:
likeChar - a wildcard character
minLikeLength - the minimum length of inputValue to enable likeChar special treatment

processLike

private java.lang.String processLike(java.lang.Object val)
A special treatment of dynamic input value for SQL statement like.

Parameters:
val - the dynamic input value
Returns:
a dynamic input value with a likeChar as a prefix and/or suffix

toString

public java.lang.String toString()
For debug purposes.

Overrides:
toString in class java.lang.Object
Returns:
a String representation for a debug output


Copyright © 2011. All Rights Reserved.