vert-x / mod-mysql-postgresql

Vert.x 2.x is deprecated - use instead
http://vertx.io/docs/vertx-mysql-postgresql-client/java/
Apache License 2.0
49 stars 17 forks source link

Error while calling MySQL Stored Procedure #34

Open fjordansilva opened 10 years ago

fjordansilva commented 10 years ago

Hi I'm using this great module in my project but I'm getting an error when I call to stored procedures in MySQL (v5.6.16)

// STORED PROCEDURE: DROP PROCEDURE IF exists helloWorld; DELIMITER $$ CREATE PROCEDURE helloWorld () BEGIN SELECT user_id, user_name FROM gbl_users; END $$

// ERROR: Received an error message -> ErrorMessage(1312,#0A000,PROCEDURE alfrescodb.helloWorld can't return a result set in the given context)

I'm calling the procedure as a "raw" sql. { "action": "raw", "command": "call helloWorld()" }

ghost commented 10 years ago

I have the same problem, too.

Narigo commented 10 years ago

Sorry, we didn't come around creating and testing stored procedures yet. We'll release 0.3.0 shortly with new driver version, so maybe it will already help.

Zwergal commented 10 years ago

When you want to return data from a procedure you have to use an out parameter. Look here for an example: http://stackoverflow.com/questions/23354160/phpmyadmin-run-mysql-stored-procedure-but-no-output

One problem is, that you can't execute two queries in one raw statement with this module. So it is not possible to query call helloWorld(@a); select @a;. One workaround is to use a transaction and call one query after the other in a transaction.

I got a problem when I try to create a stored procedure with the driver. I talked to Mauricio and he will investigate on that. See here: https://github.com/mauricio/postgresql-async/issues/102

mrkam commented 9 years ago

Both issues are really annoying: that you cannot execute stored procedures and that you cannot send multiple statements with the single raw command. Looks like they both have the same solution and it also seems to be simple.