Skip to content

Commit

Permalink
Merge pull request petoju#13 from petoju/feature/add-function-call
Browse files Browse the repository at this point in the history
Replace no such grant with function call
  • Loading branch information
petoju authored Jun 9, 2022
2 parents f54602b + 4f9d177 commit 62015ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 0 additions & 2 deletions mysql/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ const (
cleartextPasswords = "cleartext"
nativePasswords = "native"
unknownVarErrCode = 1193

mySQLErrorNoSuchGrant = 1133
)

type MySQLConfiguration struct {
Expand Down
7 changes: 3 additions & 4 deletions mysql/resource_grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,11 +536,10 @@ func showUserGrants(db *sql.DB, user string) ([]*MySQLGrant, error) {
sql := fmt.Sprintf("SHOW GRANTS FOR %s", user)
rows, err := db.Query(sql)

if driverErr, ok := err.(*mysql.MySQLError); ok {
if driverErr.Number == mySQLErrorNoSuchGrant {
return []*MySQLGrant{}, nil
}
if isNonExistingGrant(err) {
return []*MySQLGrant{}, nil
}

if err != nil {
return nil, err
}
Expand Down

0 comments on commit 62015ce

Please sign in to comment.