(ctx context.Context)
| 56 | } |
| 57 | |
| 58 | func (d *Driver) getVersion(ctx context.Context) (string, error) { |
| 59 | result, err := d.queryStatementWithLimit(ctx, "SELECT VERSION()", 0) |
| 60 | if err != nil { |
| 61 | return "", errors.Wrap(err, "failed to get version from instance") |
| 62 | } |
| 63 | |
| 64 | if len(result.Rows) == 0 || len(result.Rows[0].Values) == 0 { |
| 65 | return "", errors.New("invalid version result") |
| 66 | } |
| 67 | // rawVersion has the format of "1.2.3 commitID". |
| 68 | rawVersion := result.Rows[0].Values[0].GetStringValue() |
| 69 | tokens := strings.Split(rawVersion, " ") |
| 70 | if len(tokens) == 0 { |
| 71 | return "", errors.Errorf("invalid version %q", rawVersion) |
| 72 | } |
| 73 | return tokens[0], nil |
| 74 | } |
| 75 | |
| 76 | func (d *Driver) getDatabaseNames(ctx context.Context) ([]string, error) { |
| 77 | var databaseNames []string |
no test coverage detected