Freebsd 8.0 amd64、mysql-client-5.1.61、mysql-connector-c++-1.1.0、mysql-server-5.1.61、および gcc 4.2.1 を使用しています。
stmt->execute("CREATE PROCEDURE p(OUT retval VARCHAR(50)) BEGIN SELECT \"Ulf joined MySQL more than 5 years ago\" INTO retval; END;");
pstmt.reset(con->prepareStatement("CALL p(@output)"));
pstmt->execute();
pstmt.reset(con->prepareStatement("SELECT @output AS _answer"));
res.reset(pstmt->executeQuery());
while (res->next())
cout << "\t... _answer: " << res->getString("_answer") << endl;
そして、これはそうではありません
stmt->execute("CREATE PROCEDURE p(OUT retval VARCHAR(50),OUT retval1 VARCHAR(50)) BEGIN SELECT \"Ulf joined MySQL more than 5 years ago\" INTO retval;SELECT \"Ulf joined MySQL more than 5 years ago\" INTO retval1; END;");
pstmt.reset(con->prepareStatement("CALL p(@out1,@out2)"));
pstmt->execute();
pstmt.reset(con->prepareStatement("SELECT @out1 AS vOut,@out2 as vOut2"));
res.reset(pstmt->executeQuery());
while (res->next())
cout << res->getString("vOut1") << res->getString("vOut2") << endl;
何ERR: MySQLPreparedResultSet::getString: invalid 'columnIndex' (MySQL error code: 0, SQLState: )
が問題なのですか?