New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Laravel/Lumen cannot call MySQL procedure with CURSOR #27951
Comments
I'll need someone who knows more about cursors and mysql procedures to verify this. Also: this Lumen version isn't supported anymore. Can you try to upgrade to 5.8 and see if the problem persists? |
Please provide a simple procedure to reproduce the issue. |
@driesvints Just tried on latest version of lumen (5.8), getting same error. Details on cursors here: http://www.mysqltutorial.org/mysql-cursor/ Its essentially a way to do FOR loops in sql |
Example Stored Procedure that reproduces the issue: DECLARE s VARCHAR(10); OPEN cur1; SELECT 1; END$$ |
Also note the cursor in this example doesn't even do anything, just its mere presence is enough. |
I tried write native code with PDO, and set I used Wireshark catch MySQL data packets, it's so strange and looks like character be changed at response. |
This is definitely a MySQL/PDO issue and not related to Laravel. |
@staudenmeir Thx, I think so, but I still have not any solution. ToT... |
Yea, this looks like a driver issue not Laravel per se. |
Since everyone seems to agree that this isn't an issue with the framework I'm going to have to close this one off. Maybe a bug report to the PHP core is wanted? https://bugs.php.net |
PHP bug, first reported in 2013, appears to affect all PHP versions. https://bugs.php.net/bug.php?id=64638 |
@madleech Yes, I found this...I think this bug is very bad, it has been so many years. |
Laravel will miss-behave in multiple ways with MySQL and PgSQL as documented in various issues and even PRs, because people try to get a fix in but _the_ recommendation right now is to *not* use it. I figured it might save everyones time if ppl fill this out upfront because it's often takes some forth and back until users mention this. See: - laravel#29023 - laravel#23850 - laravel#25818 - laravel#27951 - laravel#28149
Description:
I tried to call a procedure in Laravel/Lumen, but always return this exception:
I found the problem with a PDO attribute
PDO::ATTR_EMULATE_PREPARES
.If this attribute set
true
, it's run success. But in the framework, this default value isfalse
.Certainly, this attribute safer than
true
, and my procedure used withCURSOR
.If I used a procedure without
CURSOR
, andPDO::ATTR_EMULATE_PREPARES = false
, its run success too.Maybe this is client driver problem? T_T...
Steps To Reproduce:
The text was updated successfully, but these errors were encountered: