为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】:V8 (Build 2022.05.18)
【操作系统】:Win 11 X64
【CPU】:Intel® Core™ i5-10500 CPU
【问题描述】*:使用Go驱动,日期作为查询条件,无法正常查询
例如
select * from zorm.logs where created_at between '2022-09-01 00:00:00' and '2023-10-01 00:00:00'
在查询分析器里可以查到正常结果,如果使用程序查询
start, _ := time.Parse("2006-01-02 15:04:05", "2022-09-01 00:00:00")
end, _ := time.Parse("2006-01-02 15:04:05", "2023-10-01 00:00:00")
finder := NewFinder().Append("SELECT * FROM logs WHERE created_at BETWEEN ? AND ? order by created_at asc ", start, end)
使用time对象作为参数进行查询,实际数据库中大于2022-09-01 08:00:00
的数据才能被正常查询.
同样的程序和数据,换mysql就能正常查询2022-09-01 00:00:00
的数据.
达梦数据库设置的是+8时区,估计应该是go驱动的问题,麻烦修复一下,非常感谢.
最新的8.1.2.162驱动已解决这个问题,已经更新到 gitee.com/chunanyong/dm v1.8.9
你好 可能是客户端时区设置问题,参考一下这个:
https://eco.dameng.com/community/article/a8b161761bdac937087dab19c5529d6f