我可以在 MySQL 查询中调用函数吗?更详细地考虑考虑我有一个函数返回客户的 account_id
int return_account_id(){
return (account_id);
}
现在我可以在我的查询中调用这个函数了吗?可能吗?
`resultset = statement->executeQuery("SELECT `account_id`, `acc_name` FROM `account` WHERE `account_id` = "return_account_id()" ");
最佳答案
为什么不这样:
#include <sstream>
stringstream query;
query << "SELECT * FROM account WHERE account_id = " << return_account_id() << ";";
resultset = statement->executeQuery(query.str());
关于c++ - 我可以在 mysql 查询中调用函数吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18421805/