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
17namespace duckdb {
18class AttachedDatabase;
19class BufferedFileWriter;
20class ClientContext;
21class CatalogSearchPath;
22class FileOpener;
23class FileSystem;
24class HTTPState;
25class QueryProfiler;
26class QueryProfilerHistory;
27class PreparedStatementData;
28class SchemaCatalogEntry;
29struct RandomEngine;
30
31struct 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
70public:
71 DUCKDB_API static ClientData &Get(ClientContext &context);
72};
73
74} // namespace duckdb
75