Stored Procedure call fails with unhelpful error.
Posted by: John Cuyle
Date: February 11, 2020 07:52PM
I have a stored procedure set up in my MySQL instance.
CREATE DEFINER=`root`@`%` PROCEDURE `testProc`(
IN New_state enum('Created','Active','Cancelled','Completed','Failed','Expired','Removed'),
IN Node_id varchar(80),
IN Process_start_time datetime,
IN Task_id bigint,
IN Old_state enum('Created','Active','Cancelled','Completed','Failed','Expired','Removed') )
From MySQL workbench I can call it as you would expect using:
CALL lockTask( 'Active', 'workbench', '2020-01-30 21:14:58', 48, 'Created');
The procedure executes and I get the result set as expected. I have not been able to successfully call the procedure through the C++ connector. If I simply hard code the call in c++ it works fine:
"CALL test.lockTask( 'Active', 'testId', '2020-01-30 21:14:58', 50, 'Created' )" ).execute( );
The problem comes when I want to feed some sort of variable in. If I do the following:
"CALL test.lockTask( 'Active', 'testId', '2020-01-30 21:14:58', :Task_id, 'Created' )"
"Task_id", static_cast< int64_t >( id )
it throws the following exception:
"CDK Error: Too many arguments"
Which makes little to no sense as there are still five arguments, one is a placeholder, and I'm only trying to bind one argument. I'm kind of at a loss here, and any help would be appreciated. Thanks.