(ctx context.Context, varName string)
| 115 | } |
| 116 | |
| 117 | func (d *Driver) getServerVariable(ctx context.Context, varName string) (string, error) { |
| 118 | db := d.GetDB() |
| 119 | query := fmt.Sprintf("SHOW VARIABLES LIKE '%s'", varName) |
| 120 | var varNameFound, value string |
| 121 | if err := db.QueryRowContext(ctx, query).Scan(&varNameFound, &value); err != nil { |
| 122 | if err == sql.ErrNoRows { |
| 123 | return "", common.FormatDBErrorEmptyRowWithQuery(query) |
| 124 | } |
| 125 | return "", util.FormatErrorWithQuery(err, query) |
| 126 | } |
| 127 | if varName != varNameFound { |
| 128 | return "", errors.Errorf("expecting variable %s, but got %s", varName, varNameFound) |
| 129 | } |
| 130 | return value, nil |
| 131 | } |
| 132 | |
| 133 | // SyncDBSchema syncs a single database schema. |
| 134 | func (d *Driver) SyncDBSchema(ctx context.Context) (*storepb.DatabaseSchemaMetadata, error) { |
no test coverage detected