-
Notifications
You must be signed in to change notification settings - Fork 63
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
BoundsError Issue when converting to DataFrames regression #306 #328
Comments
I've opened the PR again; but you're saying it doesn't fix the issue? |
It does work with the PR, meaning it doesn't explode, but it returns a truncated version of the string. I think there is an underlying encoding issue. |
I've just hit this issue. The string that triggers it is "Lokalt prøvenr.: IKKE ANGIVET Uoplyst prøvetagningsdato Overføres til konto 65", and the index error is |
Bump - is there any MWE or similar I can provide to have this resolved? It seems to be a matter of characters vs. codeunits. The aforementioned field in my database has Supporting this hypothesis, changing line 355 in |
I've been able to work around this by casting the result into a
This is not a solution (As you can't use sql's |
Fixes #328. Ok, a bit nasty, but here's the rundown: * This is mostly outlined [here](https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlgetdata-function?view=sql-server-ver16#retrieving-data-with-sqlgetdata) * The issue is that for our result set, the cursor may be told that a give column has a certain size in bytes, particularly for variable-sized columns like VARCHAR * BUT, the driver then may have to "convert to the target type" and this conversion may result in the _actual_ data size being larger than we orignally allocated for * But wait, you may ask, don't we already account for this case [here](https://github.com/JuliaDatabases/ODBC.jl/blob/f38f771557a5763f777ed0f441c2cc5a72f41c70/src/utils.jl#L328) by resizing the buffer and calling SQLGetData again to retrieve the rest of the data? * Why yes, we do, but only for "long" data types, which is the primary use case for the multiple SQLGetData calls * So basically this is _another_ case where, totally depending on the db driver, we might end up with truncated data which will result in `API.SQL_SUCCESS_WITH_INFO` being returned from SQLGetData Thankfully the fix is relatively easy: we just need to use our buffer-resizing branch if the data type is long OR SQLGetData returns this success with info status code.
* Fix case when SQLGetData data size exceeds column size Fixes #328. Ok, a bit nasty, but here's the rundown: * This is mostly outlined [here](https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlgetdata-function?view=sql-server-ver16#retrieving-data-with-sqlgetdata) * The issue is that for our result set, the cursor may be told that a give column has a certain size in bytes, particularly for variable-sized columns like VARCHAR * BUT, the driver then may have to "convert to the target type" and this conversion may result in the _actual_ data size being larger than we orignally allocated for * But wait, you may ask, don't we already account for this case [here](https://github.com/JuliaDatabases/ODBC.jl/blob/f38f771557a5763f777ed0f441c2cc5a72f41c70/src/utils.jl#L328) by resizing the buffer and calling SQLGetData again to retrieve the rest of the data? * Why yes, we do, but only for "long" data types, which is the primary use case for the multiple SQLGetData calls * So basically this is _another_ case where, totally depending on the db driver, we might end up with truncated data which will result in `API.SQL_SUCCESS_WITH_INFO` being returned from SQLGetData Thankfully the fix is relatively easy: we just need to use our buffer-resizing branch if the data type is long OR SQLGetData returns this success with info status code. * bump some versions and update ci
#306
ODBC v1.0.4, julia 1.7
The violating character is
\xce\0
Branch
jq/fixdec
works normally."Select @@version"
givesMicrosoft SQL Server 2014 - 12.0.2269.0 (X64) \n\tJun 10 2015 03:35:45 \n\tCopyright (c) Microsoft Corporation\n\tExpress Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)\n"
Update: The violating character is not
\xce\0
that's what the branchjq/fixdec
shows. The correct string is much weirder, it's"Α ΕΛΕΥΘΕΡΩΝ ΕΠΑΓΓΕΛΜΑΤΩΝ ΑΘΗΝΩΝ"
vs"A ΕΛΕΥΘΕΡΩΝ ΕΠΑΓΓΕΛΜΑΤΩΝ Α\xce\0"
. Collation isGreek_CI_AS
and max_size = 50.Most likely this is an encoding issue. The error mentions something about accessing positions 1-59 of string with 50 characters.
The text was updated successfully, but these errors were encountered: