There seem to be some issues in Erlang ODBC relating to nvarchar(MAX)
and varchar(MAX)
.
For example running SELECT 'Bob' [name], 50 [age] FOR JSON PATH
should give the following:
JSON_F52E2B61-18A1-11d1-B105-00805F49916B
-----------------------------------------
[{"name":"Bob","age":50}]
Erlang ODBC produces:
{:selected, ['JSON_F52E2B61-18A1-11d1-B105-00805F49916B'],
[
[
<<0, 0, 80, 0, 114, 0, 111, 0, 75, 246, 34, 87, 97, 33, 0, 128, 32, 0, 70, 0, 105, 0, 108, 0, 74, 246, 33, 87, 92, 34, 0, 128, 105, 0, 99, 0, 114, 0, 111, 0, 73, 246, 32, 87, 102, 35, 0, 128, 32,
0>>
]
]}
and on another run ...
{:selected, ['JSON_F52E2B61-18A1-11d1-B105-00805F49916B'],
[[<<0, 0, 0, 0, 0, 0, 0, 0, 207, 63, 70, 190, 0, 5, 0, 142, 0, 0, 0, 0, 0, 0, 0, 0, 204, 63, 69, 190, 253, 6, 0, 138, 7, 0, 0, 0, 67, 0, 0, 0, 205, 63, 68, 190, 0, 7, 0, 137, 112, 97>>]]}
I'm using the following connection settings:
timeout: 30_000,
auto_commit: :on,
binary_strings: :on,
tuple_row: :off,
scrollable_cursors: :off,
trace_driver: :off,
extended_errors: :on
The output of the FOR JSON
clause is of type nvarchar(MAX)
.
Please are there any workarounds for handling issues with nvarchar(MAX)
in Erlang ODBC.
1条答案
按热度按时间vmpqdwk31#
有一种解决方案可以很好地在Windows上运行:通过ODBC使用OLEDB提供程序,如下所示