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

Function getBatchResults

backend/plugin/parser/tsql/batch/batch_test.go:96–122  ·  view source on GitHub ↗
(a *require.Assertions, input string)

Source from the content-addressed store, hash-verified

94}
95
96func getBatchResults(a *require.Assertions, input string) []batchResult {
97 batch := NewBatcher(input)
98 var batchResults []batchResult
99 for {
100 command, err := batch.Next()
101 if err != nil {
102 if err == io.EOF {
103 if v := batch.Batch(); v != nil && len(v.Text) > 0 {
104 // If meet the end of file, get the last batch.
105 batchResults = append(batchResults, batchResult{
106 Statements: *v,
107 })
108 }
109 batch.Reset(nil)
110 return batchResults
111 }
112 a.NoError(err)
113 }
114 if command != nil {
115 batchResults = append(batchResults, batchResult{
116 Statements: *batch.Batch(),
117 Command: command.String(),
118 })
119 batch.Reset(nil)
120 }
121 }
122}

Callers 1

TestBatchFunction · 0.85

Calls 5

NextMethod · 0.95
BatchMethod · 0.95
ResetMethod · 0.95
NewBatcherFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected