Skip to content

Conversation

@killagu
Copy link
Member

@killagu killagu commented Dec 9, 2025

Summary by CodeRabbit

  • New Features

    • Added an execute capability for running SQL statements with parameter binding across client, connection, transaction, and operator interfaces.
    • Added queryOne helper to return the first row or null from a query.
  • Tests

    • Expanded test coverage for execute workflows: standalone execution, transaction scenarios, multi-connection ops, and DML result verification.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 9, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds a unified execute(sql, values?, options?) API across client, connection, transaction, operator and types; centralizes connection acquisition/release and hook handling; extends promisified pool wrapper to include execute; and adds unit tests for execute (appearing duplicated).

Changes

Cohort / File(s) Summary
Client execute method
src/client.ts
Added execute<T = any>(sql, values?, options?) on RDSClient. Centralizes connection resolution (options.conn, AsyncLocalStorage, or acquire), delegates to internal #executeWithConnection, and ensures proper release semantics. Promisified pool now exposes execute.
Connection & types
src/connection.ts, src/types.ts
RDSConnection gained _execute(sql, values?) delegating to underlying conn.execute. Promisify wrapper includes execute. PoolConnectionPromisify updated to omit `'query'
Transaction execute method
src/transaction.ts
RDSTransaction._execute(sql, values?) added (checks transaction state then delegates to connection _execute).
Operator runtime & API
src/operator.ts
Added public execute and queryOne; replaced internal _query with _execute; introduced #executeWithHooks to run pre/post/error hooks, logging, and duration reporting; operator routes execution through provided executor.
Tests
test/client.test.ts
Added describe('execute()') tests covering parameter binding, insert/select, transactional commit, transaction-scoped execute, separate-connection execute, update/delete verification. The suite appears twice in the diff (duplicated).

Sequence Diagram(s)

sequenceDiagram
    participant Client as RDSClient
    participant Operator as Operator
    participant Conn as RDSConnection / PoolConn
    participant DB as Database
    participant Tx as RDSTransaction

    Client->>Client: resolve connection (options.conn | AsyncLocalStorage | acquire)
    alt in-transaction
        Client->>Tx: call _execute(sql, values)
        Tx->>Tx: `#check`()
        Tx->>Conn: conn._execute(sql, values)
        Conn->>DB: execute SQL
        DB-->>Conn: result
        Conn-->>Tx: result
        Tx-->>Client: result
    else not in-transaction
        Client->>Operator: Operator.execute(sql, values)
        Operator->>Operator: run pre-hooks / log start
        Operator->>Conn: conn._execute/sql execute executor
        Conn->>DB: execute SQL
        DB-->>Conn: result
        Conn-->>Operator: result
        Operator->>Operator: run post-hooks / log end
        Operator-->>Client: result
        Client->>Client: if acquired -> release connection
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Focus review on:
    • Connection acquisition/release parity with existing query flows (src/client.ts).
    • Promisified wrapper runtime/types to ensure execute is exposed (src/connection.ts, src/types.ts).
    • Operator hook lifecycle and logging changes (src/operator.ts).
    • Duplicate test block in test/client.test.ts.

Suggested labels

enhancement

Suggested reviewers

  • gxkl
  • fengmk2

Poem

🐇 A nimble hop, a tiny beat,

I bind the params and fetch the seat.
Client, conn, and txn in line,
Execute! — a hop, precise and fine. ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the primary change: implementing MySQL execute functionality across the codebase, including new execute methods in RDSClient, RDSConnection, RDSTransaction, and Operator classes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 feat/execute

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.

@gemini-code-assist
Copy link

Summary of Changes

Hello @killagu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant feature by implementing a new execute method for MySQL operations within the database client. This method streamlines the process of running SQL statements with parameter binding, offering robust connection and transaction management. The change aims to provide a more direct and flexible interface for database interactions, supported by thorough testing to ensure reliability.

Highlights

  • New execute method: A new execute method has been introduced across the RDSClient, RDSConnection, and RDSTransaction classes, providing a direct and unified way to run SQL queries with parameter binding.
  • Enhanced Connection Management: The RDSClient.execute method now intelligently manages database connections, either reusing an existing connection from a transaction context or acquiring and releasing a new one as necessary, ensuring proper resource handling.
  • Type Definition Updates: The PoolConnectionPromisify interface in src/types.ts has been updated to correctly include the new execute method signature, maintaining type safety and consistency.
  • Comprehensive Test Coverage: Extensive unit tests have been added to test/client.test.ts to validate the execute method's functionality across various scenarios, including DML operations, transaction usage, and explicit connection handling.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces an execute method for MySQL prepared statements across the client, connection, and transaction classes, along with corresponding type definitions and tests. The implementation is functional, but there are a couple of architectural concerns. The new execute method in RDSClient duplicates connection management logic from the existing query method. More critically, the execute methods on RDSConnection and RDSTransaction bypass the existing lifecycle hooks (beforeQuery/afterQuery) provided by the Operator base class, leading to inconsistent behavior for logging and monitoring compared to query calls. These issues should be addressed to improve maintainability and ensure consistent behavior.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a208cf2 and 9fd963c.

📒 Files selected for processing (5)
  • src/client.ts (1 hunks)
  • src/connection.ts (2 hunks)
  • src/transaction.ts (1 hunks)
  • src/types.ts (1 hunks)
  • test/client.test.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/client.ts (2)
src/transaction.ts (2)
  • conn (49-53)
  • RDSTransaction (5-54)
src/connection.ts (1)
  • RDSConnection (8-55)
test/client.test.ts (1)
src/transaction.ts (1)
  • conn (49-53)
🪛 GitHub Actions: CI
test/client.test.ts

[error] 1623-1623: Trailing spaces not allowed. ESLint: no-trailing-spaces. Command: eslint src test --cache.

🪛 GitHub Check: Node.js / Test (ubuntu-latest, 16, mysql@5)
test/client.test.ts

[failure] 1661-1661:
Trailing spaces not allowed


[failure] 1660-1660:
Trailing spaces not allowed


[failure] 1659-1659:
Unexpected parentheses around single function argument


[failure] 1653-1653:
Trailing spaces not allowed


[failure] 1644-1644:
Trailing spaces not allowed


[failure] 1643-1643:
Trailing spaces not allowed


[failure] 1633-1633:
Trailing spaces not allowed


[failure] 1632-1632:
Trailing spaces not allowed


[failure] 1630-1630:
Trailing spaces not allowed


[failure] 1623-1623:
Trailing spaces not allowed

🪛 GitHub Check: Node.js / Test (ubuntu-latest, 16, mysql@8)
test/client.test.ts

[failure] 1661-1661:
Trailing spaces not allowed


[failure] 1660-1660:
Trailing spaces not allowed


[failure] 1659-1659:
Unexpected parentheses around single function argument


[failure] 1653-1653:
Trailing spaces not allowed


[failure] 1644-1644:
Trailing spaces not allowed


[failure] 1643-1643:
Trailing spaces not allowed


[failure] 1633-1633:
Trailing spaces not allowed


[failure] 1632-1632:
Trailing spaces not allowed


[failure] 1630-1630:
Trailing spaces not allowed


[failure] 1623-1623:
Trailing spaces not allowed

🪛 GitHub Check: Node.js / Test (ubuntu-latest, 16, mysql@9)
test/client.test.ts

[failure] 1661-1661:
Trailing spaces not allowed


[failure] 1660-1660:
Trailing spaces not allowed


[failure] 1659-1659:
Unexpected parentheses around single function argument


[failure] 1653-1653:
Trailing spaces not allowed


[failure] 1644-1644:
Trailing spaces not allowed


[failure] 1643-1643:
Trailing spaces not allowed


[failure] 1633-1633:
Trailing spaces not allowed


[failure] 1632-1632:
Trailing spaces not allowed


[failure] 1630-1630:
Trailing spaces not allowed


[failure] 1623-1623:
Trailing spaces not allowed

🪛 GitHub Check: Node.js / Test (ubuntu-latest, 18, mysql@5)
test/client.test.ts

[failure] 1661-1661:
Trailing spaces not allowed


[failure] 1660-1660:
Trailing spaces not allowed


[failure] 1659-1659:
Unexpected parentheses around single function argument


[failure] 1653-1653:
Trailing spaces not allowed


[failure] 1644-1644:
Trailing spaces not allowed


[failure] 1643-1643:
Trailing spaces not allowed


[failure] 1633-1633:
Trailing spaces not allowed


[failure] 1632-1632:
Trailing spaces not allowed


[failure] 1630-1630:
Trailing spaces not allowed


[failure] 1623-1623:
Trailing spaces not allowed

🪛 GitHub Check: Node.js / Test (ubuntu-latest, 18, mysql@8)
test/client.test.ts

[failure] 1661-1661:
Trailing spaces not allowed


[failure] 1660-1660:
Trailing spaces not allowed


[failure] 1659-1659:
Unexpected parentheses around single function argument


[failure] 1653-1653:
Trailing spaces not allowed


[failure] 1644-1644:
Trailing spaces not allowed


[failure] 1643-1643:
Trailing spaces not allowed


[failure] 1633-1633:
Trailing spaces not allowed


[failure] 1632-1632:
Trailing spaces not allowed


[failure] 1630-1630:
Trailing spaces not allowed


[failure] 1623-1623:
Trailing spaces not allowed

🪛 GitHub Check: Node.js / Test (ubuntu-latest, 18, mysql@9)
test/client.test.ts

[failure] 1661-1661:
Trailing spaces not allowed


[failure] 1660-1660:
Trailing spaces not allowed


[failure] 1659-1659:
Unexpected parentheses around single function argument


[failure] 1653-1653:
Trailing spaces not allowed


[failure] 1644-1644:
Trailing spaces not allowed


[failure] 1643-1643:
Trailing spaces not allowed


[failure] 1633-1633:
Trailing spaces not allowed


[failure] 1632-1632:
Trailing spaces not allowed


[failure] 1630-1630:
Trailing spaces not allowed


[failure] 1623-1623:
Trailing spaces not allowed

🪛 GitHub Check: Node.js / Test (ubuntu-latest, 20, mysql@5)
test/client.test.ts

[failure] 1661-1661:
Trailing spaces not allowed


[failure] 1660-1660:
Trailing spaces not allowed


[failure] 1659-1659:
Unexpected parentheses around single function argument


[failure] 1653-1653:
Trailing spaces not allowed


[failure] 1644-1644:
Trailing spaces not allowed


[failure] 1643-1643:
Trailing spaces not allowed


[failure] 1633-1633:
Trailing spaces not allowed


[failure] 1632-1632:
Trailing spaces not allowed


[failure] 1630-1630:
Trailing spaces not allowed


[failure] 1623-1623:
Trailing spaces not allowed

🪛 GitHub Check: Node.js / Test (ubuntu-latest, 20, mysql@8)
test/client.test.ts

[failure] 1661-1661:
Trailing spaces not allowed


[failure] 1660-1660:
Trailing spaces not allowed


[failure] 1659-1659:
Unexpected parentheses around single function argument


[failure] 1653-1653:
Trailing spaces not allowed


[failure] 1644-1644:
Trailing spaces not allowed


[failure] 1643-1643:
Trailing spaces not allowed


[failure] 1633-1633:
Trailing spaces not allowed


[failure] 1632-1632:
Trailing spaces not allowed


[failure] 1630-1630:
Trailing spaces not allowed


[failure] 1623-1623:
Trailing spaces not allowed

🪛 GitHub Check: Node.js / Test (ubuntu-latest, 20, mysql@9)
test/client.test.ts

[failure] 1661-1661:
Trailing spaces not allowed


[failure] 1660-1660:
Trailing spaces not allowed


[failure] 1659-1659:
Unexpected parentheses around single function argument


[failure] 1653-1653:
Trailing spaces not allowed


[failure] 1644-1644:
Trailing spaces not allowed


[failure] 1643-1643:
Trailing spaces not allowed


[failure] 1633-1633:
Trailing spaces not allowed


[failure] 1632-1632:
Trailing spaces not allowed


[failure] 1630-1630:
Trailing spaces not allowed


[failure] 1623-1623:
Trailing spaces not allowed

🪛 GitHub Check: Node.js / Test (ubuntu-latest, 22, mysql@5)
test/client.test.ts

[failure] 1661-1661:
Trailing spaces not allowed


[failure] 1660-1660:
Trailing spaces not allowed


[failure] 1659-1659:
Unexpected parentheses around single function argument


[failure] 1653-1653:
Trailing spaces not allowed


[failure] 1644-1644:
Trailing spaces not allowed


[failure] 1643-1643:
Trailing spaces not allowed


[failure] 1633-1633:
Trailing spaces not allowed


[failure] 1632-1632:
Trailing spaces not allowed


[failure] 1630-1630:
Trailing spaces not allowed


[failure] 1623-1623:
Trailing spaces not allowed

🪛 GitHub Check: Node.js / Test (ubuntu-latest, 22, mysql@8)
test/client.test.ts

[failure] 1661-1661:
Trailing spaces not allowed


[failure] 1660-1660:
Trailing spaces not allowed


[failure] 1659-1659:
Unexpected parentheses around single function argument


[failure] 1653-1653:
Trailing spaces not allowed


[failure] 1644-1644:
Trailing spaces not allowed


[failure] 1643-1643:
Trailing spaces not allowed


[failure] 1633-1633:
Trailing spaces not allowed


[failure] 1632-1632:
Trailing spaces not allowed


[failure] 1630-1630:
Trailing spaces not allowed


[failure] 1623-1623:
Trailing spaces not allowed

🪛 GitHub Check: Node.js / Test (ubuntu-latest, 22, mysql@9)
test/client.test.ts

[failure] 1661-1661:
Trailing spaces not allowed


[failure] 1660-1660:
Trailing spaces not allowed


[failure] 1659-1659:
Unexpected parentheses around single function argument


[failure] 1653-1653:
Trailing spaces not allowed


[failure] 1644-1644:
Trailing spaces not allowed


[failure] 1643-1643:
Trailing spaces not allowed


[failure] 1633-1633:
Trailing spaces not allowed


[failure] 1632-1632:
Trailing spaces not allowed


[failure] 1630-1630:
Trailing spaces not allowed


[failure] 1623-1623:
Trailing spaces not allowed

🔇 Additional comments (4)
src/transaction.ts (1)

44-47: RDSTransaction.execute matches existing transaction safety pattern

execute() correctly reuses #check() and delegates to the underlying connection, consistent with _query, commit, and rollback. Looks good.

src/types.ts (1)

15-18: execute added to PoolConnectionPromisify in line with query

Including 'execute' in the Omit and defining a Promise-returning execute method keeps the promisified connection type consistent with how query is handled. This aligns with the new usage in RDSConnection and RDSTransaction.

Please re-run TypeScript build/tests against the current mysql2 version to confirm that PoolConnection still exposes an execute method with a compatible callback shape.

src/connection.ts (1)

19-23: RDSConnection.execute is correctly wired into the promisified wrapper

Adding 'execute' to the method list for promisify and exposing async execute(sql, values) mirrors the existing query behavior and gives higher layers a consistent Promise API.

Please confirm via the existing test matrix (and/or mysql2 docs) that PoolConnection.execute has the expected callback signature so util.promisify continues to resolve to the result set as intended.

Also applies to: 40-42

src/client.ts (1)

140-163: RDSClient.execute cleanly mirrors query’s connection lifecycle

execute() reuses the same connection resolution and shouldReleaseConn pattern as query(), so it behaves correctly in normal, explicit-connection, and transaction-scope scenarios. Implementation looks solid.

Copy link

@gxkl gxkl left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov
Copy link

codecov bot commented Dec 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.13%. Comparing base (0d1569d) to head (9d89a05).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #15      +/-   ##
==========================================
- Coverage   98.22%   98.13%   -0.09%     
==========================================
  Files          10       10              
  Lines        1180     1231      +51     
  Branches      239      248       +9     
==========================================
+ Hits         1159     1208      +49     
- Misses         21       23       +2     

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- Move execute method implementation from RDSConnection to Operator base class
- Add _execute abstract method in Operator for consistency with _query
- Extract common execution logic into private #executeWithHooks method
- Reduce code duplication between query and execute methods
- Maintain all existing functionality (hooks, logging, monitoring, events)
- Simplify RDSConnection by removing complex execute implementation
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/operator.ts (1)

76-93: Improve type safety for queryOne and reduce boilerplate with a default _execute fallback

The new API looks good. Two refinements would strengthen the implementation:

  1. Add generics and correct null-coalescing in queryOne

Currently queryOne returns Promise<any> and uses rows && rows[0] || null, which incorrectly treats falsy row values (e.g., 0, false) as "no row found". Make it generic and use the nullish coalescing operator:

-  async queryOne(sql: string, values?: object | any[]) {
-    const rows = await this.query(sql, values);
-    return rows && rows[0] || null;
-  }
+  async queryOne<T = any>(sql: string, values?: object | any[]): Promise<T | null> {
+    const rows = await this.query<T[]>(sql, values);
+    return (rows && rows[0]) ?? null;
+  }
  1. Provide a default _execute implementation that delegates to _query

Many subclasses may only need to implement _query and don't have a distinct execute operation. Offering a sensible default reduces duplication:

-  // eslint-disable-next-line @typescript-eslint/no-unused-vars
-  protected async _execute(_sql: string, _values?: object | any[]): Promise<any> {
-    throw new Error('SubClass must impl this');
-  }
+  protected async _execute(sql: string, values?: object | any[]): Promise<any> {
+    return this._query(sql, values);
+  }

This keeps _query as the required implementation while giving subclasses a working execute out of the box—they can still override _execute when the underlying driver provides a distinct operation.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a4127e and 7abe54b.

📒 Files selected for processing (2)
  • src/connection.ts (2 hunks)
  • src/operator.ts (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/operator.ts (1)
src/channels.ts (1)
  • QueryStartMessage (25-29)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Node.js / Test (ubuntu-latest, 22, mysql@9)
  • GitHub Check: Node.js / Test (ubuntu-latest, 18, mysql@8)
  • GitHub Check: Node.js / Test (ubuntu-latest, 18, mysql@9)
🔇 Additional comments (2)
src/operator.ts (1)

90-100: Unified #executeWithHooks logic correctly applies lifecycle hooks and logging to execute

The new execute API and #executeWithHooks helper look consistent and well‑factored:

  • Both query and execute now go through the same lifecycle: beforeQueryHandlers, debug logging, optional logging callback, channels.queryStart/queryEnd, error decoration, and afterQueryHandlers.
  • Passing an explicit operation string into the debug messages cleanly distinguishes query vs execute in logs without changing the channel contracts.

This addresses the earlier concern that execute might bypass query lifecycle hooks and centralizes cross‑cutting behavior in one place. No changes needed here from my side.

Also applies to: 94-155, 110-111, 126-132, 138-148

src/connection.ts (1)

17-25: The execute() method is guaranteed by the type contract and does not require guarding.

The PoolConnectionPromisify interface explicitly declares execute as a required method (lines 16-17, src/types.ts). The client's getConnection() method returns Promise<PoolConnectionPromisify> (line 22, src/types.ts), so RDSConnection always receives connections that satisfy this contract. Since mysql2.PoolConnection always includes the execute() method as part of the standard MySQL protocol, and the type system enforces this at compile time, adding runtime guards is unnecessary.

All five methods in the promisify list—query, execute, beginTransaction, commit, rollback—are treated identically and no guards exist for any of them elsewhere in the codebase. If execute were optional, the others would need guards too, but they don't. The concern about "different drivers or older versions" does not apply because this library specifically uses mysql2.PoolConnection.

Likely an incorrect or invalid review comment.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/transaction.ts (1)

44-47: Add protected modifier for consistency with _query.

The _query method on line 39 is declared as protected, but _execute lacks this modifier. Both methods serve the same purpose as internal implementations called by the public query() and execute() methods in the Operator base class.

-  async _execute(sql: string, values?: object | any[]) {
+  protected async _execute(sql: string, values?: object | any[]) {
     this.#check();
     return await this.conn!._execute(sql, values);
   }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7abe54b and 9d89a05.

📒 Files selected for processing (2)
  • src/client.ts (2 hunks)
  • src/transaction.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/client.ts (3)
src/operator.ts (1)
  • T (94-155)
src/transaction.ts (2)
  • conn (49-53)
  • RDSTransaction (5-54)
src/connection.ts (1)
  • RDSConnection (8-55)
🔇 Additional comments (2)
src/client.ts (2)

78-85: Good addition of execute to promisified methods.

Adding execute to the promisification list properly enables prepared statement support from the mysql2 pool.


116-154: Well-structured refactor consolidating connection handling.

The extraction of #executeWithConnection and #getConnection helpers addresses the previous review concern about duplication between query and execute. The implementation correctly:

  1. Resolves connections from three sources with proper priority (options → AsyncLocalStorage → new acquisition)
  2. Tracks connection ownership with shouldRelease flag
  3. Ensures connection release in finally block only when appropriate

@killagu killagu added this pull request to the merge queue Dec 9, 2025
Merged via the queue into master with commit f49ba4b Dec 9, 2025
17 of 18 checks passed
@killagu killagu deleted the feat/execute branch December 9, 2025 05:54
fengmk2 pushed a commit that referenced this pull request Dec 9, 2025
[skip ci]

## 1.5.0 (2025-12-09)

* feat: implement mysql execute (#15) ([f49ba4b](f49ba4b)), closes [#15](#15) [hi#level](https://github.com/hi/issues/level)
@github-actions
Copy link

github-actions bot commented Dec 9, 2025

🎉 This PR is included in version 1.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants