Skip to content

test: add reproduction test for callproc multi-resultsets with OUT params - #1266

Open
soepic1 wants to merge 1 commit into
PyMySQL:mainfrom
soepic1:test-callproc-multi-resultset-out-params
Open

soepic1 wants to merge 1 commit into
PyMySQL:mainfrom
soepic1:test-callproc-multi-resultset-out-params

Conversation

@soepic1

@soepic1 soepic1 commented Aug 30, 2026

Copy link
Copy Markdown

Summary

Adds a dedicated test case to verify cursor.callproc() behavior when executing stored procedures that return internal result sets alongside OUT parameters.

Details

When a MySQL stored procedure contains internal queries (e.g., SELECT statements) and updates OUT parameters, the server returns multiple result set packets over the socket.

This test ensures that:

  1. Internal SELECT result sets remain accessible via cursor.fetchall().
  2. Draining result sets using cursor.nextset() allows session variables (@_procname_n) to be fetched reliably via subsequent SELECT queries without socket desynchronization.

Testing

  • Added test_callproc_with_multi_resultset_and_out_params under pymysql/tests/test_issues.py.
  • Verified passing status locally against MySQL 8.0 / Cloud SQL proxy.
  • Ran full integration test suite (pytest pymysql/tests/) to ensure zero regressions across standard callproc usage.

@soepic1
soepic1 force-pushed the test-callproc-multi-resultset-out-params branch 2 times, most recently from 9420ccc to 40e8233 Compare August 30, 2026 19:36
@methane
methane requested a balanced review from Copilot August 31, 2026 13:59

Copilot AI 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.

🟡 Changes recommended

The test does not validate explicit result-set drainage and lacks failure-safe cleanup.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds regression coverage for stored procedures combining result sets and OUT parameters.

Changes:

  • Verifies internal result retrieval.
  • Fetches OUT parameters after advancing result sets.
File summaries
File Description
pymysql/tests/test_issues.py Adds the callproc regression test.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 3
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pymysql/tests/test_issues.py Outdated
Comment thread pymysql/tests/test_issues.py Outdated
Comment thread pymysql/tests/test_issues.py Outdated
@soepic1
soepic1 force-pushed the test-callproc-multi-resultset-out-params branch from 40e8233 to 70a0d06 Compare August 31, 2026 18:55
@soepic1

soepic1 commented Aug 31, 2026

Copy link
Copy Markdown
Author

addressed Copilot feedback by adding try/finally cleanup and explicit nextset() assertions.

@soepic1

soepic1 commented Sep 7, 2026

Copy link
Copy Markdown
Author

Hi @PyMySQL maintainers, just checking in on this when you have a moment!

All CI checks are passing cleanly. Please let me know if you would like any adjustments to the implementation or additional test cases added. Happy to make updates!

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