On 8 Oct 2014, at 1:22pm, Stephen Chrzanowski <pontia...@gmail.com> wrote:

> Can one not also put a constraint up on the field to say that the field can
> only be of a certain value, kind of to emulate ENUM?

Sure you can.  You can do anything expressible in SQL which turns into a 
BOOLEAN value.  Use a CHECK constraint:

<https://www.sqlite.org/syntaxdiagrams.html#table-constraint>

It can even compare two fields in the same row and test one against the other 
so you can, for example, make sure you don't have any people who are both male 
and pregnant.

You can also use FOREIGN KEYS to check that a value entered in a field really 
does point to a row in another table.

Unfortunately neither of these things fulfill your original request.  If the 
data fails these checks and is rejected, you just get a standard error code.  
It doesn't name the constraint which was failed.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to