1//===----------------------------------------------------------------------===//
2// DuckDB
3//
4// duckdb/function/replacement_scan.hpp
5//
6//
7//===----------------------------------------------------------------------===//
8
9#pragma once
10
11#include "duckdb/common/common.hpp"
12
13namespace duckdb {
14
15class ClientContext;
16class TableRef;
17
18struct ReplacementScanData {
19 virtual ~ReplacementScanData() {
20 }
21};
22
23typedef unique_ptr<TableRef> (*replacement_scan_t)(ClientContext &context, const string &table_name,
24 ReplacementScanData *data);
25
26//! Replacement table scans are automatically attempted when a table name cannot be found in the schema
27//! This allows you to do e.g. SELECT * FROM 'filename.csv', and automatically convert this into a CSV scan
28struct ReplacementScan {
29 explicit ReplacementScan(replacement_scan_t function, unique_ptr<ReplacementScanData> data_p = nullptr)
30 : function(function), data(std::move(data_p)) {
31 }
32
33 replacement_scan_t function;
34 unique_ptr<ReplacementScanData> data;
35};
36
37} // namespace duckdb
38