Возникла необходимость реализовать естественную сортировку чтобы, например, из набора:
получить:
Начав искать наткнулся на sqlite3_create_collation, а также на то что с поставляемым вместе с Qt sqlite этой функцией воспользоваться не получится.
Здесь
http://www.mimec.org/node/296 нашел возможное решение проблемы:
When writing a cross-platform program which does not rely on Qt being built in any particular configuration, our only solution is to handle the third, most generic case. Fortunately the authors of SQLite make it easy to integrate it with any application by publishing the source code "amalgamated" into one source file and one header and the only disadvantage of such solution is the large size of the SQLite code.
When we include our own copy of SQLite, the program will compile fine, but it still may crash when started. The reason is that the QSQLiteDriver, which is part of Qt, will use its own copy of SQLite and our program will refer to a different copy. Each copy will use a separate set of global variables which are needed for synchronization and our copy will try to access some uninitialized objects resulting in the runtime error.
Unfortunately to make this work we need to not only use our own copy of SQLite but also our own copy of the QSQLiteDriver. We should copy the files containing QSQLiteDriver (which can be found in src/sql/drivers/sqlite folder of Qt sources) and also the sources of the internal QSqlCachedResult class (from src/sql/kernel) which is its base class to our program and change the names of these classes by removing the 'Q' prefix to prevent potential conflicts.
Но не совсем понял как заставить это работать. Нужно будет править pro-файл и собирать свой
QSQLiteDriver?
Может есть какие-то другие варианты решения проблемы?