Class Expression

    • Constructor Summary

      Constructors 
      Constructor Description
      Expression​(java.lang.String expression, java.lang.Object... values)
      Create a new expression with multiple IN parameters
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Expression in​(java.lang.Object value)
      Add a new IN parameter
      Expression inOut​(java.lang.Object value, int type)
      Add a new IN/OUT parameter
      Expression out​(int type)
      Add a new OUT parameter
      java.lang.String preparedString​(QueryOptions options)
      Turns this expression into a string with value placeholders for query preparation
      Query query()
      Returns the Query representation of this builder instance
      Expression setIn​(int index, java.lang.Object value)
      Sets a parameter to be an IN parameter.
      Expression setInOut​(int index, java.lang.Object value, int type)
      Sets a parameter to be an IN/OUT parameter.
      Expression setIns​(java.lang.Object... values)
      Set multiple parameters to be IN parameters.
      Expression setOut​(int index, int type)
      Sets a parameter to be an OUT parameter.
      Expression setOuts​(java.lang.Integer... types)
      Set multiple parameters to be OUT parameters.
      java.lang.String string​(QueryOptions options)
      Transforms this statement into an SQL string
      java.lang.String string​(QueryOptions options, boolean prepare)
      Turns this expression into a string.
      java.lang.String toString()  
      java.lang.String valueString​(QueryOptions options)
      Turns this expression into a string with the passed values inserted.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface com.github.eikecochu.sqlbuilder.QueryPart

        string
    • Constructor Detail

      • Expression

        public Expression​(java.lang.String expression,
                          java.lang.Object... values)
        Create a new expression with multiple IN parameters
        Parameters:
        expression - The expression
        values - The input parameters
    • Method Detail

      • in

        public Expression in​(java.lang.Object value)
        Add a new IN parameter
        Parameters:
        value - the IN parameter value
        Returns:
        this instance
      • out

        public Expression out​(int type)
        Add a new OUT parameter
        Parameters:
        type - the OUT parameter data type
        Returns:
        this instance
      • inOut

        public Expression inOut​(java.lang.Object value,
                                int type)
        Add a new IN/OUT parameter
        Parameters:
        value - the IN parameter value
        type - the OUT parameter data type
        Returns:
        this instance
      • setIn

        public Expression setIn​(int index,
                                java.lang.Object value)
        Sets a parameter to be an IN parameter. If it does not exist, parameters will be added automatically until it exists.
        Parameters:
        index - the parameter index, starting at 0
        value - the IN parameter value
        Returns:
        this instance
      • setIns

        public Expression setIns​(java.lang.Object... values)
        Set multiple parameters to be IN parameters. The index is taken from the position of the passed parameters.
        Parameters:
        values - the IN parameter value
        Returns:
        this instance
      • setOut

        public Expression setOut​(int index,
                                 int type)
        Sets a parameter to be an OUT parameter. If it does not exist, parameters will be added automatically until it exists.
        Parameters:
        index - the parameter index, starting at 0
        type - the OUT parameter data type
        Returns:
        this instance
      • setOuts

        public Expression setOuts​(java.lang.Integer... types)
        Set multiple parameters to be OUT parameters. The index is taken from the position of the passed parameters
        Parameters:
        types - the OUT parameter data types
        Returns:
        this instance
      • setInOut

        public Expression setInOut​(int index,
                                   java.lang.Object value,
                                   int type)
        Sets a parameter to be an IN/OUT parameter. If it does not exist, parameters will be added automatically until it exists.
        Parameters:
        index - the parameter index, starting at 0
        value - the IN parameter value
        type - the OUT parameter data type
        Returns:
        this instance
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • string

        public java.lang.String string​(QueryOptions options)
        Description copied from interface: QueryPart
        Transforms this statement into an SQL string
        Specified by:
        string in interface QueryPart
        Parameters:
        options - The QueryOptions to apply for transformation
        Returns:
        The created SQL string
      • string

        public java.lang.String string​(QueryOptions options,
                                       boolean prepare)
        Turns this expression into a string. Will replace values by placeholders if prepare is true, else it will insert the passed values.
        Parameters:
        options - The QueryOptions
        prepare - True to insert value placeholders, false to insert values
        Returns:
        The created string
      • preparedString

        public java.lang.String preparedString​(QueryOptions options)
        Turns this expression into a string with value placeholders for query preparation
        Parameters:
        options - The QueryOptions
        Returns:
        The created string
      • valueString

        public java.lang.String valueString​(QueryOptions options)
        Turns this expression into a string with the passed values inserted.
        Parameters:
        options - The QueryOptions
        Returns:
        The created string
      • query

        public Query query()
        Description copied from interface: QueryBuilder
        Returns the Query representation of this builder instance
        Specified by:
        query in interface QueryBuilder<Expression>
        Returns:
        The Query representation