-
Notifications
You must be signed in to change notification settings - Fork 67
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 GUID conversion #207
base: main
Are you sure you want to change the base?
Fix GUID conversion #207
Conversation
c376f79
to
9b50b3e
Compare
types.go
Outdated
@@ -455,6 +455,25 @@ func writeByteLenType(w io.Writer, ti typeInfo, buf []byte) (err error) { | |||
return | |||
} | |||
|
|||
func writeGuidType(w io.Writer, ti typeInfo, buf []byte) (err error) { | |||
if !(ti.Size == 0x10 || ti.Size == 0x00) { | |||
panic("Invalid size for BYTELEN_TYPE") |
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.
for guid type?
7fcf586
to
8dbf84e
Compare
It's why the driver has its own |
I think we could take this, as long as we document the breaking change in the readme and CHANGELOG.md. |
also - see if frameworks like gorm have implemented any workarounds like reordering the slice already. They'll need to undo those workarounds if they pick up a version with this fix. Filing an issue against them could remind them to do so. |
another option is to make the behavior dependent on a connection string property, and new apps would set it, or a Connector property, etc. |
@shueybubbles, thanks for your comments. |
35ec6b8
to
84e7b5a
Compare
@shueybubbles I've implemented the management of a new parameter in the connection string, named "guid conversion", to enabled the proper conversion of GUID; I've also duplicated involved tests so that they are executed both with and without this parameter.
|
@shueybubbles, could you please help in fixing tests as I explained in the previous comment? |
Sorry, I've not had much time to work on these driver issues lately. I will try to make some time in the next couple weeks. |
ok, thank you |
bc8ab37
to
236ed76
Compare
I updated the PR, now I've solved the handling of TVP.encode, but it still fails the one about nullable Uniqueidentifier. |
@shueybubbles, could you please help understanding why tests for nullable unique identifier don't pass, unlike the one for unique identifiers? |
@andrea-mgn I think it's because the switch statement in
It might need a case entry for
In reply to: 2249651953 |
@shueybubbles, many thanks for your analysis, but that is a standard go library, hence I would not know how to fix it.
|
oh you're right, I wasn't looking closely at the file paths. Considering the goal of your change is to enable apps to get non-SQL Server formatted guids, such apps are not likely to use the In reply to: 2550719670 |
677f7d5
to
8063954
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #207 +/- ##
==========================================
+ Coverage 74.71% 74.77% +0.06%
==========================================
Files 32 32
Lines 6410 6457 +47
==========================================
+ Hits 4789 4828 +39
- Misses 1333 1338 +5
- Partials 288 291 +3 ☔ View full report in Codecov by Sentry. |
@shueybubbles, thank you. |
thx. Please update the README with appropriate documentation for how to use this new parameter and what its limitations are. In reply to: 2553394960 |
8063954
to
5a68a63
Compare
5a68a63
to
54eeb3e
Compare
@shueybubbles, thanks. I've described briefly the new parameter in README.md, please check as I'm not a native speaker. |
GUIDs are not handled like drivers for other SQL dialects (postgres, mariaDB, ...)
Someone had already signaled an issue:
https://stackoverflow.com/questions/70119954/go-mssqldb-returns-incorrect-id-value
But seems it has not been fixed in the meantime.
I'm not sure which would be the best way to change it, but we'd need a driver behaving like other ones.