(ast *duckdbsql.AST, allFiles []string)
| 512 | } |
| 513 | |
| 514 | func rewriteSQL(ast *duckdbsql.AST, allFiles []string) (string, error) { |
| 515 | err := ast.RewriteTableRefs(func(table *duckdbsql.TableRef) (*duckdbsql.TableRef, bool) { |
| 516 | return &duckdbsql.TableRef{ |
| 517 | Paths: allFiles, |
| 518 | Function: table.Function, |
| 519 | Properties: table.Properties, |
| 520 | Params: table.Params, |
| 521 | }, true |
| 522 | }) |
| 523 | if err != nil { |
| 524 | return "", err |
| 525 | } |
| 526 | sql, err := ast.Format() |
| 527 | if err != nil { |
| 528 | return "", err |
| 529 | } |
| 530 | return sql, nil |
| 531 | } |
| 532 | |
| 533 | // rewriteLocalPaths rewrites a DuckDB SQL statement such that relative paths become absolute paths relative to the basePath, |
| 534 | // and if allowHostAccess is false, returns an error if any of the paths resolve to a path outside of the basePath. |
no test coverage detected