我有以下代码,其中from和to作为std :: string&传递,它们是SQL db表中的日期时间,例如2019-04-10
如果我运行以下命令,则不会返回任何结果:
sql_select << "SELECT asset, sum(amount*price) as total_cost,
sum(amount) as total_amount FROM tradehistory_bitfinex where uid = ?
and exchange = ? and time between ? and ? group by asset",
Poco::Data::Keywords::into(portfolio),
Poco::Data::Keywords::bind(uid),
Poco::Data::Keywords::bind(exchange);
//Poco::Data::Keywords::bind(from),
//Poco::Data::Keywords::bind(to);
如果我运行以下命令,它将正确返回结果:
sql_select << "SELECT asset, sum(amount*price) as total_cost,
sum(amount) as total_amount FROM tradehistory_bitfinex where uid = ?
and exchange = ? and time between '2019-04-10' and '2019-04-10'
group by asset",
Poco::Data::Keywords::into(portfolio),
Poco::Data::Keywords::bind(uid),
Poco::Data::Keywords::bind(exchange);
//Poco::Data::Keywords::bind(from),
//Poco::Data::Keywords::bind(to);
日期时间/字符串绑定似乎有问题。
谢谢。
GoQuestion: