C++ Poco SQL 查询不返回具有'between'和'and'日期时间绑定的结果
C++ Poco SQL query does not return results with 'between' and 'and' datetime binding
我有以下代码,其中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:
问题已解决:发件人/收件人未正确解析,并以空值发送。
相关文章:
- 查询SQLite数据库中的日期
- 获取日期异步信号安全吗?如果在信号处理程序中使用,它会导致死锁吗
- C++核心准则 C35 对于接口类"A base class destructor should be either public and virtual, or protected and nonv
- Log4cpp:以UTC/GMT时区打印日期
- 为什么C++逐位AND运算符在不同大小的操作数中表现为这样
- 为什么 Clang 不允许"and"作为函数名称?
- 位阵列上的快速AND运算
- 使用C++的日期库读取时间
- 是否可以在 C++03 中定义'move-and-swap idiom'等效项
- 日期格式为C++
- 如何在 C++20 计时中为日期添加天数?
- BoostPython and CMake
- OpenSSL BIO and SSL_read
- 如何在QTableView中排序和更改日期格式
- 如何在cpp中使用地图显示给定日期范围内(在下面的问题中)的费率?
- Gtkmm 会不断检查 Gtk::日历上的所选日期是否发生变化
- Gurobi GRBModel and GRBmodel in C++
- std::visit and std::variant usage
- fmt 与 Howard Hinnant 的日期:为什么从 fmt::to_string "{}"?FMT 和日期的最佳实践?
- C++ Poco SQL 查询不返回具有'between'和'and'日期时间绑定的结果