//===----------------------------------------------------------------------===// // DuckDB // // duckdb/main/stream_query_result.hpp // // //===----------------------------------------------------------------------===// #pragma once #include "duckdb/common/winapi.hpp" #include "duckdb/main/query_result.hpp" namespace duckdb { class ClientContext; class ClientContextLock; class Executor; class MaterializedQueryResult; class PreparedStatementData; class StreamQueryResult : public QueryResult { friend class ClientContext; public: static constexpr const QueryResultType TYPE = QueryResultType::STREAM_RESULT; public: //! Create a successful StreamQueryResult. StreamQueryResults should always be successful initially (it makes no //! sense to stream an error). DUCKDB_API StreamQueryResult(StatementType statement_type, StatementProperties properties, shared_ptr context, vector types, vector names); DUCKDB_API ~StreamQueryResult() override; public: //! Fetches a DataChunk from the query result. DUCKDB_API unique_ptr FetchRaw() override; //! Converts the QueryResult to a string DUCKDB_API string ToString() override; //! Materializes the query result and turns it into a materialized query result DUCKDB_API unique_ptr Materialize(); DUCKDB_API bool IsOpen(); //! Closes the StreamQueryResult DUCKDB_API void Close(); //! The client context this StreamQueryResult belongs to shared_ptr context; private: unique_ptr LockContext(); void CheckExecutableInternal(ClientContextLock &lock); bool IsOpenInternal(ClientContextLock &lock); }; } // namespace duckdb