MCPcopy Create free account
hub / github.com/Percona-Lab/mysql_random_data_load / GetMinorVersion

Function GetMinorVersion

testutils/testutils.go:94–113  ·  view source on GitHub ↗
(tb testing.TB, db *sql.DB)

Source from the content-addressed store, hash-verified

92}
93
94func GetMinorVersion(tb testing.TB, db *sql.DB) *version.Version {
95 var vs string
96 err := db.QueryRow("SELECT VERSION()").Scan(&vs)
97 if err != nil {
98 fmt.Printf("%s cannot get MySQL version: %s\n\n", caller(), err)
99 tb.FailNow()
100 }
101
102 // Extract only major and minor version
103 re := regexp.MustCompile(`(\d+)\.(\d+)\.(\d+).*`)
104 m := re.FindAllStringSubmatch(vs, -1)
105 vs = fmt.Sprintf("%s.%s", m[0][1], m[0][2])
106
107 v, err := version.NewVersion(vs)
108 if err != nil {
109 fmt.Printf("%s cannot get MySQL version: %s\n\n", caller(), err)
110 tb.FailNow()
111 }
112 return v
113}
114
115func LoadFile(tb testing.TB, filename string) []string {
116 file := filepath.Join("testdata", filename)

Callers

nothing calls this directly

Calls 2

callerFunction · 0.85
ScanMethod · 0.80

Tested by

no test coverage detected