![]() |
Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
|
The ClientContext holds information relevant to the current client session during execution. More...
#include <duckdb.hpp>


Public Member Functions | |
| DUCKDB_API | ClientContext (shared_ptr< DatabaseInstance > db) |
| MetaTransaction & | ActiveTransaction () |
| DUCKDB_API void | Interrupt () |
| Interrupt execution of a query. | |
| DUCKDB_API bool | IsInterrupted () const |
| DUCKDB_API void | ClearInterrupt () |
| DUCKDB_API void | CancelTransaction () |
| DUCKDB_API void | EnableProfiling () |
| Enable query profiling. | |
| DUCKDB_API void | DisableProfiling () |
| Disable query profiling. | |
| DUCKDB_API unique_ptr< QueryResult > | Query (const string &query, QueryParameters query_parameters) |
| Issue a query, returning a QueryResult. The QueryResult can be either a StreamQueryResult or a MaterializedQueryResult. The StreamQueryResult will only be returned in the case of a successful SELECT statement. | |
| DUCKDB_API unique_ptr< QueryResult > | Query (unique_ptr< SQLStatement > statement, QueryParameters query_parameters) |
| DUCKDB_API unique_ptr< PendingQueryResult > | PendingQuery (const string &query, QueryParameters query_parameters) |
| Issues a query to the database and returns a Pending Query Result. Note that "query" may only contain a single statement. | |
| DUCKDB_API unique_ptr< PendingQueryResult > | PendingQuery (unique_ptr< SQLStatement > statement, QueryParameters query_parameters) |
| Issues a query to the database and returns a Pending Query Result. | |
| DUCKDB_API unique_ptr< PendingQueryResult > | PendingQuery (unique_ptr< SQLStatement > statement, case_insensitive_map_t< BoundParameterData > &values, QueryParameters query_parameters) |
| Create a pending query with a list of parameters. | |
| DUCKDB_API unique_ptr< PendingQueryResult > | PendingQuery (const string &query, case_insensitive_map_t< BoundParameterData > &values, QueryParameters query_parameters) |
| DUCKDB_API unique_ptr< PendingQueryResult > | PendingQuery (const string &query, PendingQueryParameters parameters) |
| DUCKDB_API void | Destroy () |
| Destroy the client context. | |
| DUCKDB_API unique_ptr< TableDescription > | TableInfo (const string &database_name, const string &schema_name, const string &table_name) |
| Get the table info of a specific table, or nullptr if it cannot be found. | |
| DUCKDB_API unique_ptr< TableDescription > | TableInfo (const string &schema_name, const string &table_name) |
| Get the table info of a specific table, or nullptr if it cannot be found. Uses INVALID_CATALOG. | |
| DUCKDB_API void | Append (unique_ptr< SQLStatement > stmt) |
| Executes a query with the given collection "attached" to the query using a CTE. | |
| DUCKDB_API void | Append (TableDescription &description, ColumnDataCollection &collection) |
| Appends a ColumnDataCollection to the described table. | |
| DUCKDB_API void | TryBindRelation (Relation &relation, vector< ColumnDefinition > &result_columns) |
| Try to bind a relation in the current client context; either throws an exception or fills the result_columns list with the set of returned columns. | |
| DUCKDB_API void | InternalTryBindRelation (Relation &relation, vector< ColumnDefinition > &result_columns) |
| Internal function for try bind relation. It does not require a client-context lock. | |
| DUCKDB_API unique_ptr< PendingQueryResult > | PendingQuery (const shared_ptr< Relation > &relation, QueryParameters query_parameters) |
| Execute a relation. | |
| DUCKDB_API unique_ptr< QueryResult > | Execute (const shared_ptr< Relation > &relation) |
| DUCKDB_API unique_ptr< PreparedStatement > | Prepare (const string &query) |
| Prepare a query. | |
| DUCKDB_API unique_ptr< PreparedStatement > | Prepare (unique_ptr< SQLStatement > statement) |
| Directly prepare a SQL statement. | |
| DUCKDB_API unique_ptr< PendingQueryResult > | PendingQuery (const string &query, shared_ptr< PreparedStatementData > &prepared, const PendingQueryParameters ¶meters) |
| Create a pending query result from a prepared statement with the given name and set of parameters It is possible that the prepared statement will be re-bound. This will generally happen if the catalog is modified in between the prepared statement being bound and the prepared statement being run. | |
| DUCKDB_API unique_ptr< QueryResult > | Execute (const string &query, shared_ptr< PreparedStatementData > &prepared, case_insensitive_map_t< BoundParameterData > &values, QueryParameters query_parameters=QueryResultOutputType::ALLOW_STREAMING) |
| Execute a prepared statement with the given name and set of parameters It is possible that the prepared statement will be re-bound. This will generally happen if the catalog is modified in between the prepared statement being bound and the prepared statement being run. | |
| DUCKDB_API unique_ptr< QueryResult > | Execute (const string &query, shared_ptr< PreparedStatementData > &prepared, const PendingQueryParameters ¶meters) |
| DUCKDB_API QueryProgress | GetQueryProgress () |
| Gets current percentage of the query's progress, returns 0 in case the progress bar is disabled. | |
| DUCKDB_API void | RegisterFunction (CreateFunctionInfo &info) |
| Register function in the temporary schema. | |
| DUCKDB_API vector< unique_ptr< SQLStatement > > | ParseStatements (const string &query) |
| Parse statements from a query. | |
| DUCKDB_API unique_ptr< LogicalOperator > | ExtractPlan (const string &query) |
| Extract the logical plan of a query. | |
| DUCKDB_API void | PreprocessStatements (vector< unique_ptr< SQLStatement > > &statements) |
| DUCKDB_API void | RunFunctionInTransaction (const std::function< void(void)> &fun, bool requires_valid_transaction=true) |
| Runs a function with a valid transaction context, potentially starting a transaction if the context is in auto commit mode. | |
| DUCKDB_API void | RunFunctionInTransactionInternal (ClientContextLock &lock, const std::function< void(void)> &fun, bool requires_valid_transaction=true) |
| Same as RunFunctionInTransaction, but does not obtain a lock on the client context or check for validation. | |
| DUCKDB_API SettingLookupResult | TryGetCurrentSetting (const string &key, Value &result) const |
| Equivalent to CURRENT_SETTING(key) SQL function. | |
| DUCKDB_API SettingLookupResult | TryGetCurrentUserSetting (idx_t setting_index, Value &result) const |
| Returns the value of the current setting set by the user - if the user has set it. | |
| DUCKDB_API ParserOptions | GetParserOptions () const |
| Returns the parser options for this client context. | |
| DUCKDB_API bool | IsActiveResult (ClientContextLock &lock, BaseQueryResult &result) |
| Whether or not the given result object (streaming query result or pending query result) is active. | |
| Executor & | GetExecutor () |
| Returns the current executor. | |
| Logger & | GetLogger () const |
| Return the current logger. | |
| const string & | GetCurrentQuery () |
| Returns the current query string (if any). | |
| connection_t | GetConnectionId () const |
| DUCKDB_API unordered_set< string > | GetTableNames (const string &query, const bool qualified=false) |
| Fetch the set of tables names of the query. Returns the fully qualified, escaped table names, if qualified is set to true, else returns the not qualified, not escaped table names. | |
| DUCKDB_API ClientProperties | GetClientProperties () |
| DUCKDB_API bool | ExecutionIsFinished () |
| Returns true if execution of the current query is finished. | |
| DUCKDB_API void | ProcessError (ErrorData &error, const string &query) const |
| Process an error for display to the user. | |
| DUCKDB_API LogicalType | ParseLogicalType (const string &type) |
| Public Member Functions inherited from duckdb::enable_shared_from_this< ClientContext > | |
| shared_ptr< ClientContext > | shared_from_this () |
Public Attributes | |
| shared_ptr< DatabaseInstance > | db |
| The database that this client is connected to. | |
| atomic< bool > | interrupted |
| Whether or not the query is interrupted. | |
| unique_ptr< RegisteredStateManager > | registered_state |
| Set of optional states (e.g. Caches) that can be held by the ClientContext. | |
| shared_ptr< Logger > | logger |
| The logger to be used by this ClientContext. | |
| ClientConfig | config |
| The client configuration. | |
| unique_ptr< ClientData > | client_data |
| The set of client-specific data. | |
| TransactionContext | transaction |
| Data for the currently running transaction. | |
Private Attributes | |
| mutex | context_lock |
| Lock on using the ClientContext in parallel. | |
| unique_ptr< ActiveQueryContext > | active_query |
| The currently active query context. | |
| QueryProgress | query_progress |
| The current query progress. | |
| connection_t | connection_id |
| The connection corresponding to this client context. | |
Friends | |
| class | PendingQueryResult |
| class | BufferedData |
| class | SimpleBufferedData |
| class | BatchedBufferedData |
| class | StreamQueryResult |
| class | ConnectionManager |
Additional Inherited Members | |
| Protected Member Functions inherited from duckdb::enable_shared_from_this< ClientContext > | |
| enable_shared_from_this & | operator= (enable_shared_from_this const &) noexcept |
The ClientContext holds information relevant to the current client session during execution.
|
explicit |
| duckdb::ClientContext::~ClientContext | ( | ) |
|
inline |
| void duckdb::ClientContext::Interrupt | ( | ) |
Interrupt execution of a query.
| bool duckdb::ClientContext::IsInterrupted | ( | ) | const |
| void duckdb::ClientContext::ClearInterrupt | ( | ) |
| void duckdb::ClientContext::CancelTransaction | ( | ) |
| void duckdb::ClientContext::EnableProfiling | ( | ) |
Enable query profiling.
| void duckdb::ClientContext::DisableProfiling | ( | ) |
Disable query profiling.
| unique_ptr< QueryResult > duckdb::ClientContext::Query | ( | const string & | query, |
| QueryParameters | query_parameters ) |
Issue a query, returning a QueryResult. The QueryResult can be either a StreamQueryResult or a MaterializedQueryResult. The StreamQueryResult will only be returned in the case of a successful SELECT statement.


| unique_ptr< QueryResult > duckdb::ClientContext::Query | ( | unique_ptr< SQLStatement > | statement, |
| QueryParameters | query_parameters ) |
| unique_ptr< PendingQueryResult > duckdb::ClientContext::PendingQuery | ( | const string & | query, |
| QueryParameters | query_parameters ) |
Issues a query to the database and returns a Pending Query Result. Note that "query" may only contain a single statement.


| unique_ptr< PendingQueryResult > duckdb::ClientContext::PendingQuery | ( | unique_ptr< SQLStatement > | statement, |
| QueryParameters | query_parameters ) |
Issues a query to the database and returns a Pending Query Result.

| unique_ptr< PendingQueryResult > duckdb::ClientContext::PendingQuery | ( | unique_ptr< SQLStatement > | statement, |
| case_insensitive_map_t< BoundParameterData > & | values, | ||
| QueryParameters | query_parameters ) |
Create a pending query with a list of parameters.

| unique_ptr< PendingQueryResult > duckdb::ClientContext::PendingQuery | ( | const string & | query, |
| case_insensitive_map_t< BoundParameterData > & | values, | ||
| QueryParameters | query_parameters ) |
| unique_ptr< PendingQueryResult > duckdb::ClientContext::PendingQuery | ( | const string & | query, |
| PendingQueryParameters | parameters ) |
| void duckdb::ClientContext::Destroy | ( | ) |
Destroy the client context.

| unique_ptr< TableDescription > duckdb::ClientContext::TableInfo | ( | const string & | database_name, |
| const string & | schema_name, | ||
| const string & | table_name ) |
Get the table info of a specific table, or nullptr if it cannot be found.


| unique_ptr< TableDescription > duckdb::ClientContext::TableInfo | ( | const string & | schema_name, |
| const string & | table_name ) |
Get the table info of a specific table, or nullptr if it cannot be found. Uses INVALID_CATALOG.

| void duckdb::ClientContext::Append | ( | unique_ptr< SQLStatement > | stmt | ) |
Executes a query with the given collection "attached" to the query using a CTE.


| void duckdb::ClientContext::Append | ( | TableDescription & | description, |
| ColumnDataCollection & | collection ) |
Appends a ColumnDataCollection to the described table.

| void duckdb::ClientContext::TryBindRelation | ( | Relation & | relation, |
| vector< ColumnDefinition > & | result_columns ) |
Try to bind a relation in the current client context; either throws an exception or fills the result_columns list with the set of returned columns.

| void duckdb::ClientContext::InternalTryBindRelation | ( | Relation & | relation, |
| vector< ColumnDefinition > & | result_columns ) |
Internal function for try bind relation. It does not require a client-context lock.

| unique_ptr< PendingQueryResult > duckdb::ClientContext::PendingQuery | ( | const shared_ptr< Relation > & | relation, |
| QueryParameters | query_parameters ) |
Execute a relation.

| unique_ptr< QueryResult > duckdb::ClientContext::Execute | ( | const shared_ptr< Relation > & | relation | ) |
| unique_ptr< PreparedStatement > duckdb::ClientContext::Prepare | ( | const string & | query | ) |
Prepare a query.

| unique_ptr< PreparedStatement > duckdb::ClientContext::Prepare | ( | unique_ptr< SQLStatement > | statement | ) |
Directly prepare a SQL statement.

| unique_ptr< PendingQueryResult > duckdb::ClientContext::PendingQuery | ( | const string & | query, |
| shared_ptr< PreparedStatementData > & | prepared, | ||
| const PendingQueryParameters & | parameters ) |
Create a pending query result from a prepared statement with the given name and set of parameters It is possible that the prepared statement will be re-bound. This will generally happen if the catalog is modified in between the prepared statement being bound and the prepared statement being run.
| unique_ptr< QueryResult > duckdb::ClientContext::Execute | ( | const string & | query, |
| shared_ptr< PreparedStatementData > & | prepared, | ||
| case_insensitive_map_t< BoundParameterData > & | values, | ||
| QueryParameters | query_parameters = QueryResultOutputType::ALLOW_STREAMING ) |
Execute a prepared statement with the given name and set of parameters It is possible that the prepared statement will be re-bound. This will generally happen if the catalog is modified in between the prepared statement being bound and the prepared statement being run.
| unique_ptr< QueryResult > duckdb::ClientContext::Execute | ( | const string & | query, |
| shared_ptr< PreparedStatementData > & | prepared, | ||
| const PendingQueryParameters & | parameters ) |
| QueryProgress duckdb::ClientContext::GetQueryProgress | ( | ) |
Gets current percentage of the query's progress, returns 0 in case the progress bar is disabled.
| void duckdb::ClientContext::RegisterFunction | ( | CreateFunctionInfo & | info | ) |
Register function in the temporary schema.

| vector< unique_ptr< SQLStatement > > duckdb::ClientContext::ParseStatements | ( | const string & | query | ) |
Parse statements from a query.


| unique_ptr< LogicalOperator > duckdb::ClientContext::ExtractPlan | ( | const string & | query | ) |
Extract the logical plan of a query.

| void duckdb::ClientContext::PreprocessStatements | ( | vector< unique_ptr< SQLStatement > > & | statements | ) |
| void duckdb::ClientContext::RunFunctionInTransaction | ( | const std::function< void(void)> & | fun, |
| bool | requires_valid_transaction = true ) |
Runs a function with a valid transaction context, potentially starting a transaction if the context is in auto commit mode.


| void duckdb::ClientContext::RunFunctionInTransactionInternal | ( | ClientContextLock & | lock, |
| const std::function< void(void)> & | fun, | ||
| bool | requires_valid_transaction = true ) |
Same as RunFunctionInTransaction, but does not obtain a lock on the client context or check for validation.

| SettingLookupResult duckdb::ClientContext::TryGetCurrentSetting | ( | const string & | key, |
| Value & | result ) const |
Equivalent to CURRENT_SETTING(key) SQL function.

| SettingLookupResult duckdb::ClientContext::TryGetCurrentUserSetting | ( | idx_t | setting_index, |
| Value & | result ) const |
Returns the value of the current setting set by the user - if the user has set it.
| ParserOptions duckdb::ClientContext::GetParserOptions | ( | ) | const |
Returns the parser options for this client context.

| bool duckdb::ClientContext::IsActiveResult | ( | ClientContextLock & | lock, |
| BaseQueryResult & | result ) |
Whether or not the given result object (streaming query result or pending query result) is active.
| Executor & duckdb::ClientContext::GetExecutor | ( | ) |
Returns the current executor.
| Logger & duckdb::ClientContext::GetLogger | ( | ) | const |
Return the current logger.
| const string & duckdb::ClientContext::GetCurrentQuery | ( | ) |
Returns the current query string (if any).
| connection_t duckdb::ClientContext::GetConnectionId | ( | ) | const |
| unordered_set< string > duckdb::ClientContext::GetTableNames | ( | const string & | query, |
| const bool | qualified = false ) |
Fetch the set of tables names of the query. Returns the fully qualified, escaped table names, if qualified is set to true, else returns the not qualified, not escaped table names.

| ClientProperties duckdb::ClientContext::GetClientProperties | ( | ) |
| bool duckdb::ClientContext::ExecutionIsFinished | ( | ) |
Returns true if execution of the current query is finished.
| void duckdb::ClientContext::ProcessError | ( | ErrorData & | error, |
| const string & | query ) const |
Process an error for display to the user.

| LogicalType duckdb::ClientContext::ParseLogicalType | ( | const string & | type | ) |
|
private |
Parse statements and resolve pragmas from a query.

|
private |
Issues a query to the database and returns a Pending Query Result.

|
private |
|
private |
Parse statements from a query.


|
private |
Perform aggressive query verification of a SELECT statement. Only called when query_verification_enabled is true.

|
private |
Cleanup any open results and reset the interrupted flag


|
private |
Internal clean up, does not lock. Caller must hold the context_lock.

|
private |
|
private |
|
private |
|
private |
|
private |
Internally prepare a SQL statement. Caller must hold the context_lock.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Wait until a task is available to execute.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |