Bug #93378 | Out parameters error on second call when statement is a prepared statement | ||
---|---|---|---|
Submitted: | 28 Nov 2018 1:00 | Modified: | 22 Jun 2021 20:26 |
Reporter: | Kurt Peterson | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / ODBC | Severity: | S2 (Serious) |
Version: | 8.0, 5.3.11 | OS: | Windows |
Assigned to: | CPU Architecture: | Any | |
Tags: | ADO, C++, microsoft, ODBC, stored procedure |
[28 Nov 2018 1:00]
Kurt Peterson
[28 Nov 2018 1:12]
Kurt Peterson
Zip file with C++ project and SQL to create database
Attachment: Prepared Statement.zip (application/x-zip-compressed, text), 2.33 MiB.
[28 Nov 2018 11:25]
MySQL Verification Team
Thank you for the bug report. I compiled your program test case however it exits without error messages. Any idea? On debug mode: First-chance exception at 0x00007FFB5E62A388 in MySQL Stored Procedure.exe: Microsoft C++ exception: _com_error at memory location 0x000000079C0FF500. <cut> The program '[12112] MySQL Stored Procedure.exe' has exited with code 0 (0x0).
[29 Nov 2018 16:38]
Kurt Peterson
Hey Miguel, It looks like you are getting the error, it's handled by my try/catch block because I never print the error description. Modify the catch block to be this: catch (_com_error& e) { _bstr_t myError = e.Description(); cout << myError; getchar(); } This should print out the error and wait for a key entry before exiting.
[30 Nov 2018 15:32]
MySQL Verification Team
Thank you for the feedback. Is the below error message what you get tto? C:\tmp>"MySQL Stored Procedure.exe" Item cannot be found in the collection corresponding to the requested name or ordinal.
[10 Dec 2018 21:56]
Kurt Peterson
Hey Miguel, I have never seen that error before. Can you tell me what line of code is throwing that exception? You should be able to attach the debugger and enable breaking on all the following exceptions through the debug menu: Debug >> Exceptions and then check "C++ Exceptions" "Win32 Exception" This should break on your exception. For me, the exception is thrown at line 57: StepStoredProc->Execute(NULL, NULL, ADODB::adCmdStoredProc); And is on this stack frame: > MySQL Stored Procedure.exe!wmain(argc=1, argv=0x004216a0) Line 57 C++ I did a search of that error and it looks like it occurs when you try to retrieve a field that isn't in a record. This makes no sense to me because there is no record we are trying to retrieve. The code is trying to execute a stored procedure. Also, what versions of MySQL Driver and Server are you using? My driver is what it is reported here, 8.0, and the version of MySQL Server is 5.7.15.
[11 Dec 2018 12:57]
MySQL Verification Team
Test case result
Attachment: 93378.png (image/png, text), 61.71 KiB.
[11 Dec 2018 13:01]
MySQL Verification Team
Hi Kurt, Thank you for the feedback. I compiled again your test case now querying a MySQL Server 5.7 running on Linux local network and I was able to repeat the issue reported.
[12 Dec 2018 14:44]
Kurt Peterson
Great, Miguel. Let me know if you need anything else.
[4 Mar 2019 8:05]
Bogdan Degtyariov
Posted by developer: Intermediate diagnosis: The second call to the stored procedure fails because the statement is closed after the results of the first call have been received. 2018-11-09T13:22:34.273681Z 20 Execute call INSERT_STEP_RESULT('48', '888') 2018-11-09T13:22:34.325684Z 20 Close stmt 2018-11-09T13:22:34.326684Z 20 Query call INSERT_STEP_RESULT(48, 888) <-- Fail
[22 Jun 2021 20:26]
Philip Olson
Fixed as of the upcoming MySQL Connector/ODBC 8.0.27 release, and here's the proposed changelog entry from the documentation team: The second call to a stored procedure failed if the statement was closed after the results of the first call had been received. Thank you for the detailed bug report!