org.sqlproc.engine.impl
Class SqlInputValue

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

 class SqlInputValue
extends Object

The entity for a dynamic input value.

Author:
Vladimir Hudec

Nested Class Summary
(package private) static class SqlInputValue.Code
          Enumeration for no/upper/lower case conversion.
(package private) static class SqlInputValue.Mode
          Enumeration for IN/OUT/INOUT mode of callable statement parameter.
(package private) static class SqlInputValue.Type
          Enumeration for the type of input value.
 
Field Summary
private  SqlInputValue.Code caseConversion
          Which conversion should be done on inputValue.
private  Object identity
          A calculated identity.
private  String identitySelect
          An SQL select for an identity column.
private  SqlInputValue.Mode inOutMode
          Which mode of callable statement parameter it is.
private  Object inputValue
          A dynamic input value.
(package private)  Class<?> inputValueType
          The input value Java type.
private  String likeChar
          A wildcard character for the SQL command 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  Object outValue
          A dynamic input value can be also an output value.
private  Object parentInputValue
          A parent of a dynamic input value.
private  boolean partialLike
          a wildcard character is going to be only a postfix
private  String sequence
          A database sequence for an identity column.
private  SqlType type
          The input value META type.
private  SqlInputValue.Type valueType
          The type of the input value, please see SqlInputValue.Type.
 
Constructor Summary
SqlInputValue(SqlInputValue.Type valueType, Object inputValue, Object parentInputValue, Class<?> inputValueType, SqlInputValue.Code caseConversion, SqlInputValue.Mode inOutMode, SqlType type)
          Creates a new instance of this entity.
SqlInputValue(SqlInputValue.Type valueType, Object inputValue, Object parentInputValue, Class<?> inputValueType, String sequenceOrIdentitySelect, SqlType type)
          Creates a new instance of this entity.
 
Method Summary
private  String processLike(Object val)
          A special treatment of dynamic input value for SQL comman LIKE.
(package private)  void setIdentityResult(String paramName)
          Sets the generated identity value to an input value attribute.
(package private)  void setLike(String likeChar, Integer minLikeLength, boolean partialLike)
          Sets a special treatment of dynamic input value.
(package private)  void setOutValueResult(String paramName)
          Sets the OUT/INOUT value to an input value attribute.
(package private)  void setQueryParam(SqlSession session, SqlQuery query, String paramName)
          Bind a dynamic input value to a named query parameter.
 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.


valueType

private SqlInputValue.Type valueType
The type of the input value, please see SqlInputValue.Type.


caseConversion

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


inOutMode

private SqlInputValue.Mode inOutMode
Which mode of callable statement parameter it is.


inputValue

private Object inputValue
A dynamic input value.


parentInputValue

private Object parentInputValue
A parent of a dynamic input value.


inputValueType

Class<?> inputValueType
The input value Java type.


likeChar

private String likeChar
A wildcard character for the SQL command 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.


partialLike

private boolean partialLike
a wildcard character is going to be only a postfix


type

private SqlType type
The input value META type.


sequence

private String sequence
A database sequence for an identity column.


identitySelect

private String identitySelect
An SQL select for an identity column.


identity

private Object identity
A calculated identity.


outValue

private Object outValue
A dynamic input value can be also an output value.

Constructor Detail

SqlInputValue

SqlInputValue(SqlInputValue.Type valueType,
              Object inputValue,
              Object parentInputValue,
              Class<?> inputValueType,
              SqlInputValue.Code caseConversion,
              SqlInputValue.Mode inOutMode,
              SqlType type)
Creates a new instance of this entity. Used from inside ANTLR parser.

Parameters:
valueType - a value type
inputValue - a dynamic input value
inputValueType - a dynamic input value Java type
caseConversion - which conversion should be done on inputValue
inOutMode - Which mode of callable statement parameter it is
type - a dynamic input value META type

SqlInputValue

SqlInputValue(SqlInputValue.Type valueType,
              Object inputValue,
              Object parentInputValue,
              Class<?> inputValueType,
              String sequenceOrIdentitySelect,
              SqlType type)
Creates a new instance of this entity. Used from inside ANTLR parser.

Parameters:
valueType - a value type
inputValue - a dynamic input value
inputValueType - a dynamic input value Java type
sequenceOrIdentitySelect - a sequence or select command used to generate an identity value
type - a dynamic input value META type
Method Detail

setQueryParam

void setQueryParam(SqlSession session,
                   SqlQuery query,
                   String paramName)
             throws SqlRuntimeException
Bind a dynamic input value to a named query parameter.

Parameters:
session - the SQL Engine session, an adapter or proxy to the internal JDBC or ORM staff
query - the SQL Engine query, an adapter or proxy to the internal JDBC or ORM staff
paramName - the name of the parameter (= the attribute name)
Throws:
SqlRuntimeException - in the case of any problem with input values handling

setIdentityResult

void setIdentityResult(String paramName)
                 throws SqlRuntimeException
Sets the generated identity value to an input value attribute.

Parameters:
paramName - the name of the parameter (= the attribute name)
Throws:
SqlRuntimeException - in the case of any problem with output values handling

setOutValueResult

void setOutValueResult(String paramName)
                 throws SqlRuntimeException
Sets the OUT/INOUT value to an input value attribute.

Parameters:
paramName - the name of the parameter (= the attribute name)
Throws:
SqlRuntimeException - in the case of any problem with output values handling

setLike

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

Parameters:
likeChar - a wildcard character
minLikeLength - the minimum length of inputValue to enable likeChar special treatment
partialLike - a wildcard character is going to be only a postfix

processLike

private String processLike(Object val)
A special treatment of dynamic input value for SQL comman LIKE.

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

toString

public String toString()
For debug purposes.

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


Copyright © 2013. All Rights Reserved.