Skip to content

Commit

Permalink
compare with length and not nil
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Taylor <[email protected]>
  • Loading branch information
systay committed Dec 20, 2024
1 parent aebd8e4 commit eb58df1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go/sqltypes/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ func (result *Result) AppendResult(src *Result) {
result.InsertID = src.InsertID
result.InsertIDChanged = true
}
if result.Fields == nil {
if len(result.Fields) == 0 {
result.Fields = src.Fields
}
result.Rows = append(result.Rows, src.Rows...)
Expand Down
4 changes: 2 additions & 2 deletions go/vt/vttablet/tabletserver/query_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,7 @@ func (qre *QueryExecutor) resetLastInsertIDIfNeeded(ctx context.Context, conn *c
}

func (qre *QueryExecutor) fetchLastInsertID(ctx context.Context, conn *connpool.Conn, exec *sqltypes.Result) error {
if exec.InsertID != 0 || !qre.options.GetFetchLastInsertId() {
if exec.InsertIDUpdated() || !qre.options.GetFetchLastInsertId() {
return nil
}

Expand Down Expand Up @@ -1221,7 +1221,7 @@ func (qre *QueryExecutor) execStreamSQL(conn *connpool.PooledConn, isTransaction

lastInsertIDSet := false
cb := func(result *sqltypes.Result) error {
if result != nil && result.InsertID != 0 {
if result != nil && result.InsertIDUpdated() {
lastInsertIDSet = true
}
return callback(result)
Expand Down

0 comments on commit eb58df1

Please sign in to comment.