MCPcopy Create free account
hub / github.com/bytebase/bytebase / TestParseMySQLStatements

Function TestParseMySQLStatements

backend/plugin/parser/mysql/mysql_test.go:12–30  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestParseMySQLStatements(t *testing.T) {
13 statement := "SELECT 1; SELECT 2;"
14
15 statements, err := base.ParseStatements(storepb.Engine_MYSQL, statement)
16 require.NoError(t, err)
17
18 require.Len(t, statements, 2)
19
20 // Check first statement
21 require.Equal(t, "SELECT 1;", statements[0].Text)
22 require.False(t, statements[0].Empty)
23 require.NotNil(t, statements[0].AST)
24 require.NotNil(t, statements[0].Start)
25
26 // Check second statement
27 require.Contains(t, statements[1].Text, "SELECT 2")
28 require.False(t, statements[1].Empty)
29 require.NotNil(t, statements[1].AST)
30}

Callers

nothing calls this directly

Calls 3

ParseStatementsFunction · 0.92
LenMethod · 0.80
EqualMethod · 0.65

Tested by

no test coverage detected