CLSQL timestamp Column Type

369 views Asked by At

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?

1

There are 1 answers

1
Levenson On

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 \' ?