Skip to content
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

Stored Procedure: Can't return resultset in the given context #72

Open
jvulcan opened this issue Apr 27, 2016 · 3 comments
Open

Stored Procedure: Can't return resultset in the given context #72

jvulcan opened this issue Apr 27, 2016 · 3 comments
Labels

Comments

@jvulcan
Copy link

jvulcan commented Apr 27, 2016

The error appears while trying to run a stored procedure that returns a resultset, either using execProcedure or execPreparedResult is the same.

I never had problems getting the resultset from a SP using the C++ MySQL Connector.

Using MySQL 5.6.17 on Windows (from Wampserver).

mysql.protocol.packets.MySQLReceivedException@C:\Users\JVortex\AppData\Roaming\dub\packages\mysql-native-0.1.4\source\mysql\protocol\commands.d(897): MySQL error: PROCEDURE vilenio_accounts.pdLogin can't return a result set in the given context
----------------
0x00405E58 in pure @safe bool std.exception.enforce!(bool).enforce(bool, lazy object.Throwable) at D:\Dmd\dmd2\windows\bin\..\..\src\phobos\std\exception.d(559)
0x00430360 in D5mysql8protocol7packets229__T15enforcePacketOKVAyaa97_433a5c55736572735c4a566f727465785c417070693330A00583D06E605A8E2962CF7375 at C:\Users\JVortex\AppData\Roaming\dub\packages\mysql-native-0.1.4\source\mysql\protocol\packets.d(48)
0x00428836 in bool mysql.protocol.commands.Command.execPrepared(out ulong) at C:\Users\JVortex\AppData\Roaming\dub\packages\mysql-native-0.1.4\source\mysql\protocol\commands.d(898)
0x00428959 in mysql.result.ResultSet mysql.protocol.commands.Command.execPreparedResult(mysql.protocol.extra_types.ColumnSpecialization[])
0x00422484 in immutable(char)[] processor.Processor.LoginUser(immutable(char)[], immutable(char)[]) at D:\D_dblayer\source\processor.d(216)
0x0042125C in immutable(char)[] processor.Processor.ProcessCommand(alfred.console.AlfredCommand) at D:\D_dblayer\source\processor.d(63)
0x0041E672 in void app.ProcessCommand(vibe.core.net.TCPConnection) at D:\D_dblayer\source\app.d(38)
0x0041E60B in void app._sharedStaticCtor5().__lambda1!(vibe.core.net.TCPConnection).__lambda1(vibe.core.net.TCPConnection) at D:\D_dblayer\source\app.d(26)
0x004828B0 in void vibe.core.drivers.libevent2_tcp.ClientTask.execute() at C:\Users\JVortex\AppData\Roaming\dub\packages\vibe-d-0.7.28\source\vibe\core\drivers\libevent2_tcp.d(593)
0x004AAF66 in void vibe.core.core.makeTaskFuncInfo!(void delegate()).makeTaskFuncInfo(ref void delegate()).callDelegate(vibe.core.core.TaskFuncInfo*) at C:\Users\JVortex\AppData\Roaming\dub\packages\vibe-d-0.7.28\source\vibe\core\core.d(499)
0x00457AB6 in void vibe.core.core.CoreTask.run() at C:\Users\JVortex\AppData\Roaming\dub\packages\vibe-d-0.7.28\source\vibe\core\core.d(1085)
0x004CAC61 in void core.thread.Fiber.run()

I'm getting my Connection variable using
auto conn = new Connection(connString);

@Abscissa
Copy link

Abscissa commented Feb 4, 2018

Can you verify this still occurs with the latest mysql-native, and also provide a test case I can use to reproduce the issue?

@masfoobar
Copy link

Hi,

I am pretty new to D and using it as an opportunity in a home project, which uses Mysql.
I have created some stored procedures but getting the same error as above.

Here is a sample code to replicate: -

/* MySQL Sproc sample to run in chosen server */

DROP DATABASE IF EXISTS mydbtest;
CREATE DATABASE mydbtest;

USE mydbtest;

DELIMITER //
CREATE PROCEDURE mysproctest (
  IN _name VARCHAR(256)
)
BEGIN

  SELECT CONCAT('Hi, ', _name) AS WelcomeNote;

END;
//
DELIMITER ;


-- test it
CALL mysproctest('francis');

/* D code -- but correct the connection string*/

    auto connectionStr = "host=localhost;port=3306;user=YOUR_USER;pwd=YOUR_PASS;db=mydbtest";
    auto conn = new Connection(connectionStr);
    Row[] rows = conn.query("CALL mysproctest('francis');").array;

Error is -
MySQL error: PROCEDURE mydbtest.mysproctest can't return a result set in the given context

Running Windows 10.

  • DMD32 D Compiler v2.084.1
  • mysql-native 2.3.0

@schveiguy
Copy link
Collaborator

Will try to reproduce when I have some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants