-
Notifications
You must be signed in to change notification settings - Fork 317
[DRAFT] Add tests for HasRows + Mutliple INFO tokens #3744
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
base: main
Are you sure you want to change the base?
Conversation
- Added tests for SqlDataReader.HasRows for responses with and without INFO tokens.
- Added comments.
paulmedynski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commentary for reviewers.
| /// </summary> | ||
| public QueryEngine(TdsServerArguments arguments) | ||
| { | ||
| Log = arguments.Log; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ensures the engine has its Log set, regardless of what TdsServer may decide.
| TDSInfoToken infoToken = new TDSInfoToken(2012, 2, 0, lowerBatchText); | ||
| // Create an info token that contains the verbatim query text we | ||
| // received (not the lower-cased version). | ||
| TDSInfoToken infoToken = new TDSInfoToken(2012, 2, 0, batchRequest.Text); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now the query text in the INFO matches what the test actually sent.
| /// Constructor with a query engine. Uses the engine's servers arguments. | ||
| /// </summary> | ||
| /// <param name="queryEngine">Query engine</param> | ||
| public TdsServer(QueryEngine queryEngine) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convenience constructor to avoid having to specify ServerArguments twice in the test.
| { | ||
| Log(log, string.Format("{0}[{1}]", prefix, index++), o); | ||
| SerializedWriteLineToLog(log, string.Format("{0}: <null>", prefix)); | ||
| log.Flush(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added missing Flush() calls.
| log.WriteLine(string.Format("[{0}] {1}", DateTime.Now, text)); | ||
| } | ||
| var now = DateTime.UtcNow; | ||
| log.WriteLine($"[{now:yyyy-MM-dd hh:mm:ss.fff}Z] {text}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better timestamp formatting, and changed to UTC.
|
|
||
| // We should have read past the INFO tokens and determined that there | ||
| // are row results. | ||
| Assert.True(reader.HasRows); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was expecting this to fail for infoCount > 1 based on #3018, but it passes. I will investigate further.
- Added placement of INFO tokens as start, middle, and end of the response stream to elicit failures.
- Pinpointed the failing cases and have allowed them to pass for now, with TODOs to address if/when we make a fix to SqlDataReader.
Description