www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Problems with stored procedure using the mysql-native library.

reply TheFlyingFiddle <kurtyan student.chalmers.se> writes:
Hi

I am having problems using stored procedures that return results.

Example procedure:
CREATE PROCEDURE GetUsers()
   SELECT * FROM users;

When I use this procedure from the MySQL command line everything 
works fine. However, when I use it from the mysql-native library 
i get into problems.

int main()
{
    auto con = new Connection(...); //
    auto cmd = Command(con);
    cmd.execProcedure("GetUsers");
}

This returns the error:
MySQL error: PROCEDURE db.getusers can't return a result set in 
the given context.

Other SQL queries work fine over the connection and procedure 
calls that do not return anything also works.

How would i go about solving this problem?
Jan 18 2017
parent TheFlyingFiddle <kurtyan student.chalmers.se> writes:
On Wednesday, 18 January 2017 at 19:40:12 UTC, TheFlyingFiddle 
wrote:
 Hi

 I am having problems using stored procedures that return 
 results.
Update: I am using the SvrCapFlags.MULTI_RESULTS flag when initiating the connection and have also tried using the SvrCapFlags.MULTI_STATEMENTS flag. Unfortunately these flags do not solve the problem.
Jan 18 2017