On 12/11/07, Maxim V. Shiyanovsky <[EMAIL PROTECTED]> wrote:

> One more question - is there any way to insert utf-16 string from
> sqlite3.exe?
> As I understand I can't use syntax like this:
> insert into t values (X'31003700', 1);

No; the sqlite3 shell deals only in UTF-8, which is hard to make work
on Windows because the console doesn't have proper support for it.

However, it does perform casts from BLOB to TEXT by treating the blob
as a set of bytes in UTF-8 form, so that could be used as an escape
syntax:

    insert into t values(X'3137', 1);

But since these characters are in the ASCII range anyway, you might as
well just enter them as plain text:

    insert into t values('17', 1);

(That also explains the "first digit" trouble you were having: null
bytes are not allowed in strings, so the final TEXT form only
contained one character. It was a happy coincidence that you were
using characters from the ASCII range, and UTF-16 in little endian
form as the input bytes.)

> As I wrote in the first letter I need cast from utf-16 text to int.
> In other words I need select like this:
> Select * from t, d where cast(t.value as int) = d.id

With the above in mind, this should work now.

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

Reply via email to