steffengy / tiberius

TDS 7.4 (mssql / Microsoft SQL Server) async driver for rust. Fork at: https://github.com/prisma/tiberius
Apache License 2.0
151 stars 2 forks source link

error: 'The chunking format is incorrect for a large object parameter of type 0xE7' with nvarchar(max) #90

Closed bbigras closed 5 years ago

bbigras commented 5 years ago

I'm trying to insert a String of 22895 length into a nvarchar(MAX).

tiberius 0.3.1

Microsoft SQL Server 2014 (SP1-GDR) (KB4019091) - 12.0.4237.0 (X64) 
    Jul  5 2017 22:03:42 
    Copyright (c) Microsoft Corporation
    Standard Edition (64-bit) on Windows NT 6.3 <X64> (Build 9600: ) (Hypervisor)
Server(TokenError { code: 8007, state: 1, class: 16, message: "The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 4 (\"@P1\"): The chunking format is incorrect for a large object parameter of type 0xE7.", server: "<some sql server name>", procedure: "", line: 1 })
bbigras commented 5 years ago

I was able to reproduce with the docker image.

test case dc7a34484c2a6d09bb29699f246f2f52e6e949da

The problem doesn't seem to happen when I use 2000 instead of 3000

let some_string = "é".repeat(3000);

It's possible it's not even a bug. Maybe it's a MSSQL limitation or that I'm not using the right collation for the special characters.

docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=testtestT9' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2017-CU8-ubuntu

export TIBERIUS_TEST_CONNECTION_STRING="server=tcp:localhost,1433;username=sa;password=testtestT9;TrustServerCertificate=true"

cargo test test_bug_90
---- tests::test_bug_90 stdout ----
thread 'tests::test_bug_90' panicked at 'called `Result::unwrap()` on an `Err` value: Server(TokenError { code: 8007, state: 1, class: 16, message: "The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 4 (\"@P1\"): The chunking format is incorrect for a large object parameter of type 0xE7.", server: "7d44b9659dc3", procedure: "", line: 1 })', src/libcore/result.rs:997:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

rustc 1.33.0-nightly (19f8958f8 2019-01-23)

bbigras commented 5 years ago

It works. Thanks!!