gpt4 book ai didi

mysql - CLSQL 时间戳列类型

转载 作者:行者123 更新时间:2023-11-29 14:53:43 24 4
gpt4 key购买 nike

我正在将 CLSQL 与 MySQL 结合使用。我必须将什么关键字组合传递给 create-table 才能为其提供具有时间戳列类型的列?

(create-table [foo] `(([bar] timestamp)))

无法识别(它只是创建一个 varchar 255 列,如果您不指定列类型,则这是默认值)。根据this reference page , wall-time 应该创建一个时间戳列,但只是创建一个 datetime (这与 MySQL timestamp 不同)。

此外,是否有比我上面链接的更好的 CLSQL 列类型引用?

最佳答案

为什么不想使用日期时间?我发现的唯一区别是范围。看看here

The DATETIME type is used when you need values that contain both date and time information. MySQL retrieves and displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format. The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'.

The TIMESTAMP data type has a range of '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC.

如果你查看clsql的来源,例如here ,你会看到

  (defmethod database-get-type-specifier ((type (eql 'wall-time)) args database
(db-type (eql :mysql)))
(declare (ignore args database))
"DATETIME")

这意味着您的代码一切正常。您使用什么引号 ` 或简单引号\' ?

关于mysql - CLSQL 时间戳列类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5147296/

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