C++ Poco SQL 查询不返回具有'between'和'and'日期时间绑定的结果



我有以下代码,其中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:

问题已解决:发件人/收件人未正确解析,并以空值发送。

最新更新