Hello All,
I have following SP, which has a IN and a OUT parameter:
DELIMITER $$
DROP PROCEDURE IF EXISTS `test`.`sp_test` $$
CREATE PROCEDURE `sp_test`(IN P1 INT, OUT P2 INT)
BEGIN
SET P2 = P1;
END $$
DELIMITER ;
Question:
Is it possible to call above SP inside a C++ program using MySQL's C API functions?
I tried to call following:
char* spCallStmt = "call sp_test ( ?, ? )";
After binding, then by executing, I always get trouble with the second OUT parameter:
"OUT or INOUT argument 2 for routine test.sp_test is not a variable"
Any idea?
Thanks a lot,
Mel
--------------
Some code:
int intParam1 = 0; //input parameter
int intParam2 = 0; //output parameter
MYSQL_BIND* bind = new MYSQL_BIND [2];
//First IN parameter:
bind[0].buffer_type= MYSQL_TYPE_LONG;
bind[0].buffer = (char *)&intParam1;
bind[0].is_null= 0;
bind[0].length= 0;
//Second OUT parameter:
bind[1].buffer_type= MYSQL_TYPE_LONG;
bind[1].buffer = (char *)&intParam2;
bind[1].is_null= 0;
bind[1].length= 0;
retValue = mysql_stmt_bind_param(stmtHandle, bind);
retValue = mysql_stmt_execute(stmtHandle);
//"OUT or INOUT argument 2 for routine test.sp_test is not a variable"