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

Function LoadQueriesFromFile

testutils/testutils.go:156–169  ·  view source on GitHub ↗
(tb testing.TB, filename string)

Source from the content-addressed store, hash-verified

154}
155
156func LoadQueriesFromFile(tb testing.TB, filename string) {
157 conn := GetMySQLConnection(tb)
158 file := filepath.Join("testdata", filename)
159 data, err := ioutil.ReadFile(file)
160 if err != nil {
161 fmt.Printf("%s cannot load json file %q: %s\n\n", caller(), file, err)
162 tb.FailNow()
163 }
164 _, err = conn.Exec(string(data))
165 if err != nil {
166 fmt.Printf("%s cannot load queries from %q: %s\n\n", caller(), file, err)
167 tb.FailNow()
168 }
169}
170
171func LoadJson(tb testing.TB, filename string, dest interface{}) {
172 file := filepath.Join("testdata", filename)

Callers

nothing calls this directly

Calls 2

GetMySQLConnectionFunction · 0.85
callerFunction · 0.85

Tested by

no test coverage detected