Kurt Welgehausen said: >> SQLite doesn't support enums natively. You could emulate it using >> triggers, although it would be somewhat hidden and definitely a pain in >> the tucus to use. > > It's not really so hard. > > create table MainTbl ( > ... > EnumCol SomeType references EnumVals, > ...); > > create table EnumVals (val SomeType); > > Now you have to enforce the foreign key with a trigger. > > create trigger EnumTrg before insert on MainTbl for each row > when (select count(*) from EnumVals where val = new.EnumCol) = 0 begin > select raise(rollback, 'foreign-key violation: MainTbl.EnumCol'); > end;
That's a lot more elegant than what I had envisioned, which was a static list of values. Don't forget though that you'll also need to write an update trigger, since it's pretty easy to write "UPDATE MainTbl SET EnumCol='bogus'" Clay Dowling -- Simple Content Management http://www.ceamus.com