| 1 | //===----------------------------------------------------------------------===// |
|---|---|
| 2 | // DuckDB |
| 3 | // |
| 4 | // duckdb/main/client_data.hpp |
| 5 | // |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include "duckdb/common/common.hpp" |
| 12 | #include "duckdb/common/enums/output_type.hpp" |
| 13 | #include "duckdb/common/types/value.hpp" |
| 14 | #include "duckdb/common/case_insensitive_map.hpp" |
| 15 | #include "duckdb/common/atomic.hpp" |
| 16 | |
| 17 | namespace duckdb { |
| 18 | class AttachedDatabase; |
| 19 | class BufferedFileWriter; |
| 20 | class ClientContext; |
| 21 | class CatalogSearchPath; |
| 22 | class FileOpener; |
| 23 | class FileSystem; |
| 24 | class HTTPState; |
| 25 | class QueryProfiler; |
| 26 | class QueryProfilerHistory; |
| 27 | class PreparedStatementData; |
| 28 | class SchemaCatalogEntry; |
| 29 | struct RandomEngine; |
| 30 | |
| 31 | struct ClientData { |
| 32 | ClientData(ClientContext &context); |
| 33 | ~ClientData(); |
| 34 | |
| 35 | //! Query profiler |
| 36 | shared_ptr<QueryProfiler> profiler; |
| 37 | //! QueryProfiler History |
| 38 | unique_ptr<QueryProfilerHistory> query_profiler_history; |
| 39 | |
| 40 | //! The set of temporary objects that belong to this client |
| 41 | shared_ptr<AttachedDatabase> temporary_objects; |
| 42 | //! The set of bound prepared statements that belong to this client |
| 43 | case_insensitive_map_t<shared_ptr<PreparedStatementData>> prepared_statements; |
| 44 | |
| 45 | //! The writer used to log queries (if logging is enabled) |
| 46 | unique_ptr<BufferedFileWriter> log_query_writer; |
| 47 | //! The random generator used by random(). Its seed value can be set by setseed(). |
| 48 | unique_ptr<RandomEngine> random_engine; |
| 49 | |
| 50 | //! The catalog search path |
| 51 | unique_ptr<CatalogSearchPath> catalog_search_path; |
| 52 | |
| 53 | //! The file opener of the client context |
| 54 | unique_ptr<FileOpener> file_opener; |
| 55 | |
| 56 | //! HTTP State in this query |
| 57 | shared_ptr<HTTPState> http_state; |
| 58 | |
| 59 | //! The clients' file system wrapper |
| 60 | unique_ptr<FileSystem> client_file_system; |
| 61 | |
| 62 | //! The file search path |
| 63 | string file_search_path; |
| 64 | |
| 65 | //! The Max Line Length Size of Last Query Executed on a CSV File. (Only used for testing) |
| 66 | //! FIXME: this should not be done like this |
| 67 | bool debug_set_max_line_length = false; |
| 68 | idx_t debug_max_line_length = 0; |
| 69 | |
| 70 | public: |
| 71 | DUCKDB_API static ClientData &Get(ClientContext &context); |
| 72 | }; |
| 73 | |
| 74 | } // namespace duckdb |
| 75 |