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

Method buildServerSideLoadData

backend/loaddata.go:103–113  ·  view source on GitHub ↗

In the non-local case, we can directly use the file path to read the data.

(ctx *sql.Context, insert *plan.InsertInto, dst sql.InsertableTable, load *plan.LoadData)

Source from the content-addressed store, hash-verified

101
102// In the non-local case, we can directly use the file path to read the data.
103func (db *DuckBuilder) buildServerSideLoadData(ctx *sql.Context, insert *plan.InsertInto, dst sql.InsertableTable, load *plan.LoadData) (sql.RowIter, error) {
104 _, secureFileDir, ok := sql.SystemVariables.GetGlobal("secure_file_priv")
105 if !ok {
106 return nil, fmt.Errorf("error: secure_file_priv variable was not found")
107 }
108
109 if err := isUnderSecureFileDir(secureFileDir, load.File); err != nil {
110 return nil, sql.ErrLoadDataCannotOpen.New(err.Error())
111 }
112 return db.executeLoadData(ctx, insert, dst, load, load.File)
113}
114
115func (db *DuckBuilder) executeLoadData(ctx *sql.Context, insert *plan.InsertInto, dst sql.InsertableTable, load *plan.LoadData, filePath string) (sql.RowIter, error) {
116 // Build the DuckDB INSERT INTO statement.

Callers 1

buildLoadDataMethod · 0.95

Calls 2

executeLoadDataMethod · 0.95
isUnderSecureFileDirFunction · 0.85

Tested by

no test coverage detected