0

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 Answer 1

1

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

1
  • A MySQL TIMESTAMP can be set to automatically update each time its record is UPDATEd. A DATETIME has to be set explicitly.
    – Inaimathi
    Aug 15, 2011 at 18:08

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.