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)
| 101 | |
| 102 | // In the non-local case, we can directly use the file path to read the data. |
| 103 | func (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 | |
| 115 | func (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. |
no test coverage detected