-
Notifications
You must be signed in to change notification settings - Fork 499
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
Unexpected token COLMETADATA #138
Comments
I've been trying to wrap my head around this problem for a little while now. I have a noisy query that's been doing the same thing to me, temp tables, intermediate selects, a select coalesce, etc. I threw some log statements into the tokenizer because it seems to be there that I'm blowing up. If I wrap all the preliminary 'noisy' part of the query into a It seems there's a token pattern with some noisy queries that closes the token channel before all of the select like data is done being parsed so when the real result at the end of the stream sends it's column data, the parser gets unexpected data. I believe this is the offending section of the code, but I haven't looked at it long enough to figure out how to ignore initial 0xFD tokens: Lines 386 to 403 in f6e253f
I dumped the tokens during execution and found patterns that work and patterns that break. But I don't know enough about TDS (yet anyway) to know exactly how this is breaking the parser. Works
Breaks
It appears that some operations, in this case assignment instead of just declaration are throwing a tokenDone byte probably attached to a return value of some sort ie variable assignment ok that's throwing off the parser when it gets to the real data. So patterns that don't work are anything that throws a a bunch of 0xFD (tokenDone) in the setup of the query:
This pattern below seems to work in all cases, you can work around the error by cramming all the variable assignments into a single statement in a transaction and then then querying your result in a separate call.
As opposed to:
|
Please try to remove these two lines: Lines 265 to 266 in f6e253f
Sorry I cannot test this change right now. |
That worked for my 'noisy' query. It doesn't appear to have broken any of my other endpoints either. |
Merged pull-request with a fix and added unit-test. |
add mongodb to readme
* Fix: Handle extended chars in SQL instance names
I'm running the simple.go example. I made a change to the SQL:
I get an error back
It appears to be the SET NOCOUNT ON that's causing the problem. I've tested with
and that works fine. But
returns the same error.
I've tried poking around in the source code but I'm brand new to GO and I can't track it down., Also, if I wrap the bad statement in an EXEC it works fine.
The text was updated successfully, but these errors were encountered: