-
Notifications
You must be signed in to change notification settings - Fork 48
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
Handle nil params in ExecuteSql #75
base: master
Are you sure you want to change the base?
Conversation
@drewlesueur You can test against a local docker instance of latest mssql to make sure it works for that too. |
@daniel-redcat Thank you. I did that and added some more tests. |
@ianic Does this feature seem like something you would consider approving? |
@drewlesueur would you be so kind to provide a bit more context to a problem proposed PR should resolve. Reason why I'm asking is following By further looking at proposed PR, it actually resolves only one use case when ExecuteSql is called explicitly with "nil"
This is crude example and maybe I'm missing something here, please provide example. More importantly I would expect question more in direction like this:
|
@gljubojevic Yes, thank you for requesting this. The use case that I am trying to target is when we use gofreetds as a driver for Go's database/sql package, specifically the DB.Exec function. In a DB.Exec context this change will work if I use an explicit nil, a typed nil, or one of the sql.Null* types. Also, I have added tests to show that the implicit conversion will work for all the types used in the Here is an example fo Go code that will now work after this change, that wouldn't work before:
You are right that this change is not very helpful when using ExecuteSql directly. To get that to work, we'd have to add some more type switching in I hope this clarifies my intention and benefits of this change. Thank you. |
Issue #29
I have tested this with Sybase 12.5, However not with other versions of Sybase/MSSQL.
I took a tip from go-mssqldb where it associates null with "nvarchar(1)", though I am not exactly sure if it's the same context.
https://github.com/denisenkom/go-mssqldb/blob/b91950f658ecd54342d783495e1aadf48a55e967/types.go#L1124