Class JdbcUtil
java.lang.Object
org.huiche.jdbc.support.JdbcUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> voidapplyParameter(PreparedStatement ps, int parameterIndex, T val, Configuration configuration) 设置ps的参数static voidapplyParameters(PreparedStatement ps, List<?> params, Configuration configuration) 批量设置ps的参数, 如果为null直接设置nullstatic void关闭结果集static void关闭ps对象static <T> TresolveColumnVal(Type type, ResultSet rs, int columnIndex, Configuration configuration) 解析列的值static <T> TresolveColumnVal(Type type, ResultSet rs, int columnIndex, Configuration configuration, boolean handleNull) 解析列的值static <T> Stream<T> stream(ResultSet rs, Configuration configuration, RowMapper<T> rowMapper, Integer estimateSize, Runnable onClose) 构建stream查询
-
Method Details
-
applyParameter
public static <T> void applyParameter(PreparedStatement ps, int parameterIndex, T val, Configuration configuration) throws SQLException 设置ps的参数- Type Parameters:
T- 参数类型- Parameters:
ps- ps对象parameterIndex- 参数下标val- 值configuration- 配置- Throws:
SQLException- SQL异常HcJdbcException- 如果遇到无法写入的类型的值且未提供对应转换器
-
applyParameters
public static void applyParameters(PreparedStatement ps, List<?> params, Configuration configuration) throws SQLException 批量设置ps的参数, 如果为null直接设置null- Parameters:
ps- ps对象params- 参数configuration- 配置- Throws:
SQLException- SQL异常
-
closeResultSet
-
closeStatement
-
resolveColumnVal
public static <T> T resolveColumnVal(Type type, ResultSet rs, int columnIndex, Configuration configuration) throws SQLException 解析列的值- Type Parameters:
T- 列的类型- Parameters:
type- 列类型rs- jdbc结果集columnIndex- 列下标,从1开始configuration- 配置- Returns:
- 列的值
- Throws:
SQLException- 原生sql异常HcJdbcException- 如果遇到无法解析类型的且未提供对应转换器
-
resolveColumnVal
public static <T> T resolveColumnVal(Type type, ResultSet rs, int columnIndex, Configuration configuration, boolean handleNull) throws SQLException 解析列的值- Type Parameters:
T- 列的类型- Parameters:
type- 列类型rs- jdbc结果集columnIndex- 列下标,从1开始configuration- 配置handleNull- 是否处理null值为空集合|数组|map- Returns:
- 列的值
- Throws:
SQLException- 原生sql异常HcJdbcException- 如果遇到无法解析类型的且未提供对应转换器
-
stream
-