Skip to content

feat(rdb): 支持 LIKE 忽略大小写 - #121

Merged
zhou-hao merged 3 commits into
4.2from
codex/like-ignore-case-4.2
Aug 11, 2026
Merged

feat(rdb): 支持 LIKE 忽略大小写#121
zhou-hao merged 3 commits into
4.2from
codex/like-ignore-case-4.2

Conversation

@zhou-hao

@zhou-hao zhou-hao commented Aug 10, 2026

Copy link
Copy Markdown
Member

变更内容

  • 支持通过 like$ignoreCase / nlike$ignoreCase 查询选项忽略大小写。
  • 将 LIKE、LOWER 和字符串连接下沉到 Dialect 默认方法,方言可覆盖 buildLike 使用原生策略。
  • 默认使用 lower(left) [not] like lower(right);反向 LIKE 的通配符使用两参数 concat 嵌套,兼容 Oracle 等方言。
  • PostgreSQL 及继承它的 OpenGauss 使用 ILIKE / NOT ILIKE;普通 LIKE 保持不变。

测试

定向片段及 H2 集成测试:

mvn -pl hsweb-easy-orm-rdb -am clean test \
  -Dtest=LikeTermFragmentBuilderTest,DialectTest,QueryTermsFragmentBuilderTest,LikeIgnoreCaseH2IntegrationTest \
  -Dsurefire.failIfNoSpecifiedTests=false

结果:19 个测试通过,失败 0,错误 0,跳过 0。

真实数据库 Testcontainers 集成测试覆盖:

  • H2
  • PostgreSQL 11
  • OpenGauss 5.0.1
  • MySQL 5.7
  • MySQL 8
  • Oracle 11g
  • MSSQL 2017(两个基础测试变体)

结果:8 个新增方言测试通过,失败 0,错误 0。实际 SQL 已确认 PostgreSQL/OpenGauss 使用 ilike,H2、MySQL、Oracle、MSSQL 使用 lower(...) like lower(?),Oracle 反向 LIKE 使用嵌套两参数 concat(...)。H2 基础测试清理阶段有已有的表不存在告警,但不影响测试结果。

JaCoCo 定向报告:

  • LikeTermFragmentBuilder:行覆盖 25/25,分支覆盖 12/12。
  • Dialect 默认方法的空值、普通/反向 LIKE、NOT LIKE、大小写和连接边界均有测试覆盖。

兼容性与风险

  • 默认 SQL 仅使用 LOWERLIKE 和两参数 CONCAT,由方言扩展点保留原生操作符适配空间。
  • LOWER(column) 可能影响普通索引命中;本次不新增函数索引、collation 或通配符转义策略,使用方需结合数据库索引方案评估。
  • 本次为纯 SQL 片段构造,不涉及 TraceHolder 链路埋点或 MBean 运维指标。

@codecov-commenter

codecov-commenter commented Aug 10, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.00%. Comparing base (68b2764) to head (16dc95c).
⚠️ Report is 52 commits behind head on 4.2.

Additional details and impacted files
@@              Coverage Diff              @@
##                4.2     #121       +/-   ##
=============================================
+ Coverage     64.92%   79.00%   +14.07%     
- Complexity     2341     3418     +1077     
=============================================
  Files           343      374       +31     
  Lines          9375    11002     +1627     
  Branches        940     1336      +396     
=============================================
+ Hits           6087     8692     +2605     
+ Misses         2810     1662     -1148     
- Partials        478      648      +170     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zhou-hao
zhou-hao merged commit 82995dc into 4.2 Aug 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants