Top Description Constructors Methods
liquibase.executor.jvm

pack-priv abstract Class StatementCreatorUtils

extends Object
Class Inheritance
Imports
java.io.StringWriter, java.math.BigDecimal, java.sql.PreparedStatement, .SQLException, .Types, java.util.Calendar

Utility methods for PreparedStatementSetter/Creator and CallableStatementCreator implementations, providing sophisticated parameter management (including support for LOB values).

Used by PreparedStatementCreatorFactory and CallableStatementCreatorFactory, but also available for direct use in custom setter/creator implementations.

Author
Spring Framework
See Also
PreparedStatementSetter, SqlParameter

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static boolean
isDateValue(Object inValue)

Check whether the given value is a java.util.Date (but not one of the JDBC-specific subclasses).

private static boolean
isStringValue(Object inValue)

Check whether the given value can be treated as a String value.

public static void
setParameterValue(PreparedStatement
the prepared statement or callable statement
ps
,
int
index of the parameter we are setting
paramIndex
,
SqlParameter
the parameter as it is declared including type
param
,
Object
the value to set
inValue
)

Set the value for a parameter.

public static void
setParameterValue(PreparedStatement
the prepared statement or callable statement
ps
,
int
index of the parameter we are setting
paramIndex
,
int
the SQL type of the parameter
sqlType
,
Object
the value to set (plain value or a SqlTypeValue)
inValue
)

Set the value for a parameter.

private static void
setParameterValueInternal(PreparedStatement
the prepared statement or callable statement
ps
,
int
index of the parameter we are setting
paramIndex
,
int
the SQL type of the parameter
sqlType
,
String
the type name of the parameter (optional, only used for SQL NULL and SqlTypeValue)
typeName
,
Integer
the number of digits after the decimal point (for DECIMAL and NUMERIC types)
scale
,
Object
the value to set (plain value or a SqlTypeValue)
inValue
)

Set the value for a parameter.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

StatementCreatorUtilsback to summary
pack-priv StatementCreatorUtils()

Method Detail

isDateValueback to summary
private static boolean isDateValue(Object inValue)

Check whether the given value is a java.util.Date (but not one of the JDBC-specific subclasses).

isStringValueback to summary
private static boolean isStringValue(Object inValue)

Check whether the given value can be treated as a String value.

setParameterValueback to summary
public static void setParameterValue(PreparedStatement ps, int paramIndex, SqlParameter param, Object inValue) throws SQLException

Set the value for a parameter. The method used is based on the SQL type of the parameter and we can handle complex types like arrays and LOBs.

Parameters
ps:PreparedStatement

the prepared statement or callable statement

paramIndex:int

index of the parameter we are setting

param:SqlParameter

the parameter as it is declared including type

inValue:Object

the value to set

Exceptions
SQLException:
if thrown by PreparedStatement methods
setParameterValueback to summary
public static void setParameterValue(PreparedStatement ps, int paramIndex, int sqlType, Object inValue) throws SQLException

Set the value for a parameter. The method used is based on the SQL type of the parameter and we can handle complex types like arrays and LOBs.

Parameters
ps:PreparedStatement

the prepared statement or callable statement

paramIndex:int

index of the parameter we are setting

sqlType:int

the SQL type of the parameter

inValue:Object

the value to set (plain value or a SqlTypeValue)

Exceptions
SQLException:
if thrown by PreparedStatement methods
setParameterValueInternalback to summary
private static void setParameterValueInternal(PreparedStatement ps, int paramIndex, int sqlType, String typeName, Integer scale, Object inValue) throws SQLException

Set the value for a parameter. The method used is based on the SQL type of the parameter and we can handle complex types like arrays and LOBs.

Parameters
ps:PreparedStatement

the prepared statement or callable statement

paramIndex:int

index of the parameter we are setting

sqlType:int

the SQL type of the parameter

typeName:String

the type name of the parameter (optional, only used for SQL NULL and SqlTypeValue)

scale:Integer

the number of digits after the decimal point (for DECIMAL and NUMERIC types)

inValue:Object

the value to set (plain value or a SqlTypeValue)

Exceptions
SQLException:
if thrown by PreparedStatement methods