MCPcopy Create free account
hub / github.com/apecloud/myduckserver / executeCopy

Method executeCopy

pgserver/dataloader.go:256–278  ·  view source on GitHub ↗
(sql string, pipePath string)

Source from the content-addressed store, hash-verified

254 b.WriteString(")")
255
256 return b.String()
257}
258
259func (loader *CsvDataLoader) executeCopy(sql string, pipePath string) {
260 defer close(loader.rowCount)
261 loader.logger.Debugf("Executing COPY statement: %s", sql)
262 result, err := adapter.Exec(loader.ctx, sql)
263 if err != nil {
264 loader.ctx.GetLogger().Error(err)
265 loader.err.Store(&err)
266 if loader.blocked.Load() {
267 // Open the pipe once to unblock the writer
268 pipe, _ := os.OpenFile(pipePath, os.O_RDONLY, os.ModeNamedPipe)
269 loader.errPipe.Store(pipe)
270 }
271 return
272 }
273
274 rows, err := result.RowsAffected()
275 if err != nil {
276 loader.ctx.GetLogger().Error(err)
277 loader.err.Store(&err)
278 return
279 }
280 loader.rowCount <- rows
281}

Callers 1

NewCsvDataLoaderFunction · 0.95

Calls 2

ExecFunction · 0.92
LoadMethod · 0.80

Tested by

no test coverage detected