Skip to content

Commit

Permalink
fix: immediate defer rows.Close() (#11800)
Browse files Browse the repository at this point in the history
  • Loading branch information
RainbowDashy authored and d-bytebase committed Apr 25, 2024
1 parent cd309b3 commit 1bbc126
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/plugin/db/mysql/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ func (driver *Driver) getCreateFunctionStmt(ctx context.Context, databaseName, f
if err != nil {
return "", util.FormatErrorWithQuery(err, query)
}
defer rows.Close()

type ResultRow struct {
CreateFunction string
Expand All @@ -550,7 +551,6 @@ func (driver *Driver) getCreateFunctionStmt(ctx context.Context, databaseName, f
return "", errors.Errorf("failed to find column Create Function")
}

defer rows.Close()
for rows.Next() {
dests := make([]any, len(columns))
for i := 0; i < len(columns); i++ {
Expand Down Expand Up @@ -579,6 +579,7 @@ func (driver *Driver) getCreateProcedureStmt(ctx context.Context, databaseName,
if err != nil {
return "", util.FormatErrorWithQuery(err, query)
}
defer rows.Close()

type ResultRow struct {
CreateProcedure string
Expand All @@ -601,7 +602,6 @@ func (driver *Driver) getCreateProcedureStmt(ctx context.Context, databaseName,
return "", errors.Errorf("failed to find column Create Procedure")
}

defer rows.Close()
for rows.Next() {
dests := make([]any, len(columns))
for i := 0; i < len(columns); i++ {
Expand Down

0 comments on commit 1bbc126

Please sign in to comment.