Skip to content

Commit

Permalink
fix return value
Browse files Browse the repository at this point in the history
  • Loading branch information
shueybubbles committed Jul 11, 2023
1 parent 0d97e9e commit 954472a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion encrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,22 @@ func (s *Stmt) encryptArgs(ctx context.Context, args []namedValue) (encryptedArg
query: "sp_describe_parameter_encryption",
skipEncryption: true,
}
oldouts := s.c.outs
s.c.clearOuts()

newArgs, err := s.prepareEncryptionQuery(isProc(s.query), s.query, args)
if err != nil {
return
}
// TODO: Consider not using recursion
rows, err := q.queryContext(ctx, newArgs)
if err != nil {
s.c.outs = oldouts
return
}
cekInfo, paramsInfo, err := processDescribeParameterEncryption(rows)
rows.Close()
s.c.outs = oldouts
if err != nil {
return
}
Expand All @@ -95,7 +100,7 @@ func (s *Stmt) encryptArgs(ctx context.Context, args []namedValue) (encryptedArg
}
info := paramMap[name]

if info.p.encType == ColumnEncryptionPlainText {
if info.p.encType == ColumnEncryptionPlainText || a.Value == nil {
continue
}

Expand Down
2 changes: 1 addition & 1 deletion token.go
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ func parseReturnValue(r *tdsBuffer, s *tdsSession) (nv namedValue) {
ti := getBaseTypeInfo(r, true) // UserType + Flags + TypeInfo

var cryptoMetadata *cryptoMetadata = nil
if s.alwaysEncrypted {
if s.alwaysEncrypted && (ti.Flags&fEncrypted) == fEncrypted {
cm := parseCryptoMetadata(r, nil) // CryptoMetadata
cryptoMetadata = &cm
}
Expand Down

0 comments on commit 954472a

Please sign in to comment.