gpt4 book ai didi

mysql - Ruby:Mysql 时间戳/日期时间问题

转载 作者:行者123 更新时间:2023-11-29 09:23:18 25 4
gpt4 key购买 nike

是否可以在不更改表的情况下解决“0000-00-00 00:00:00”问题?

我在此查询中包含“[]”:

dbh.select_all("select j.n, j.name, j.dsc, j.flag, j.td from job j where j.td='0000-00-00 00:00:00'")

我寻找解决方案:http://rubyforge.org/tracker/index.php?func=detail&aid=22243&group_id=234&atid=967

最佳答案

因此您的默认值是“0000-00-00 00:00:00”并且您无法更改它。我挖出了我的 ruby​​-dbi 邮件列表文件并找到了以下解释:

The problem with the latter case is that it can't be coerced to a DateTime object because it's not a valid time... Honestly, I'm surprised mysql allows it at all. Either way, you'll need to turn type conversion off (see DBI.convert_types=) to get this default value to work or change it and all occurrences of it in your database, or use bind_coltype to treat it as string instead.

参见this mailing list archive .

关于mysql - Ruby:Mysql 时间戳/日期时间问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/673855/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com