(ctx context.Context, varName string)
| 121 | } |
| 122 | |
| 123 | func (d *Driver) getServerVariable(ctx context.Context, varName string) (string, error) { |
| 124 | db := d.GetDB() |
| 125 | query := fmt.Sprintf("SHOW VARIABLES LIKE '%s'", varName) |
| 126 | var varNameFound, value string |
| 127 | if err := db.QueryRowContext(ctx, query).Scan(&varNameFound, &value); err != nil { |
| 128 | if err == sql.ErrNoRows { |
| 129 | return "", common.FormatDBErrorEmptyRowWithQuery(query) |
| 130 | } |
| 131 | return "", util.FormatErrorWithQuery(err, query) |
| 132 | } |
| 133 | if varName != varNameFound { |
| 134 | return "", errors.Errorf("expecting variable %s, but got %s", varName, varNameFound) |
| 135 | } |
| 136 | return value, nil |
| 137 | } |
| 138 | |
| 139 | func containsInvisibleChars(data []byte) bool { |
| 140 | // Iterate over the byte slice as runes |
no test coverage detected