Class JdbcQueryStatement

  • All Implemented Interfaces:
    QueryStatement<java.sql.PreparedStatement,​java.lang.Integer>

    public class JdbcQueryStatement
    extends java.lang.Object
    implements QueryStatement<java.sql.PreparedStatement,​java.lang.Integer>
    A QueryStatement for a SQL PreparedStatement.
    Since:
    1.0.0
    Author:
    graemerocher
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      io.micronaut.core.convert.ConversionService<?> getConversionService()
      Get conversion service.
      QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setArray​(java.sql.PreparedStatement statement, java.lang.Integer name, java.lang.Object array)
      Sets an array value for the given name.
      QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setBigDecimal​(java.sql.PreparedStatement statement, java.lang.Integer name, java.math.BigDecimal bd)
      Write a BigDecimal value for the given name.
      QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setBoolean​(java.sql.PreparedStatement statement, java.lang.Integer name, boolean bool)
      Write a boolean value for the given name.
      QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setByte​(java.sql.PreparedStatement statement, java.lang.Integer name, byte b)
      Write a byte value for the given name.
      QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setBytes​(java.sql.PreparedStatement statement, java.lang.Integer name, byte[] bytes)
      Write a byte[] value for the given name.
      QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setChar​(java.sql.PreparedStatement statement, java.lang.Integer name, char value)
      Write a char value for the given name.
      QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setDate​(java.sql.PreparedStatement statement, java.lang.Integer name, java.util.Date date)
      Write a date value for the given name.
      QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setDouble​(java.sql.PreparedStatement statement, java.lang.Integer name, double d)
      Write a double value for the given name.
      QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setDynamic​(java.sql.PreparedStatement statement, java.lang.Integer index, DataType dataType, java.lang.Object value)
      Write a value dynamically using the result set and the given name and data type.
      QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setFloat​(java.sql.PreparedStatement statement, java.lang.Integer name, float f)
      Write a float value for the given name.
      QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setInt​(java.sql.PreparedStatement statement, java.lang.Integer name, int integer)
      Write a int value for the given name.
      QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setLong​(java.sql.PreparedStatement statement, java.lang.Integer name, long value)
      Write a long value for the given name.
      QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setShort​(java.sql.PreparedStatement statement, java.lang.Integer name, short s)
      Write a short value for the given name.
      QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setString​(java.sql.PreparedStatement statement, java.lang.Integer name, java.lang.String string)
      Write a string value for the given name.
      QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setTimestamp​(java.sql.PreparedStatement statement, java.lang.Integer name, java.time.Instant instant)
      Write an instant value for the given name.
      QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setValue​(java.sql.PreparedStatement statement, java.lang.Integer index, java.lang.Object value)
      Sets the give given object value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JdbcQueryStatement

        public JdbcQueryStatement()
      • JdbcQueryStatement

        public JdbcQueryStatement​(DataConversionService<?> conversionService)
        Constructs a new instance.
        Parameters:
        conversionService - The data conversion service
        Since:
        3.1
    • Method Detail

      • getConversionService

        public io.micronaut.core.convert.ConversionService<?> getConversionService()
        Description copied from interface: QueryStatement
        Get conversion service.
        Specified by:
        getConversionService in interface QueryStatement<java.sql.PreparedStatement,​java.lang.Integer>
        Returns:
        the instance of ConversionService
      • setDynamic

        public QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setDynamic​(@NonNull
                                                                                             java.sql.PreparedStatement statement,
                                                                                             @NonNull
                                                                                             java.lang.Integer index,
                                                                                             @NonNull
                                                                                             DataType dataType,
                                                                                             java.lang.Object value)
        Description copied from interface: QueryStatement
        Write a value dynamically using the result set and the given name and data type.
        Specified by:
        setDynamic in interface QueryStatement<java.sql.PreparedStatement,​java.lang.Integer>
        Parameters:
        statement - The statement
        index - The index
        dataType - The data type
        value - the value
        Returns:
        The writer
      • setTimestamp

        public QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setTimestamp​(java.sql.PreparedStatement statement,
                                                                                               java.lang.Integer name,
                                                                                               java.time.Instant instant)
        Description copied from interface: QueryStatement
        Write an instant value for the given name.
        Specified by:
        setTimestamp in interface QueryStatement<java.sql.PreparedStatement,​java.lang.Integer>
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        instant - The instant
        Returns:
        This writer
      • setValue

        public QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setValue​(java.sql.PreparedStatement statement,
                                                                                           java.lang.Integer index,
                                                                                           java.lang.Object value)
                                                                                    throws DataAccessException
        Description copied from interface: QueryStatement
        Sets the give given object value.
        Specified by:
        setValue in interface QueryStatement<java.sql.PreparedStatement,​java.lang.Integer>
        Parameters:
        statement - The statement
        index - The index
        value - The value
        Returns:
        this writer
        Throws:
        DataAccessException - if the value cannot be read
      • setLong

        @NonNull
        public QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setLong​(java.sql.PreparedStatement statement,
                                                                                          java.lang.Integer name,
                                                                                          long value)
        Description copied from interface: QueryStatement
        Write a long value for the given name.
        Specified by:
        setLong in interface QueryStatement<java.sql.PreparedStatement,​java.lang.Integer>
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        value - The value
        Returns:
        This writer
      • setChar

        @NonNull
        public QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setChar​(java.sql.PreparedStatement statement,
                                                                                          java.lang.Integer name,
                                                                                          char value)
        Description copied from interface: QueryStatement
        Write a char value for the given name.
        Specified by:
        setChar in interface QueryStatement<java.sql.PreparedStatement,​java.lang.Integer>
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        value - The char value
        Returns:
        This writer
      • setDate

        @NonNull
        public QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setDate​(java.sql.PreparedStatement statement,
                                                                                          java.lang.Integer name,
                                                                                          java.util.Date date)
        Description copied from interface: QueryStatement
        Write a date value for the given name.
        Specified by:
        setDate in interface QueryStatement<java.sql.PreparedStatement,​java.lang.Integer>
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        date - The date
        Returns:
        This writer
      • setString

        public QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setString​(java.sql.PreparedStatement statement,
                                                                                            java.lang.Integer name,
                                                                                            java.lang.String string)
        Description copied from interface: QueryStatement
        Write a string value for the given name.
        Specified by:
        setString in interface QueryStatement<java.sql.PreparedStatement,​java.lang.Integer>
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        string - The string
        Returns:
        This writer
      • setInt

        @NonNull
        public QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setInt​(java.sql.PreparedStatement statement,
                                                                                         java.lang.Integer name,
                                                                                         int integer)
        Description copied from interface: QueryStatement
        Write a int value for the given name.
        Specified by:
        setInt in interface QueryStatement<java.sql.PreparedStatement,​java.lang.Integer>
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        integer - The integer
        Returns:
        This writer
      • setBoolean

        @NonNull
        public QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setBoolean​(java.sql.PreparedStatement statement,
                                                                                             java.lang.Integer name,
                                                                                             boolean bool)
        Description copied from interface: QueryStatement
        Write a boolean value for the given name.
        Specified by:
        setBoolean in interface QueryStatement<java.sql.PreparedStatement,​java.lang.Integer>
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        bool - The boolean
        Returns:
        This writer
      • setFloat

        @NonNull
        public QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setFloat​(java.sql.PreparedStatement statement,
                                                                                           java.lang.Integer name,
                                                                                           float f)
        Description copied from interface: QueryStatement
        Write a float value for the given name.
        Specified by:
        setFloat in interface QueryStatement<java.sql.PreparedStatement,​java.lang.Integer>
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        f - The float
        Returns:
        This writer
      • setByte

        @NonNull
        public QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setByte​(java.sql.PreparedStatement statement,
                                                                                          java.lang.Integer name,
                                                                                          byte b)
        Description copied from interface: QueryStatement
        Write a byte value for the given name.
        Specified by:
        setByte in interface QueryStatement<java.sql.PreparedStatement,​java.lang.Integer>
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        b - The byte
        Returns:
        This writer
      • setShort

        @NonNull
        public QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setShort​(java.sql.PreparedStatement statement,
                                                                                           java.lang.Integer name,
                                                                                           short s)
        Description copied from interface: QueryStatement
        Write a short value for the given name.
        Specified by:
        setShort in interface QueryStatement<java.sql.PreparedStatement,​java.lang.Integer>
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        s - The short
        Returns:
        This writer
      • setDouble

        @NonNull
        public QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setDouble​(java.sql.PreparedStatement statement,
                                                                                            java.lang.Integer name,
                                                                                            double d)
        Description copied from interface: QueryStatement
        Write a double value for the given name.
        Specified by:
        setDouble in interface QueryStatement<java.sql.PreparedStatement,​java.lang.Integer>
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        d - The double
        Returns:
        This writer
      • setBigDecimal

        @NonNull
        public QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setBigDecimal​(java.sql.PreparedStatement statement,
                                                                                                java.lang.Integer name,
                                                                                                java.math.BigDecimal bd)
        Description copied from interface: QueryStatement
        Write a BigDecimal value for the given name.
        Specified by:
        setBigDecimal in interface QueryStatement<java.sql.PreparedStatement,​java.lang.Integer>
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        bd - The big decimal
        Returns:
        This writer
      • setBytes

        @NonNull
        public QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setBytes​(java.sql.PreparedStatement statement,
                                                                                           java.lang.Integer name,
                                                                                           byte[] bytes)
        Description copied from interface: QueryStatement
        Write a byte[] value for the given name.
        Specified by:
        setBytes in interface QueryStatement<java.sql.PreparedStatement,​java.lang.Integer>
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        bytes - the bytes
        Returns:
        This writer
      • setArray

        @NonNull
        public QueryStatement<java.sql.PreparedStatement,​java.lang.Integer> setArray​(java.sql.PreparedStatement statement,
                                                                                           java.lang.Integer name,
                                                                                           java.lang.Object array)
        Description copied from interface: QueryStatement
        Sets an array value for the given name.
        Specified by:
        setArray in interface QueryStatement<java.sql.PreparedStatement,​java.lang.Integer>
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        array - the array
        Returns:
        This writer