-
Notifications
You must be signed in to change notification settings - Fork 71
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
BulkLoad: Fix some types #239
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #239 +/- ##
==========================================
+ Coverage 74.77% 74.98% +0.21%
==========================================
Files 32 32
Lines 6457 6540 +83
==========================================
+ Hits 4828 4904 +76
- Misses 1338 1343 +5
- Partials 291 293 +2 ☔ View full report in Codecov by Sentry. |
@@ -578,6 +586,21 @@ func readLongLenType(ti *typeInfo, r *tdsBuffer, c *cryptoMetadata) interface{} | |||
panic("shoulnd't get here") | |||
} | |||
func writeLongLenType(w io.Writer, ti typeInfo, buf []byte) (err error) { | |||
if buf == nil { | |||
// According to the documentation, we MUST NOT specify the text pointer and timestamp when the value is NULL. |
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.
would it be worthwhile to have a non-bulkinsert test case for this? #Resolved
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.
@shueybubbles I don’t see any insert tests anywhere…
Besides, this code won’t run in non-bulkinsert scenario because:
func (s *Stmt) makeParam(val driver.Value) (res param, err error) {
if val == nil {
res.ti.TypeId = typeNull
res.buffer = nil
res.ti.Size = 0
return
}
...
And then
func writeTypeInfo(w io.Writer, ti *typeInfo, out bool, encoding msdsn.EncodeParameters) (err error) {
err = binary.Write(w, binary.LittleEndian, ti.TypeId)
if err != nil {
return
}
switch ti.TypeId {
case typeNull, typeInt1, typeBit, typeInt2, typeInt4, typeDateTim4,
typeFlt4, typeMoney, typeDateTime, typeFlt8, typeMoney4, typeInt8:
// those are fixed length
// https://msdn.microsoft.com/en-us/library/dd341171.aspx
ti.Writer = writeFixedType
...
@microsoft-github-policy-service agree |
No description provided.