Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve truncation error message #258

Merged
merged 6 commits into from
Oct 22, 2019
Merged

Improve truncation error message #258

merged 6 commits into from
Oct 22, 2019

Conversation

Suchiman
Copy link
Contributor

@Suchiman Suchiman commented Oct 11, 2019

Brings the error message to parity with SQL Server 2016+ (trace flag) / 2019 (default).
fixes #256

@Suchiman
Copy link
Contributor Author

Suchiman commented Oct 11, 2019

Ouch 😞 CI isn't public

@cheenamalhotra
Copy link
Member

@Suchiman we'll help you out with logs till then! Public CI is WIP ✌️

@Suchiman
Copy link
Contributor Author

Just noticed that the netfx build is a distinct copy.
Unsure about Localisations other than en and de.
One could copy from the sql server translations

message_id language_id text
2628 1033 String or binary data would be truncated in table '%.*1s', column '%.*ls'. Truncated value: '%.*ls'.
2628 1031 Zeichenfolgen- oder Binärdaten werden in Tabelle "%1!", Spalte "%2!" abgeschnitten. Abgeschnittener Wert: %3!.
2628 1036 Les données de chaîne ou binaires seraient tronquées dans la table '%1!', colonne '%2!'. Valeur tronquée : '%3!'.
2628 1041 テーブル '%1!'、列 '%2!' で文字列またはバイナリ データが切り捨てられます。切り捨てられた値: '%3!'。
2628 1030 Strengdata eller binære data afkortes i tabel '%1!', kolonne '%2!'. Afkortet værdi: '%3!'.
2628 3082 Los datos binarios o de la cadena se truncan en la columna "%2!" de la tabla "%1!". Valor truncado: "%3!".
2628 1040 I dati stringa o binari verranno troncati nella tabella '%1!', colonna '%2!'. Valore troncato: (%3!).
2628 1043 Tekenreeks of binaire gegevens worden afgekapt in de tabel %1!, kolom %2!. Afgekapte waarde: %3!.
2628 2070 A cadeia de carateres ou dados binários seriam truncados na tabela "%1!", coluna "%2!". Valor truncado: "%3!".
2628 1035 Merkkijono- tai binaaritiedot katkaistaisiin taulukon %1! sarakkeessa %2!. Katkaistu arvo: %3!.
2628 1053 Sträng- eller binärdata skulle trunkeras i tabell %1!, kolumn %2!. Trunkerat värde: %3!.
2628 1029 Řetězec nebo binární data v tabulce %1!, sloupci %2! by byla zkrácena. Zkrácená hodnota: %3!.
2628 1038 A karakterlánc vagy a bináris adatok csonkolva lesznek a(z) %1! tábla %2! oszlopában. Csonkolt érték: %3!.
2628 1045 Ciąg lub dane binarne zostałyby obcięte w tabeli „%1!”, kolumna „%2!”. Obcięta wartość: „%3!”.
2628 1032 Τα δεδομένα συμβολοσειράς ή τα δυαδικά δεδομένα θα περικόπτονταν στον πίνακα "%1!", στήλη "%2!". Τιμή περικοπής: "%3!".
2628 1049 Произойдет усечение строковых или двоичных данных в столбце "%2!" таблицы "%1!". Усеченное значение: "%3!".
2628 1055 Dize veya ikili veri '%1!' tablosu, '%2!' sütununda kesilmiş. Kesilmiş değer: '%3!'.
2628 1046 Os dados de sequência ou binários estão truncados na tabela '%1!', coluna '%2!'. Valor truncado: '%3!'.
2628 1028 資料表 '%1!',資料行 '%2!' 中的字串或二進位資料將會截斷。截斷的值: '%3!'。
2628 1042 테이블 '%1!'의 열 '%2!'에 있는 문자열 또는 이진 데이터는 잘립니다. 잘린 값: '%3!'.
2628 2052 字符串或二进制数据将在表“%1!”,列“%2!”中被截断。截断值:“%3!”。
2628 1044 Streng eller binære data blir avkortet i tabellen %1!, kolonne %2!. Avkortede verdier: %3!.

@Wraith2
Copy link
Contributor

Wraith2 commented Oct 15, 2019

If always encrypted is used this may potentially leak an unencrypted input value of the field which exceeds the length into exception log files. To avoid that the value print would need to be optional and default to off.

@cheenamalhotra
Copy link
Member

Good point @Wraith2 .

@Suchiman Could you verify if data at this stage is unencrypted/raw when AE is enabled and if yes, then we'll have to take a special handle to that scenario. We should respect client's encryption mode and should not change error message in this case.

From server side, string is Encrypted when thrown in error, so that turned acceptable. From our "mocked" error message, we need to be careful.

@Wraith2
Copy link
Contributor

Wraith2 commented Oct 17, 2019

We should respect client's encryption mode and should not change error message in this case.

The change to the error message to contain the column and length is still very valuable but the truncated value would have to be omitted.

@Suchiman
Copy link
Contributor Author

So in cases where encryption is enabled, should i add a second message without Truncated value: or set truncatedValue to <encrypted>?

@Wraith2
Copy link
Contributor

Wraith2 commented Oct 17, 2019

Setting it to <encrypted> sounds reasonable to me.

Copy link
Contributor

@David-Engel David-Engel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cheenamalhotra cheenamalhotra added this to the 1.1.0-preview2 milestone Oct 22, 2019
@cheenamalhotra cheenamalhotra merged commit beaab34 into dotnet:master Oct 22, 2019
yukiwongky pushed a commit to yukiwongky/SqlClient that referenced this pull request Nov 5, 2019
yukiwongky pushed a commit to yukiwongky/SqlClient that referenced this pull request Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve SqlBulkCopy truncation error message
4 participants