Quantcast
Channel: MySQL Forums - Connector/C++
Viewing all articles
Browse latest Browse all 527

Stored Procedure call fails with unhelpful error. (no replies)

$
0
0
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.

Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>