Support UTF-8 text

This commit is contained in:
Alexey Romanov
2011-03-11 18:16:03 +03:00
parent b677cb45e8
commit 6b9523d7d3
2 changed files with 13 additions and 5 deletions

View File

@@ -46,7 +46,8 @@ all_test_() ->
?FuncTest(escaping),
?FuncTest(select_many_records),
?FuncTest(nonexistent_table_info),
?FuncTest(large_number)]}.
?FuncTest(large_number),
?FuncTest(unicode)]}.
open_db() ->
sqlite3:open(ct, [in_memory]).
@@ -208,6 +209,13 @@ large_number() ->
?assertEqual([{N1, N2}], rows(sqlite3:sql_exec(ct, Query2, [N1, N2]))),
?assertNot([{N1 + 1, N2 - 1}] == rows(sqlite3:sql_exec(ct, Query2, [N1 + 1, N2 - 1]))).
unicode() ->
UnicodeString = [1102,1085,1080,1082,1086,1076], %% "Unicode" in Russian, in UTF-8
drop_table_if_exists(ct, unicode),
sqlite3:create_table(ct, unicode, [{str, text}]),
sqlite3:write(ct, unicode, [{str, UnicodeString}]),
?assertEqual([{unicode:characters_to_binary(UnicodeString)}], rows(sqlite3:read_all(ct, unicode))).
prepared_test() ->
Columns = ["id", "name", "age", "wage"],
Abby = {1, <<"abby">>, 20, 2000},