-
-
Notifications
You must be signed in to change notification settings - Fork 212
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
Size of char (maybe varchar) is wrong in multiple client library [CORE5587] #5854
Comments
Commented by: @aafemt As designed. XSQLDA.sqllen is max size of data in bytes. |
Commented by: @asfernandes If you can, set the field (in code, not in database) to be described as VARCHAR (SQL_VARYING). If you can't, tell your driver developer to do it internally (it can still report for you that field is of type CHAR). |
Commented by: Reydy Valentin (lifeoryou) What did you mean ? |
Modified by: Reydy Valentin (lifeoryou)summary: Size of char (maby varchar) is wrong in multiple client library => Size of char (maybe varchar) is wrong in multiple client library |
Commented by: @mrotteveel This is not a bug. A char(3) character set UTF8 takes 3 * 4 = 12 bytes storage (as a UTF-8 character takes 1 - 4 bytes). This is communicated from server to client in a datastructure called (X)SQLDA. The sqllen contains the (max) length in bytes of a field. When using Java/Jaybird 2.2 and earlier it **will** report the correct length **if** you have specified a connection character set. But if you haven't, you will be using character set NONE and it will report the length in bytes instead. In Jaybird 3 it will report the correct size even with none. I can't speak for the PHP specifics, but it is possible it works the same and you just need to specify a connection character set. |
Commented by: Reydy Valentin (lifeoryou) Humm ok. Thank Effectivly in Java/Jaybird 3, it's corrected and i recive good string. I post a issue in their tracker. Thanks all guys |
Modified by: @pcisarstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: Reydy Valentin (lifeoryou)
After lot of test, when a query return a char column type in returned columns. I think the size of string is multiplicate by the length bit of charset for one char.
For exemple when i select a char(3) in utf8 charset, i recive a string of size 12.
I test it in php and Java and i have the same bug.
If you want more specifics, i can you get more.
The text was updated successfully, but these errors were encountered: