diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ca05792a..ea32dfcd2 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,12 @@ # 🚀Changelog ------------------------------------------------------------------------------------------------------------- -# 5.8.19.M1 (2023-05-05) +# 5.8.19.M1 (2023-05-09) ### 🐣新特性 * 【db 】 优化HttpRequest.toString()内容打印(issue#3072@Github) * 【poi 】 优化Sax方式读取时空白行返回0,修改为返回-1(issue#I6WYF6@Gitee) +* 【db 】 优化count查询兼容informix(issue#I713XQ@Gitee) ### 🐞Bug修复 * 【core 】 修复URLUtil.decode无法解码UTF-16问题(issue#3063@Github) diff --git a/hutool-db/src/main/java/cn/hutool/db/dialect/Dialect.java b/hutool-db/src/main/java/cn/hutool/db/dialect/Dialect.java index 7f0ca07a5..4d234c049 100644 --- a/hutool-db/src/main/java/cn/hutool/db/dialect/Dialect.java +++ b/hutool-db/src/main/java/cn/hutool/db/dialect/Dialect.java @@ -148,8 +148,10 @@ public interface Dialect extends Serializable { * @since 5.7.2 */ default PreparedStatement psForCount(Connection conn, SqlBuilder sqlBuilder) throws SQLException { + // https://gitee.com/dromara/hutool/issues/I713XQ + // 为了兼容informix等数据库,此处使用count(*)而非count(1) sqlBuilder = sqlBuilder - .insertPreFragment("SELECT count(1) from(") + .insertPreFragment("SELECT count(*) from(") // issue#I3IJ8X@Gitee,在子查询时需设置单独别名,此处为了防止和用户的表名冲突,使用自定义的较长别名 .append(") hutool_alias_count_"); return psForPage(conn, sqlBuilder, null);