Erlang ODBC & Unicode

Juhani Ränkimies <>
Tue Jun 9 13:37:04 CEST 2009


Hi,

On Tue, Jul 29, 2008 at 10:50 AM, Ingela Anderton Andin <
> wrote:

> I put support for "SQL_UNICODE-types"  corresponding types for nvarchar
> and friends on the wish list
> for odbc.   Even though it is not a very big job it does not come on top
> of the priority list, so if anyone
> wants it badly I would like to encourage you to make a
> patch-contribution. Otherwise we will get around to it sometime ...
> probably in a somewhat distant future.
>

This bit me pretty badly, so I took a stab at it.

I modified odbc module to support SQL_WVARCHAR (NVARCHAR) fields and it
would appear to work on XP with MS SQL Server 2008.

Unicode text has to be provided as little endian utf16 binaries.

odbctest.erl shows the extent (lack) of testing. Below, is the output....
-------------------------------------------------------------
Erlang R13B (erts-5.7.1) [source] [rq:1] [async-threads:0]

Eshell V5.7.1  (abort with ^G)
1> c(odbctest).
{ok,odbctest}
2> odbc:start().
ok
3> odbctest:test().

=INFO REPORT==== 9-Jun-2009::14:00:34 ===
    test_describe: {ok,[{"a",{sql_wvarchar,50}}]}
    test_select: []
    test_insert: {updated,12}
    test_select: [<<"ÖÄÅÄÖÅäöå">>,<<"testasdf">>,<<"Row 3">>,<<"Row 4">>,
                  <<"Row 5">>,<<"Row 6">>,<<"Row 7">>,<<"Row 8">>,<<"Row
9">>,
                  <<"Row 10">>,<<"Row 11">>,<<"Row 12">>]
ok
4>
-------------------------------------------------------------

Regards,
Juhani
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090609/d0fd0bcb/attachment.html>


More information about the erlang-questions mailing list