At 11:32 AM -0500 3/25/04, rich coco wrote:
Used in many places are column definitions like this:

replay enum('none','public','private') default NULL,

SQLite apprarently does not support the enum keyword?
(It's not listed in the 'Datatypes in SQLite' man page).
or does it?

Hmmm...if ENUM was not supported, I would have expected
the error to be 'SQL error: near "enum"...'

As far as I know, ENUM is not part of standard SQL, but is a vendor-added extension such as by MySQL.


I believe that the SQL-1999 standard addresses the same problem using a broader concept called 'domains', which is where you can declare a pseudo-data-type that starts with a normal one but is more restrictive. For example, you would declare a domain called 'sex' which is defined as a character data type that can only contain the values 'M' and 'F'. That part of domain declarations can look sort of like 'check' constraints that some databases like Oracle support.

Now, considering that SQLite is typeless and doesn't actually restrict what you enter into any field, you will have to either use a foreign key constraint on a new table to restrict the field values to the 3 you want, or you will have to enforce your constraint in the application. Either way, you simply declare a varchar field in SQLite.

-- Darren Duncan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to