You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sql.DateTime data type does not cast as per sql.DateTime2 #608
The way we do type conversion in tedious is a mess, and really inconsistent.
I think this here is an actual bug (because it's raising a TypeError), and that's bad and needs to be fixed. But I'm not sure what a "good" fix is going to look like.
Long term (in [email protected] or even later), I want us to move away from doing any type conversion at all - if your application defines a parameter to be a DateTime, it should be your application's responsibility to pass a Date object and not a String or something else. And if you want to make use of SQLServer's type conversion, you should've specified a String parameter anyway.
I want us to move away from doing any type conversion at all
This answers my question in #623.
What do you think about conversion from float to integer (same data type in JS, but not in SQL Server)? I think it's better not to convert at all and just verify that it's an integer number.
I think it's not such a big change and it's important. I could write a PR if you like.
It's a backwards incompatible change if we stop converting these values, so it should be a major version bump. We should not be afraid of major version bumps. 😄
Activity
arthurschreiber commentedon Oct 19, 2017
The way we do type conversion in
tediousis a mess, and really inconsistent.I think this here is an actual bug (because it's raising a
TypeError), and that's bad and needs to be fixed. But I'm not sure what a "good" fix is going to look like.Long term (in
[email protected]or even later), I want us to move away from doing any type conversion at all - if your application defines a parameter to be aDateTime, it should be your application's responsibility to pass aDateobject and not aStringor something else. And if you want to make use of SQLServer's type conversion, you should've specified aStringparameter anyway.arthurschreiber commentedon Oct 19, 2017
/cc @chdh Because I think he might be interested in this discussion.
chdh commentedon Oct 19, 2017
@arthurschreiber
This answers my question in #623.
What do you think about conversion from float to integer (same data type in JS, but not in SQL Server)? I think it's better not to convert at all and just verify that it's an integer number.
I think it's not such a big change and it's important. I could write a PR if you like.
arthurschreiber commentedon Oct 19, 2017
It's a backwards incompatible change if we stop converting these values, so it should be a major version bump. We should not be afraid of major version bumps. 😄