Wednesday, 15 September 2010

sqlite3 - unicode() for all characters of a query -



sqlite3 - unicode() for all characters of a query -

the unicode() function in sqlite accepts 1 parameter; if execute query:

select unicode(text) table

and suppose table has 1 row abc; result be: 97 numeric unicode code a character; if want numeric unicode code characters in result of query? such thing possible within sqlite?

(i know can numerical codes out of sqlite within environment of programming language; i'm curious if such thing possible sql command within sqlite or not.)

sqlite not have looping constructs; doing in programming language much easier.

in sqlite 3.8.3 or later, utilize recursive common table expression:

with recursive all_chars(id, u, rest) ( select id, unicode(text), substr(text, 2) mytable union select id, unicode(rest), substr(rest, 2) all_chars rest <> ''), unicodes(id, list) ( select id, group_concat(u) all_chars grouping id) select * unicodes

the id required merge values of single source row together; doing single, specific row in mytable easier.

unicode sqlite3

No comments:

Post a Comment