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

Fix ordering of message queue messages #723

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

shueybubbles
Copy link
Contributor

In order to keep the reader channel unblocked we have to handle every done and doneInProc token by sending a MsgNextResult.

I am tempted to combine the token read and switch statements in rowsQ.NextResult and rowsQ.Next into a common helper but I don't think it will add much value. Also, as TDS evolves, they may need to diverge in behavior at some point. As written, it's fairly clear which token types each function expects to see in the stream.

@codecov
Copy link

codecov bot commented Feb 28, 2022

Codecov Report

Merging #723 (fafb9d9) into master (e538731) will decrease coverage by 0.08%.
The diff coverage is 63.41%.

@@            Coverage Diff             @@
##           master     #723      +/-   ##
==========================================
- Coverage   71.29%   71.21%   -0.09%     
==========================================
  Files          24       24              
  Lines        5386     5412      +26     
==========================================
+ Hits         3840     3854      +14     
- Misses       1301     1312      +11     
- Partials      245      246       +1     
Impacted Files Coverage Δ
mssql.go 86.82% <53.57%> (-0.93%) ⬇️
token.go 64.67% <84.61%> (+0.45%) ⬆️
tds.go 65.49% <0.00%> (-0.37%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e538731...fafb9d9. Read the comment docs.

@@ -1145,6 +1147,10 @@ func (rc *Rowsq) Next(dest []driver.Value) error {
if tok == nil {
return io.EOF
} else {
switch tokdata := tok.(type) {
case doneInProcStruct:
tok = (doneStruct)(tokdata)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

is there a more idiomatic way to combine the handling of doneInProcStruct and doneStruct?

@shueybubbles
Copy link
Contributor Author

@kardianos hi can you look at this one? I need it to unblock go-sqlcmd.

thx

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.

1 participant