Project

General

Profile

How do you call a stored procedure that returns a result set?

Added by Eli Vatsaas 2 months ago

I am trying to run a stored procedure stored on a MySQL server. When running the code:

    auto q = session.query<dbo::ptr<Employee>>("CALL FindEmployeesForShift(?)").bind(1);
    auto results = q.resultList();

    for (Wt::Dbo::ptr<Employee> employee : results)
    {
        std::cout << " Employee " << employee->firstName << " " << employee->lastName << " can work shift 1" << std::endl;
    }

I receive this error:

libc++abi: terminating due to uncaught exception of type Wt::Dbo::Exception: Error parsing SQL query: "CALL FindEmployeesForShift(?)"
Abort trap: 6

I cant find any examples using session.query for a stored procedure but the documentation says its possible. Does anyone know what I'm doing wrong?