Skip to content

Conversation

@pmishchenko-ua
Copy link
Collaborator

@pmishchenko-ua pmishchenko-ua commented Nov 20, 2025

  • This pull request adds support for setting session variables when establishing MySQL connections and pools, allowing users to specify custom session variables via the sessionVariables option. The PR also updates tests to ignore the new option when connecting to the mock server and adds a dedicated integration test for session variable functionality.
  • For pooled connections, we add a session lock to make sure all connections from the pool behave in the same way.
  • Removed outdated comments regarding default connection parameters in BaseConnection constructor for clarity. (lib/base/connection.js)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for setting MySQL session variables when establishing a connection. The feature allows users to configure session-level variables (like sql_mode, autocommit, etc.) through connection configuration, with a default setting for vector_type_project_format.

Key changes:

  • Added sessionVariables option to ConnectionOptions interface
  • Implemented session variable setting logic in connection establishment
  • Added test coverage for the new functionality

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
typings/mysql/lib/Connection.d.ts Added sessionVariables option to TypeScript type definitions
lib/connection_config.js Added configuration handling for session variables with defaults
lib/base/connection.js Implemented session variable setting via SET query during connection
test/integration/connection/test-connect-with-session-vars.test.cjs New test validating session variables are correctly set
test/integration/connection/test-disconnects.test.cjs Added sessionVariables: null to disable defaults in test
test/integration/connection/test-change-user-multi-factor.test.cjs Added sessionVariables: null to disable defaults in test
test/common.test.cjs Added sessionVariables to common connection creation helper

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 24 out of 25 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 24 out of 25 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pmishchenko-ua pmishchenko-ua force-pushed the pavlo/add-session-variables branch from 95024ff to d193513 Compare December 10, 2025 14:42
@pmishchenko-ua pmishchenko-ua merged commit 965ec90 into master Dec 11, 2025
5 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.

3 participants