Thanks for the fast response Igor!

However, I tried this prepared statement:

SELECT f.fileid, f.path, m.title, m.artist, m.album, m.genre, m.comment,
m.track, m.year, m.length, m.bitrate, m.playcount, f.changed, f.size,
m.tagged FROM Files f, Meta m WHERE m.fileid=f.fileid AND f.file_exists=1AND
f.extension IN(:ext1) COLLATE STRIP_ACCENT

There's no difference if I remove the fileid comparison (those are INTEGER)
and the file_exists (also INTEGER). f.extension is a VARCHAR(255).

STRIP_ACCENT is created like this:
sqlite3_create_collation16(m_db, (const char*)L"STRIP_ACCENT",
SQLITE_UTF16LE, NULL, m_stripAccent);

Right now it doesn't do anything (just returns 1) but I would expect the
debugger to halt on my breakpoint there so it isn't called. There are no
errors when I create either the collation or the prepared statement. The
result is returned properly except that my collation isn't called.

If I add an ORDER BY COLLATE STRIP_ACCENT to the select, the collation is
called, but I'll assume that is just for determining the order and not for
the comparison when retrieving the results.

Best regards,
Jonas

On 5/25/07, Igor Tandetnik <[EMAIL PROTECTED]> wrote:

Jonas Sandman <[EMAIL PROTECTED]>
wrote:
> Can I make SQLite use a collation function when making a simple query?
> Before sending the data to LIKE I could override and for example
> strip the accent (*á' would become 'a' and 'é' would become 'e' etc).

Recent versions of SQLite support syntax like this:

select * from tableName
where field = 'blah' collate MYCOLLATION;

That is, you can specify a collation to use for each comparison.

Igor Tandetnik



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]

-----------------------------------------------------------------------------


Reply via email to