Class SqlInputValue

    • Field Detail

      • logger

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

        private SqlProcessContext ctx
        the crate for all input parameters and the context of processing.
      • 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.
      • inputName

        private String inputName
        A input attribute name.
      • fullInputName

        private String fullInputName
        A input attribute full name.
      • parentInputValue

        private Object parentInputValue
        A parent of a dynamic input value.
      • inputValueTypes

        Class<?>[] inputValueTypes
        The input value Java types (including parameterized types).
      • 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.
      • replaceChars

        private Map<String,​String> replaceChars
        A map of characters to be replaced in input value;
      • dbIdentityName

        private String dbIdentityName
        A database identity column name
      • inSetOrInsert

        private Boolean inSetOrInsert
        The indicator the input value is bounded to the SET or VALUES fragment of META SQL
    • Constructor Detail

      • SqlInputValue

        SqlInputValue​(SqlProcessContext ctx,
                      SqlInputValue.Type valueType,
                      Object inputValue,
                      Object parentInputValue,
                      SqlInputValue.Code caseConversion,
                      SqlInputValue.Mode inOutMode,
                      SqlType type,
                      String inputName,
                      String fullInputName,
                      Boolean inSetOrInsert,
                      Class<?>... inputValueTypes)
        Creates a new instance of this entity. Used from inside ANTLR parser.
        Parameters:
        ctx - the crate for all input parameters and the context of processing
        valueType - a value type
        inputValue - a dynamic input value
        caseConversion - which conversion should be done on inputValue
        inOutMode - Which mode of callable statement parameter it is
        type - a dynamic input value META type
        inSetOrInsert - an indicator the input value is bounded to the SET or VALUES fragment of META SQL
        inputValueTypes - a dynamic input value Java types (including parameterized types)
      • SqlInputValue

        SqlInputValue​(SqlProcessContext ctx,
                      SqlInputValue.Type valueType,
                      Object inputValue,
                      Object parentInputValue,
                      String sequenceOrIdentitySelect,
                      SqlType type,
                      String dbIdentityName,
                      Class<?>... inputValueTypes)
        Creates a new instance of this entity. Used from inside ANTLR parser.
        Parameters:
        ctx - the crate for all input parameters and the context of processing
        valueType - a value type
        inputValue - a dynamic input value
        sequenceOrIdentitySelect - a sequence or select command used to generate an identity value
        type - a dynamic input value META type
        inputValueTypes - a dynamic input value Java types (including parameterized types)
      • SqlInputValue

        SqlInputValue​(SqlProcessContext ctx,
                      String name,
                      SqlInputValue sqlInputValue,
                      Object dynamicInputValues)
        Creates a new instance of this entity.
        Parameters:
        ctx - the crate for all input parameters and the context of processing
        name - the name og the attribute
        sqlInputValue - SqlInputValue instance to clone
        dynamicInputValues - the SQL statement dynamic parameters (input values)
    • Method Detail

      • setQueryParam

        void setQueryParam​(SqlTypeFactory typeFactory,
                           SqlSession session,
                           SqlQuery query,
                           String paramName)
                    throws SqlRuntimeException
        Bind a dynamic input value to a named query parameter.
        Parameters:
        typeFactory - the SQL Type factory
        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 a 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
      • setReplaceChars

        void setReplaceChars​(Map<String,​String> replaceChars)
        Sets a special treatment of a dynamic input value.
        Parameters:
        replaceChars - a map of characters to be replaced in input value
      • processLike

        private String processLike​(Object val)
        A special treatment of dynamic input value for SQL command LIKE.
        Parameters:
        val - a dynamic input value
        Returns:
        a dynamic input value with a likeChar as a prefix and/or suffix
      • processReplaceChars

        private String processReplaceChars​(Object val)
        A special treatment of dynamic input value for SQL command LIKE.
        Parameters:
        val - a dynamic input value
        Returns:
        a dynamic input value with replaced characters
      • getInputValue

        Object getInputValue()
        Returns a dynamic input value.
        Returns:
        a dynamic input value
      • getInputName

        String getInputName()
        Returns a input attribute name.
        Returns:
        a input attribute name
      • getParentInputValue

        Object getParentInputValue()
        Returns a parent of a dynamic input value.
        Returns:
        a parent of a dynamic input value
      • getDbIdentityName

        public String getDbIdentityName()
        Returns a database identity column name.
        Returns:
        a database identity column name
      • getInSetOrInsert

        public Boolean getInSetOrInsert()
        Returns the indicator the input value is bounded to the SET or VALUES fragment of META SQL
        Returns:
        the indicator the input value is bounded to the SET or VALUES fragment of META SQL
      • toString

        public String toString()
        For debug purposes.
        Overrides:
        toString in class Object
        Returns:
        a String representation for a debug output