deprecated code

This commit is contained in:
looly 2021-11-24 09:53:34 +08:00
parent 1e82d7bd5f
commit 3a043a261e
3 changed files with 26 additions and 21 deletions

View File

@ -22,6 +22,7 @@
* 【crypto 】 增加CipherWrapper增加setRandomissue#1958@Github * 【crypto 】 增加CipherWrapper增加setRandomissue#1958@Github
* 【core 】 Opt增加ofTry方法pr#1956@Github * 【core 】 Opt增加ofTry方法pr#1956@Github
* 【core 】 DateUtil.toIntSecond标记为弃用issue#I4JHPR@Gitee * 【core 】 DateUtil.toIntSecond标记为弃用issue#I4JHPR@Gitee
* 【db 】 Db.executeBatch标记一个重载为弃用issue#I4JIPH@Gitee
* *
### 🐞Bug修复 ### 🐞Bug修复
* 【core 】 修复FileResource构造fileName参数无效问题issue#1942@Github * 【core 】 修复FileResource构造fileName参数无效问题issue#1942@Github

View File

@ -239,7 +239,9 @@ public abstract class AbstractDb implements Serializable {
* @param paramsBatch 批量的参数 * @param paramsBatch 批量的参数
* @return 每个SQL执行影响的行数 * @return 每个SQL执行影响的行数
* @throws SQLException SQL执行异常 * @throws SQLException SQL执行异常
* @deprecated 编译器无法区分重载
*/ */
@Deprecated
public int[] executeBatch(String sql, Object[]... paramsBatch) throws SQLException { public int[] executeBatch(String sql, Object[]... paramsBatch) throws SQLException {
Connection conn = null; Connection conn = null;
try { try {

View File

@ -16,7 +16,7 @@ import java.util.Map;
/** /**
* SQL执行器全部为静态方法执行查询或非查询的SQL语句<br> * SQL执行器全部为静态方法执行查询或非查询的SQL语句<br>
* 此方法为JDBC的简单封装与数据库类型无关 * 此方法为JDBC的简单封装与数据库类型无关
* *
* @author loolly * @author loolly
* *
*/ */
@ -26,7 +26,7 @@ public class SqlExecutor {
* 执行非查询语句<br> * 执行非查询语句<br>
* 语句包括 插入更新删除<br> * 语句包括 插入更新删除<br>
* 此方法不会关闭Connection * 此方法不会关闭Connection
* *
* @param conn 数据库连接对象 * @param conn 数据库连接对象
* @param sql SQL使用name做为占位符例如:name * @param sql SQL使用name做为占位符例如:name
* @param paramMap 参数Map * @param paramMap 参数Map
@ -43,7 +43,7 @@ public class SqlExecutor {
* 执行非查询语句<br> * 执行非查询语句<br>
* 语句包括 插入更新删除<br> * 语句包括 插入更新删除<br>
* 此方法不会关闭Connection * 此方法不会关闭Connection
* *
* @param conn 数据库连接对象 * @param conn 数据库连接对象
* @param sql SQL * @param sql SQL
* @param params 参数 * @param params 参数
@ -63,7 +63,7 @@ public class SqlExecutor {
/** /**
* 执行调用存储过程<br> * 执行调用存储过程<br>
* 此方法不会关闭Connection * 此方法不会关闭Connection
* *
* @param conn 数据库连接对象 * @param conn 数据库连接对象
* @param sql SQL * @param sql SQL
* @param params 参数 * @param params 参数
@ -83,7 +83,7 @@ public class SqlExecutor {
/** /**
* 执行调用存储过程<br> * 执行调用存储过程<br>
* 此方法不会关闭Connection * 此方法不会关闭Connection
* *
* @param conn 数据库连接对象 * @param conn 数据库连接对象
* @param sql SQL * @param sql SQL
* @param params 参数 * @param params 参数
@ -99,7 +99,7 @@ public class SqlExecutor {
* 执行非查询语句返回主键<br> * 执行非查询语句返回主键<br>
* 发查询语句包括 插入更新删除<br> * 发查询语句包括 插入更新删除<br>
* 此方法不会关闭Connection * 此方法不会关闭Connection
* *
* @param conn 数据库连接对象 * @param conn 数据库连接对象
* @param sql SQL * @param sql SQL
* @param paramMap 参数Map * @param paramMap 参数Map
@ -116,7 +116,7 @@ public class SqlExecutor {
* 执行非查询语句返回主键<br> * 执行非查询语句返回主键<br>
* 发查询语句包括 插入更新删除<br> * 发查询语句包括 插入更新删除<br>
* 此方法不会关闭Connection * 此方法不会关闭Connection
* *
* @param conn 数据库连接对象 * @param conn 数据库连接对象
* @param sql SQL * @param sql SQL
* @param params 参数 * @param params 参数
@ -148,22 +148,24 @@ public class SqlExecutor {
* 批量执行非查询语句<br> * 批量执行非查询语句<br>
* 语句包括 插入更新删除<br> * 语句包括 插入更新删除<br>
* 此方法不会关闭Connection * 此方法不会关闭Connection
* *
* @param conn 数据库连接对象 * @param conn 数据库连接对象
* @param sql SQL * @param sql SQL
* @param paramsBatch 批量的参数 * @param paramsBatch 批量的参数
* @return 每个SQL执行影响的行数 * @return 每个SQL执行影响的行数
* @throws SQLException SQL执行异常 * @throws SQLException SQL执行异常
* @deprecated 重载导致编译器无法区分
*/ */
@Deprecated
public static int[] executeBatch(Connection conn, String sql, Object[]... paramsBatch) throws SQLException { public static int[] executeBatch(Connection conn, String sql, Object[]... paramsBatch) throws SQLException {
return executeBatch(conn, sql, new ArrayIter<>(paramsBatch)); return executeBatch(conn, sql, new ArrayIter<>(paramsBatch));
} }
/** /**
* 批量执行非查询语句<br> * 批量执行非查询语句<br>
* 语句包括 插入更新删除<br> * 语句包括 插入更新删除<br>
* 此方法不会关闭Connection * 此方法不会关闭Connection
* *
* @param conn 数据库连接对象 * @param conn 数据库连接对象
* @param sql SQL * @param sql SQL
* @param paramsBatch 批量的参数 * @param paramsBatch 批量的参数
@ -179,12 +181,12 @@ public class SqlExecutor {
DbUtil.close(ps); DbUtil.close(ps);
} }
} }
/** /**
* 批量执行非查询语句<br> * 批量执行非查询语句<br>
* 语句包括 插入更新删除<br> * 语句包括 插入更新删除<br>
* 此方法不会关闭Connection * 此方法不会关闭Connection
* *
* @param conn 数据库连接对象 * @param conn 数据库连接对象
* @param sqls SQL列表 * @param sqls SQL列表
* @return 每个SQL执行影响的行数 * @return 每个SQL执行影响的行数
@ -194,12 +196,12 @@ public class SqlExecutor {
public static int[] executeBatch(Connection conn, String... sqls) throws SQLException { public static int[] executeBatch(Connection conn, String... sqls) throws SQLException {
return executeBatch(conn, new ArrayIter<>(sqls)); return executeBatch(conn, new ArrayIter<>(sqls));
} }
/** /**
* 批量执行非查询语句<br> * 批量执行非查询语句<br>
* 语句包括 插入更新删除<br> * 语句包括 插入更新删除<br>
* 此方法不会关闭Connection * 此方法不会关闭Connection
* *
* @param conn 数据库连接对象 * @param conn 数据库连接对象
* @param sqls SQL列表 * @param sqls SQL列表
* @return 每个SQL执行影响的行数 * @return 每个SQL执行影响的行数
@ -222,7 +224,7 @@ public class SqlExecutor {
/** /**
* 执行查询语句例如select * from table where field1=:name1 <br> * 执行查询语句例如select * from table where field1=:name1 <br>
* 此方法不会关闭Connection * 此方法不会关闭Connection
* *
* @param <T> 处理结果类型 * @param <T> 处理结果类型
* @param conn 数据库连接对象 * @param conn 数据库连接对象
* @param sql 查询语句使用参数名占位符例如:name * @param sql 查询语句使用参数名占位符例如:name
@ -240,7 +242,7 @@ public class SqlExecutor {
/** /**
* 执行查询语句<br> * 执行查询语句<br>
* 此方法不会关闭Connection * 此方法不会关闭Connection
* *
* @param <T> 处理结果类型 * @param <T> 处理结果类型
* @param conn 数据库连接对象 * @param conn 数据库连接对象
* @param sql 查询语句 * @param sql 查询语句
@ -282,7 +284,7 @@ public class SqlExecutor {
* executeUpdate 的返回值是一个整数int指示受影响的行数即更新计数<br> * executeUpdate 的返回值是一个整数int指示受影响的行数即更新计数<br>
* 对于 CREATE TABLE DROP TABLE 等不操作行的语句executeUpdate 的返回值总为零<br> * 对于 CREATE TABLE DROP TABLE 等不操作行的语句executeUpdate 的返回值总为零<br>
* 此方法不会关闭PreparedStatement * 此方法不会关闭PreparedStatement
* *
* @param ps PreparedStatement对象 * @param ps PreparedStatement对象
* @param params 参数 * @param params 参数
* @return 影响的行数 * @return 影响的行数
@ -297,7 +299,7 @@ public class SqlExecutor {
* 可用于执行任何SQL语句返回一个boolean值表明执行该SQL语句是否返回了ResultSet<br> * 可用于执行任何SQL语句返回一个boolean值表明执行该SQL语句是否返回了ResultSet<br>
* 如果执行后第一个结果是ResultSet则返回true否则返回false<br> * 如果执行后第一个结果是ResultSet则返回true否则返回false<br>
* 此方法不会关闭PreparedStatement * 此方法不会关闭PreparedStatement
* *
* @param ps PreparedStatement对象 * @param ps PreparedStatement对象
* @param params 参数 * @param params 参数
* @return 如果执行后第一个结果是ResultSet则返回true否则返回false * @return 如果执行后第一个结果是ResultSet则返回true否则返回false
@ -311,7 +313,7 @@ public class SqlExecutor {
/** /**
* 执行查询语句<br> * 执行查询语句<br>
* 此方法不会关闭PreparedStatement * 此方法不会关闭PreparedStatement
* *
* @param <T> 处理结果类型 * @param <T> 处理结果类型
* @param ps PreparedStatement * @param ps PreparedStatement
* @param rsh 结果集处理对象 * @param rsh 结果集处理对象
@ -326,7 +328,7 @@ public class SqlExecutor {
/** /**
* 执行查询语句并关闭PreparedStatement * 执行查询语句并关闭PreparedStatement
* *
* @param <T> 处理结果类型 * @param <T> 处理结果类型
* @param ps PreparedStatement * @param ps PreparedStatement
* @param rsh 结果集处理对象 * @param rsh 结果集处理对象
@ -345,7 +347,7 @@ public class SqlExecutor {
// -------------------------------------------------------------------------------------------------------------------------------- Private method start // -------------------------------------------------------------------------------------------------------------------------------- Private method start
/** /**
* 执行查询 * 执行查询
* *
* @param ps {@link PreparedStatement} * @param ps {@link PreparedStatement}
* @param rsh 结果集处理对象 * @param rsh 结果集处理对象
* @return 结果对象 * @return 结果对象