On Sun, Sep 11, 2011 at 11:55:23 -0300, Antonio Maniero wrote: > I doubt it that it would be ease to storing 8859 without string functions > problems. The proper collation would be simple, of course, but probably I > would need to re-implement all string functions too. Am I wrong? > > I can use utf8 but for me SQLite won't be lite anymore without a simple > utf8 implementation. Hopefully someone else could have a ready solution for > collation, otherwise I will do my own implementation. It will never be > correct, but it will be enough.
Actually your operating system probably provides the collation sequence and binding it for sqlite is about 5 lines of C. The only problem is that it's system specific, so it'd be quite hard to maintain in sqlite, which is probably why it's not provided. But if your application is domain-specific anyway (otherwise iso-8859-1 could never be good enough for you), it's quite easy. In Windows you'd use the 'CompareString' function (or something like that; I am not looking at MSDN). You probably need to ask sqlite to give you UTF-16 strings (it will happily convert for you even when storing as UTF-8) and select correct locale. In Unix you should be able to use either 'strcoll' or 'wcscoll' (beware, wchar_t is 32-bit in many unix compilers these days!), you just have to figure out how to set the locale before calling it. In either case the wrapping and registration with sqlite_create_collation_v2 is quite easy. > Am I the only user that need a lite implementation of SQLite with case > insensitive? Well, maybe you are one of the only two or something like that. Most users actually don't care about the collation sequence, because they neither order by strings nor use like on strings (or only use them with identifiers, that fit in ascii anyway). Most of the rest either wants the collation to be correct in all cases (so they use ICU) or go with the simplest solution (so they use ICU). The few that don't want ICU just define the collation sequences themselves. -- Jan 'Bulb' Hudec <b...@ucw.cz> _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users