CLSQL 时间戳列类型

发布于 2024-10-20 04:32:24 字数 430 浏览 2 评论 0原文

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

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

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

另外,是否有比我上面链接的更好的 CLSQL 列类型参考?

I'm using CLSQL with MySQL. What combination of keywords do I have to pass to create-table in order to give it a column with the timestamp column type?

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

is unrecognized (it just creates a varchar 255 column, which is the default if you don't specify a column type). According to this reference page, wall-time should create a timestamp column, but just creates a datetime (which is not the same thing as a MySQL timestamp).

Also, is there a better CLSQL column type reference than the one I linked above?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

離人涙 2024-10-27 04:32:24

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

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的来源,例如 这里,你会看到

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

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

Why don't you want to use datetime? The only difference which I found is the range.
Take a look 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. 

If you look at the sources of clsql, for example here, you will see

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

It means that everything is fine with your code. What quote do you use a back-quote ` or simple quote \' ?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文