Skip to content

Show bound parameter values in short SQL and search#17

Merged
39ff merged 1 commit into
mainfrom
claude/show-bound-sql-queries-xQeZR
Feb 18, 2026
Merged

Show bound parameter values in short SQL and search#17
39ff merged 1 commit into
mainfrom
claude/show-bound-sql-queries-xQeZR

Conversation

@39ff

@39ff 39ff commented Feb 18, 2026

Copy link
Copy Markdown
Owner

Summary

Enhanced the query display and search functionality to use bound parameter values instead of placeholders, providing better visibility into actual query execution.

Key Changes

  • QueryEntry.shortSql: Modified to use boundQuery (with parameters substituted) instead of raw query when available, allowing users to see actual values in truncated query displays
  • QueryTableModel filtering: Extended text search to also match against boundQuery, enabling users to find queries by their bound parameter values
  • Test coverage: Added three new test cases validating:
    • Bound values are displayed in short SQL
    • Long queries with bound values are properly truncated with ellipsis
    • Fallback to original query when no parameters are available

Implementation Details

  • The changes leverage the existing boundQuery property which already contains parameter substitution logic
  • Filtering gracefully handles null boundQuery with safe navigation operator
  • All changes are backward compatible - queries without parameters continue to work as before

https://claude.ai/code/session_01NDmw3AG9wQx6vohhYAx9Be

Summary by CodeRabbit

リリースノート

  • 新機能

    • クエリ検索時にバウンドパラメータ値を検索対象に追加しました。
  • 改良

    • バウンドパラメータを含むクエリの表示表現を改善しました。
  • テスト

    • バウンドパラメータの表示動作を検証するテストを追加しました。

Change shortSql to use boundQuery (with interpolated params) so the
query list table displays actual values like 'John' instead of ?.
Also add boundQuery to the text search filter so users can search
by bound parameter values.

https://claude.ai/code/session_01NDmw3AG9wQx6vohhYAx9Be
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Feb 18, 2026

Copy link
Copy Markdown

Walkthrough

バウンドクエリ値が利用可能な場合、UI表示およびテキスト検索機能においてプレースホルダーベースの表現に代わって、短縮SQL表現と検索フィルタリング用に使用されるようになりました。

Changes

Cohort / File(s) Summary
Model Updates
jetbrains-plugin/src/main/kotlin/com/mariadbprofiler/plugin/model/QueryEntry.kt
shortSql が利用可能な場合にバウンドクエリを優先的に使用するよう変更され、パラメータ値を含む表現が生成されるようになりました。
Search Functionality
jetbrains-plugin/src/main/kotlin/com/mariadbprofiler/plugin/ui/table/QueryTableModel.kt
テキストフィルターに boundQuery を含めるための検索条件が追加され、バウンドパラメータを含むクエリも検索対象になりました。
Test Coverage
jetbrains-plugin/src/test/kotlin/com/mariadbprofiler/plugin/model/QueryEntryTest.kt
shortSql がバウンドパラメータ値の置換、長いクエリの切り詰め、パラメータ不在時のフォールバック動作を正しく実行することを検証する3つの新しいテストを追加。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 バウンドクエリが舞い降りて、
プレースホルダーを優しく置き換え、
検索もまた賢く、深く—
小さな変化が大きな輝き! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed タイトルはプルリクエストの主要な変更を正確に説明しており、バウンドパラメータ値をショートSQLと検索に表示するという核となる機能を明確に反映しています。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/show-bound-sql-queries-xQeZR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
jetbrains-plugin/src/main/kotlin/com/mariadbprofiler/plugin/model/QueryEntry.kt (1)

175-179: boundQuery がアクセスごとに再計算される(任意リファクタリング)

boundQueryget() を使った非キャッシュの計算プロパティです。フィルタ適用サイクルごとに QueryTableModel.applyFilters() から直接1回呼ばれ、さらに getValueAt()shortSql を通じてもう1回呼び出すため、エントリごとに最低2回 SQL パース処理が走ります。

data class のボディに定義した lazy val はコンストラクタパラメータではないため、equals / hashCode / copy / componentN には含まれず、キャッシュ化しても安全です。

♻️ キャッシュ化の提案
-    val boundQuery: String?
-        get() {
-            if (params.isEmpty()) return null
-            ...
-        }
+    val boundQuery: String? by lazy {
+        if (params.isEmpty()) return@lazy null
+        ...
+    }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@jetbrains-plugin/src/main/kotlin/com/mariadbprofiler/plugin/model/QueryEntry.kt`
around lines 175 - 179, The boundQuery getter is being recomputed on every
access (used from QueryTableModel.applyFilters() and again via getValueAt()
through shortSql), causing redundant SQL parsing; change boundQuery from a
computed property to a cached lazy property inside the QueryEntry data class
(e.g., define a private val boundQueryCached by lazy { ... } and have shortSql
use that) so the parsed/bound SQL is computed once per instance; keep the
parsing logic intact, ensure the new lazy property name (e.g., boundQueryCached
or boundQueryLazy) is used wherever boundQuery was read, and verify
equals/hashCode/copy unaffected since lazy in data class body is safe.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@jetbrains-plugin/src/main/kotlin/com/mariadbprofiler/plugin/model/QueryEntry.kt`:
- Around line 175-179: The boundQuery getter is being recomputed on every access
(used from QueryTableModel.applyFilters() and again via getValueAt() through
shortSql), causing redundant SQL parsing; change boundQuery from a computed
property to a cached lazy property inside the QueryEntry data class (e.g.,
define a private val boundQueryCached by lazy { ... } and have shortSql use
that) so the parsed/bound SQL is computed once per instance; keep the parsing
logic intact, ensure the new lazy property name (e.g., boundQueryCached or
boundQueryLazy) is used wherever boundQuery was read, and verify
equals/hashCode/copy unaffected since lazy in data class body is safe.

@39ff 39ff merged commit f444c3e into main Feb 18, 2026
35 checks 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