MySQL Forums
Forum List  »  Connector/C++

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:

session->sql(
"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:

session->sql(
"CALL test.lockTask( 'Active', 'testId', '2020-01-30 21:14:58', :Task_id, 'Created' )"
).bind(
"Task_id", static_cast< int64_t >( id )
).execute( )

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.

Options: ReplyQuote


Subject
Views
Written By
Posted
Stored Procedure call fails with unhelpful error.
865
February 11, 2020 07:52PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.