Interface QueryStatement<PS,​IDX>

  • Type Parameters:
    PS - The statement type
    IDX - The index type
    All Known Implementing Classes:
    JdbcQueryStatement, R2dbcQueryStatement

    public interface QueryStatement<PS,​IDX>
    An abstract interface over prepared statements.
    • Method Detail

      • setValue

        QueryStatement<PS,​IDX> setValue​(PS statement,
                                              IDX index,
                                              java.lang.Object value)
                                       throws DataAccessException
        Sets the give given object value.
        Parameters:
        statement - The statement
        index - The index
        value - The value
        Returns:
        this writer
        Throws:
        DataAccessException - if the value cannot be read
      • setDynamic

        default QueryStatement<PS,​IDX> setDynamic​(@NonNull
                                                        PS statement,
                                                        @NonNull
                                                        IDX index,
                                                        @NonNull
                                                        DataType dataType,
                                                        java.lang.Object value)
        Write a value dynamically using the result set and the given name and data type.
        Parameters:
        statement - The statement
        index - The index
        dataType - The data type
        value - the value
        Returns:
        The writer
        Throws:
        DataAccessException - if the value cannot be read
      • convertRequired

        @Nullable
        default <T> T convertRequired​(@Nullable
                                      java.lang.Object value,
                                      java.lang.Class<T> type)
        Convert the value to the given type.
        Type Parameters:
        T - The generic type
        Parameters:
        value - The value
        type - The type
        Returns:
        The converted value
        Throws:
        DataAccessException - if the value cannot be converted
      • setLong

        @NonNull
        default QueryStatement<PS,​IDX> setLong​(PS statement,
                                                     IDX name,
                                                     long value)
        Write a long value for the given name.
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        value - The value
        Returns:
        This writer
      • setChar

        @NonNull
        default QueryStatement<PS,​IDX> setChar​(PS statement,
                                                     IDX name,
                                                     char value)
        Write a char value for the given name.
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        value - The char value
        Returns:
        This writer
      • setDate

        @NonNull
        default QueryStatement<PS,​IDX> setDate​(PS statement,
                                                     IDX name,
                                                     java.util.Date date)
        Write a date value for the given name.
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        date - The date
        Returns:
        This writer
      • setTimestamp

        @Deprecated
        @NonNull
        default QueryStatement<PS,​IDX> setTimestamp​(PS statement,
                                                          IDX name,
                                                          java.util.Date date)
        Write a date value for the given name.
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        date - The date
        Returns:
        This writer
      • setTimestamp

        @NonNull
        default QueryStatement<PS,​IDX> setTimestamp​(PS statement,
                                                          IDX name,
                                                          java.time.Instant instant)
        Write an instant value for the given name.
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        instant - The instant
        Returns:
        This writer
        Since:
        3.4.2
      • setString

        default QueryStatement<PS,​IDX> setString​(PS statement,
                                                       IDX name,
                                                       java.lang.String string)
        Write a string value for the given name.
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        string - The string
        Returns:
        This writer
      • setInt

        @NonNull
        default QueryStatement<PS,​IDX> setInt​(PS statement,
                                                    IDX name,
                                                    int integer)
        Write a int value for the given name.
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        integer - The integer
        Returns:
        This writer
      • setBoolean

        @NonNull
        default QueryStatement<PS,​IDX> setBoolean​(PS statement,
                                                        IDX name,
                                                        boolean bool)
        Write a boolean value for the given name.
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        bool - The boolean
        Returns:
        This writer
      • setFloat

        @NonNull
        default QueryStatement<PS,​IDX> setFloat​(PS statement,
                                                      IDX name,
                                                      float f)
        Write a float value for the given name.
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        f - The float
        Returns:
        This writer
      • setByte

        @NonNull
        default QueryStatement<PS,​IDX> setByte​(PS statement,
                                                     IDX name,
                                                     byte b)
        Write a byte value for the given name.
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        b - The byte
        Returns:
        This writer
      • setShort

        @NonNull
        default QueryStatement<PS,​IDX> setShort​(PS statement,
                                                      IDX name,
                                                      short s)
        Write a short value for the given name.
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        s - The short
        Returns:
        This writer
      • setDouble

        @NonNull
        default QueryStatement<PS,​IDX> setDouble​(PS statement,
                                                       IDX name,
                                                       double d)
        Write a double value for the given name.
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        d - The double
        Returns:
        This writer
      • setBigDecimal

        @NonNull
        default QueryStatement<PS,​IDX> setBigDecimal​(PS statement,
                                                           IDX name,
                                                           java.math.BigDecimal bd)
        Write a BigDecimal value for the given name.
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        bd - The big decimal
        Returns:
        This writer
      • setBytes

        @NonNull
        default QueryStatement<PS,​IDX> setBytes​(PS statement,
                                                      IDX name,
                                                      byte[] bytes)
        Write a byte[] value for the given name.
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        bytes - the bytes
        Returns:
        This writer
      • setArray

        @NonNull
        default QueryStatement<PS,​IDX> setArray​(PS statement,
                                                      IDX name,
                                                      java.lang.Object array)
        Sets an array value for the given name.
        Parameters:
        statement - The statement
        name - The name (such as the column name)
        array - the array
        Returns:
        This writer
      • getConversionService

        default io.micronaut.core.convert.ConversionService<?> getConversionService()
        Get conversion service.
        Returns:
        the instance of ConversionService