Package io.micronaut.data.jdbc.mapper
Class JdbcQueryStatement
java.lang.Object
io.micronaut.data.jdbc.mapper.JdbcQueryStatement
- All Implemented Interfaces:
QueryStatement<PreparedStatement,
Integer>
A
QueryStatement
for a SQL PreparedStatement
.- Since:
- 1.0.0
- Author:
- graemerocher
-
Constructor Summary
ConstructorDescriptionJdbcQueryStatement
(DataConversionService conversionService) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic int
findSqlType
(@NonNull DataType dataType) Find the SQL type fromDataType
.io.micronaut.core.convert.ConversionService
Get conversion service.@NonNull QueryStatement<PreparedStatement,
Integer> setArray
(PreparedStatement statement, Integer name, Object array) Sets an array value for the given name.@NonNull QueryStatement<PreparedStatement,
Integer> setBigDecimal
(PreparedStatement statement, Integer name, BigDecimal bd) Write a BigDecimal value for the given name.@NonNull QueryStatement<PreparedStatement,
Integer> setBoolean
(PreparedStatement statement, Integer name, boolean bool) Write a boolean value for the given name.@NonNull QueryStatement<PreparedStatement,
Integer> setByte
(PreparedStatement statement, Integer name, byte b) Write a byte value for the given name.@NonNull QueryStatement<PreparedStatement,
Integer> setBytes
(PreparedStatement statement, Integer name, byte[] bytes) Write a byte[] value for the given name.@NonNull QueryStatement<PreparedStatement,
Integer> setChar
(PreparedStatement statement, Integer name, char value) Write a char value for the given name.@NonNull QueryStatement<PreparedStatement,
Integer> setDate
(PreparedStatement statement, Integer name, Date date) Write a date value for the given name.@NonNull QueryStatement<PreparedStatement,
Integer> setDouble
(PreparedStatement statement, Integer name, double d) Write a double value for the given name.setDynamic
(@NonNull PreparedStatement statement, @NonNull Integer index, @NonNull DataType dataType, Object value) Write a value dynamically using the result set and the given name and data type.@NonNull QueryStatement<PreparedStatement,
Integer> setFloat
(PreparedStatement statement, Integer name, float f) Write a float value for the given name.@NonNull QueryStatement<PreparedStatement,
Integer> setInt
(PreparedStatement statement, Integer name, int integer) Write a int value for the given name.@NonNull QueryStatement<PreparedStatement,
Integer> setLong
(PreparedStatement statement, Integer name, long value) Write a long value for the given name.@NonNull QueryStatement<PreparedStatement,
Integer> setShort
(PreparedStatement statement, Integer name, short s) Write a short value for the given name.setString
(PreparedStatement statement, Integer name, String string) Write a string value for the given name.setTime
(PreparedStatement statement, Integer name, Time instant) Write an instant value for the given name.setTimestamp
(PreparedStatement statement, Integer name, Instant instant) Write an instant value for the given name.setValue
(PreparedStatement statement, Integer index, 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
Methods inherited from interface io.micronaut.data.runtime.mapper.QueryStatement
convertRequired
-
Constructor Details
-
JdbcQueryStatement
public JdbcQueryStatement() -
JdbcQueryStatement
Constructs a new instance.- Parameters:
conversionService
- The data conversion service- Since:
- 3.1
-
-
Method Details
-
findSqlType
Find the SQL type fromDataType
.- Parameters:
dataType
- The data type- Returns:
- The SQL type
-
getConversionService
public io.micronaut.core.convert.ConversionService getConversionService()Description copied from interface:QueryStatement
Get conversion service.- Specified by:
getConversionService
in interfaceQueryStatement<PreparedStatement,
Integer> - Returns:
- the instance of
ConversionService
-
setDynamic
public QueryStatement<PreparedStatement,Integer> setDynamic(@NonNull @NonNull PreparedStatement statement, @NonNull @NonNull Integer index, @NonNull @NonNull DataType dataType, 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 interfaceQueryStatement<PreparedStatement,
Integer> - Parameters:
statement
- The statementindex
- The indexdataType
- The data typevalue
- the value- Returns:
- The writer
-
setTimestamp
public QueryStatement<PreparedStatement,Integer> setTimestamp(PreparedStatement statement, Integer name, Instant instant) Description copied from interface:QueryStatement
Write an instant value for the given name.- Specified by:
setTimestamp
in interfaceQueryStatement<PreparedStatement,
Integer> - Parameters:
statement
- The statementname
- The name (such as the column name)instant
- The instant- Returns:
- This writer
-
setTime
public QueryStatement<PreparedStatement,Integer> setTime(PreparedStatement statement, Integer name, Time instant) Description copied from interface:QueryStatement
Write an instant value for the given name.- Specified by:
setTime
in interfaceQueryStatement<PreparedStatement,
Integer> - Parameters:
statement
- The statementname
- The name (such as the column name)instant
- The time- Returns:
- This writer
-
setValue
public QueryStatement<PreparedStatement,Integer> setValue(PreparedStatement statement, Integer index, Object value) throws DataAccessException Description copied from interface:QueryStatement
Sets the give given object value.- Specified by:
setValue
in interfaceQueryStatement<PreparedStatement,
Integer> - Parameters:
statement
- The statementindex
- The indexvalue
- The value- Returns:
- this writer
- Throws:
DataAccessException
- if the value cannot be read
-
setLong
@NonNull public @NonNull QueryStatement<PreparedStatement,Integer> setLong(PreparedStatement statement, Integer name, long value) Description copied from interface:QueryStatement
Write a long value for the given name.- Specified by:
setLong
in interfaceQueryStatement<PreparedStatement,
Integer> - Parameters:
statement
- The statementname
- The name (such as the column name)value
- The value- Returns:
- This writer
-
setChar
@NonNull public @NonNull QueryStatement<PreparedStatement,Integer> setChar(PreparedStatement statement, Integer name, char value) Description copied from interface:QueryStatement
Write a char value for the given name.- Specified by:
setChar
in interfaceQueryStatement<PreparedStatement,
Integer> - Parameters:
statement
- The statementname
- The name (such as the column name)value
- The char value- Returns:
- This writer
-
setDate
@NonNull public @NonNull QueryStatement<PreparedStatement,Integer> setDate(PreparedStatement statement, Integer name, Date date) Description copied from interface:QueryStatement
Write a date value for the given name.- Specified by:
setDate
in interfaceQueryStatement<PreparedStatement,
Integer> - Parameters:
statement
- The statementname
- The name (such as the column name)date
- The date- Returns:
- This writer
-
setString
public QueryStatement<PreparedStatement,Integer> setString(PreparedStatement statement, Integer name, String string) Description copied from interface:QueryStatement
Write a string value for the given name.- Specified by:
setString
in interfaceQueryStatement<PreparedStatement,
Integer> - Parameters:
statement
- The statementname
- The name (such as the column name)string
- The string- Returns:
- This writer
-
setInt
@NonNull public @NonNull QueryStatement<PreparedStatement,Integer> setInt(PreparedStatement statement, Integer name, int integer) Description copied from interface:QueryStatement
Write a int value for the given name.- Specified by:
setInt
in interfaceQueryStatement<PreparedStatement,
Integer> - Parameters:
statement
- The statementname
- The name (such as the column name)integer
- The integer- Returns:
- This writer
-
setBoolean
@NonNull public @NonNull QueryStatement<PreparedStatement,Integer> setBoolean(PreparedStatement statement, Integer name, boolean bool) Description copied from interface:QueryStatement
Write a boolean value for the given name.- Specified by:
setBoolean
in interfaceQueryStatement<PreparedStatement,
Integer> - Parameters:
statement
- The statementname
- The name (such as the column name)bool
- The boolean- Returns:
- This writer
-
setFloat
@NonNull public @NonNull QueryStatement<PreparedStatement,Integer> setFloat(PreparedStatement statement, Integer name, float f) Description copied from interface:QueryStatement
Write a float value for the given name.- Specified by:
setFloat
in interfaceQueryStatement<PreparedStatement,
Integer> - Parameters:
statement
- The statementname
- The name (such as the column name)f
- The float- Returns:
- This writer
-
setByte
@NonNull public @NonNull QueryStatement<PreparedStatement,Integer> setByte(PreparedStatement statement, Integer name, byte b) Description copied from interface:QueryStatement
Write a byte value for the given name.- Specified by:
setByte
in interfaceQueryStatement<PreparedStatement,
Integer> - Parameters:
statement
- The statementname
- The name (such as the column name)b
- The byte- Returns:
- This writer
-
setShort
@NonNull public @NonNull QueryStatement<PreparedStatement,Integer> setShort(PreparedStatement statement, Integer name, short s) Description copied from interface:QueryStatement
Write a short value for the given name.- Specified by:
setShort
in interfaceQueryStatement<PreparedStatement,
Integer> - Parameters:
statement
- The statementname
- The name (such as the column name)s
- The short- Returns:
- This writer
-
setDouble
@NonNull public @NonNull QueryStatement<PreparedStatement,Integer> setDouble(PreparedStatement statement, Integer name, double d) Description copied from interface:QueryStatement
Write a double value for the given name.- Specified by:
setDouble
in interfaceQueryStatement<PreparedStatement,
Integer> - Parameters:
statement
- The statementname
- The name (such as the column name)d
- The double- Returns:
- This writer
-
setBigDecimal
@NonNull public @NonNull QueryStatement<PreparedStatement,Integer> setBigDecimal(PreparedStatement statement, Integer name, BigDecimal bd) Description copied from interface:QueryStatement
Write a BigDecimal value for the given name.- Specified by:
setBigDecimal
in interfaceQueryStatement<PreparedStatement,
Integer> - Parameters:
statement
- The statementname
- The name (such as the column name)bd
- The big decimal- Returns:
- This writer
-
setBytes
@NonNull public @NonNull QueryStatement<PreparedStatement,Integer> setBytes(PreparedStatement statement, Integer name, byte[] bytes) Description copied from interface:QueryStatement
Write a byte[] value for the given name.- Specified by:
setBytes
in interfaceQueryStatement<PreparedStatement,
Integer> - Parameters:
statement
- The statementname
- The name (such as the column name)bytes
- the bytes- Returns:
- This writer
-
setArray
@NonNull public @NonNull QueryStatement<PreparedStatement,Integer> setArray(PreparedStatement statement, Integer name, Object array) Description copied from interface:QueryStatement
Sets an array value for the given name.- Specified by:
setArray
in interfaceQueryStatement<PreparedStatement,
Integer> - Parameters:
statement
- The statementname
- The name (such as the column name)array
- the array- Returns:
- This writer
-