denisenkom / go-mssqldb

Microsoft SQL server driver written in go language
BSD 3-Clause "New" or "Revised" License
1.82k stars 495 forks source link

mssql: support IsValid for the driver Validator interface #669

Closed kardianos closed 3 years ago

kardianos commented 3 years ago

For #586

codecov[bot] commented 3 years ago

Codecov Report

Merging #669 (1d91159) into master (3516239) will increase coverage by 0.01%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #669      +/-   ##
==========================================
+ Coverage   72.28%   72.29%   +0.01%     
==========================================
  Files          24       24              
  Lines        5469     5471       +2     
==========================================
+ Hits         3953     3955       +2     
+ Misses       1291     1290       -1     
- Partials      225      226       +1     
Impacted Files Coverage Δ
mssql.go 87.46% <100.00%> (+0.03%) :arrow_up:
token.go 60.44% <0.00%> (-0.48%) :arrow_down:
tds.go 67.21% <0.00%> (+0.38%) :arrow_up:

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 3516239...1d91159. Read the comment docs.

kardianos commented 3 years ago

This just adds the IsValid method to the connection. I haven't examined the errors that return from this.

IsValid allows database drivers to return actual error messages, rather then bogus ones.

I don't know who hasn't migrated to go1.15. However, even before IsValid, the ResetSession interface would return an bad session error. So it actually goes back further then go1.15. At this point, I would not worry about it and focus on better error messages.