2010/12/8 Dagdamor <dagdamo...@mail.ru> > john darnell <john.darn...@walsworth.com> писал(а) в своём письме Wed, 08 > Dec 2010 02:23:53 +0600: > > > I cannot find a reference to "enum" in any SQLite documentation. Hmm. > > I suppose I could write a quick little function and use it as the > > Default... > > Hmm, there is a useful function called "ELT" in some databases, > it could work for you. For example, ELT(myfield,'alpha','beta','gamma') > would return 'alpha' if myfield=1, 'beta' if myfield=2 and 'gamma' > if myfield=3. The reverse function to ELT is FIELD, for example, > FIELD(myvalue,'alpha','beta','gamma') would return 2 if myvalue='beta'. > > Although, I'm not sure once again if SQLite supports these two functions > (I'm only getting familiar with SQLite myself). >
Good idea, one already can implement those as user functions ( http://www.sqlite.org/c3ref/create_function.html). I once created for example find_in_set, it was very easy to implement. Sure, if the developer have plans to extend the number of elements, it's not that easy to modify all existing queries at once. Find_in_set is good in this way since the comma-separated list can be stored as an element in a settings table. As I recall I implemented a reverse function to find_in_set, but had to come up with a name since did not find the corresponding function in mysql. Max Vlasov _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users