MySQL Forums
Forum List  »  Connector/C++

ODBC connector use the SQLBindingParameter error
Posted by: nothing no
Date: March 17, 2017 02:27AM

I use the ODBC to connet the mysql server.
But when I use the SQLBindingParameter to bind a output data ,mysql return error code 1414.
Like this:
[MySQL][ODBC 5.3(w) Driver][mysqld-5.7.17-log]OUT or INOUT argument 3 for routine ????.user_login is not a variable or NEW pseudo-variable in BEFORE trigger (1414)

the procedure is under:
CREATE DEFINER=`root`@`localhost` PROCEDURE `user_login`(in user_name varchar(45),in user_password varchar(45),out status_code integer)
BEGIN
declare sel_result integer;
declare sel_pass varchar(45);
select count(*) into sel_result from account where Account_Name=user_name;
if sel_result=0 then
set status_code=0;
else
select Account_Password into sel_pass from account where Account_Name=user_name;
if sel_pass=user_password then
set status_code=1;
else
set status_code=2;
end if;
end if;
END


and the c++ program is under:

short status;
SQLINTEGER nameId = SQL_NTS;
RetCode = SQLBindParameter(hStmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, 45, 0, (SQLPOINTER)name.c_str(), name.size(), &nameId);
if (RetCode != SQL_SUCCESS) {
HandleDiagnosticRecord(hStmt, SQL_HANDLE_STMT, RetCode);
}
RetCode = SQLBindParameter(hStmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, 45, 0, (SQLPOINTER)password.c_str(), password.size(), &nameId);
RetCode = SQLBindParameter(hStmt, 3, SQL_PARAM_OUTPUT, SQL_C_SSHORT, SQL_INTEGER, 10, 0, &status, sizeof(char), &nameId);
if (RetCode != SQL_SUCCESS) {
HandleDiagnosticRecord(hStmt, SQL_HANDLE_STMT, RetCode);
}
RetCode = SQLPrepare(hStmt, L"{call user_login(?,?,?) }", SQL_NTS);
if (RetCode != SQL_SUCCESS) {
HandleDiagnosticRecord(hStmt, SQL_HANDLE_STMT, RetCode);
}
RetCode = SQLExecute(hStmt);
if (RetCode != SQL_SUCCESS) {
HandleDiagnosticRecord(hStmt, SQL_HANDLE_STMT, RetCode);
}

Options: ReplyQuote


Subject
Views
Written By
Posted
ODBC connector use the SQLBindingParameter error
262
March 17, 2017 02:27AM


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.