How do you call a stored procedure that returns a result set?
Added by Eli Vatsaas 9 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?
Replies (1)
RE: How do you call a stored procedure that returns a result set? - Added by Matthias Van Ceulebroeck 5 months ago
Hello Eli
I apologize for the very late response, it has been very busy lately.
The CALL
seems to me like specific MySQL, but we indeed do not yet support stored procedures.
There is however the option to call this like SELECT FindEmployeesForShift(?) FROM employee
. I believe that should work.
Best,
Matthias