Package guru.mikelue.jdut.jdbc.util
Class PreparedStatements
- java.lang.Object
-
- guru.mikelue.jdut.jdbc.util.PreparedStatements
-
public final class PreparedStatements extends Object
Utility forPreparedStatement.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidsetParameter(PreparedStatement statement, DataRow dataRow, String columnName, int paramIndex)Sets a parameter over statement byDataRow.static voidsetParameter(PreparedStatement statement, Object data, JDBCType jdbcType, int paramIndex)Sets a parameter over statement by data.
-
-
-
Method Detail
-
setParameter
public static void setParameter(PreparedStatement statement, DataRow dataRow, String columnName, int paramIndex) throws SQLException
Sets a parameter over statement byDataRow.- Parameters:
statement- The statement to be setdataRow- The data row to be used over statementcolumnName- The name of column to be setparamIndex- The index of parameter- Throws:
SQLException- The exception of SQL- See Also:
setParameter(PreparedStatement, Object, JDBCType, int)
-
setParameter
public static void setParameter(PreparedStatement statement, Object data, JDBCType jdbcType, int paramIndex) throws SQLException
Sets a parameter over statement by data.- This method chooses the corresponding setXXX method of
PreparedStatementby the type of data. - If the type of data cannot be determined, the method of
PreparedStatement.setObject(int, Object)would be used. - For null value,
PreparedStatement.setNullwould be used
java.util.Date
The object ofDatewould usePreparedStatement.setTimestamp(int, java.sql.Timestamp)to set parameter.- Parameters:
statement- The statement to be setjdbcType- The type of JDBC, currently this parameter is used to determine setXXX forStringvaluedata- The dataparamIndex- The index of parameter- Throws:
SQLException- The exception of SQL
- This method chooses the corresponding setXXX method of
-
-