Show bound parameter values in short SQL and search#17
Conversation
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
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Walkthroughバウンドクエリ値が利用可能な場合、UI表示およびテキスト検索機能においてプレースホルダーベースの表現に代わって、短縮SQL表現と検索フィルタリング用に使用されるようになりました。 Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
jetbrains-plugin/src/main/kotlin/com/mariadbprofiler/plugin/model/QueryEntry.kt (1)
175-179:boundQueryがアクセスごとに再計算される(任意リファクタリング)
boundQueryはget()を使った非キャッシュの計算プロパティです。フィルタ適用サイクルごとに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.
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
boundQuery(with parameters substituted) instead of rawquerywhen available, allowing users to see actual values in truncated query displaysboundQuery, enabling users to find queries by their bound parameter valuesImplementation Details
boundQueryproperty which already contains parameter substitution logicboundQuerywith safe navigation operatorhttps://claude.ai/code/session_01NDmw3AG9wQx6vohhYAx9Be
Summary by CodeRabbit
リリースノート
新機能
改良
テスト