ADBC
Arrow Database Connectivity
Loading...
Searching...
No Matches
adbc::driver::Statement< Derived > Class Template Reference

A base implementation of a statement. More...

#include <statement.h>

Inheritance diagram for adbc::driver::Statement< Derived >:
adbc::driver::BaseStatement< Derived > adbc::driver::ObjectBase

Classes

struct  EmptyState
 Statement state: initialized with no set query. More...
 
struct  IngestState
 Statement state: bulk ingestion. More...
 
struct  PreparedState
 Statement state: prepared statement. More...
 
struct  QueryState
 Statement state: ad-hoc query. More...
 

Public Types

enum class  TableDoesNotExist { kCreate , kFail }
 What to do in ingestion when the table does not exist. More...
 
enum class  TableExists { kAppend , kFail , kReplace }
 What to do in ingestion when the table already exists. More...
 
using Base = Statement<Derived>
 
using State = std::variant<EmptyState, IngestState, PreparedState, QueryState>
 Statement state: one of the above.
 
- Public Types inherited from adbc::driver::BaseStatement< Derived >
using Base = BaseStatement<Derived>
 

Public Member Functions

AdbcStatusCode Bind (ArrowArray *values, ArrowSchema *schema, AdbcError *error)
 
AdbcStatusCode BindStream (ArrowArrayStream *stream, AdbcError *error)
 
AdbcStatusCode Cancel (AdbcError *error)
 
AdbcStatusCode ExecutePartitions (struct ArrowSchema *schema, struct AdbcPartitions *partitions, int64_t *rows_affected, AdbcError *error)
 
AdbcStatusCode ExecuteQuery (ArrowArrayStream *stream, int64_t *rows_affected, AdbcError *error)
 
AdbcStatusCode ExecuteSchema (ArrowSchema *schema, AdbcError *error)
 
AdbcStatusCode GetParameterSchema (struct ArrowSchema *schema, struct AdbcError *error)
 
AdbcStatusCode Init (void *parent, AdbcError *error)
 Initialize the object.
 
AdbcStatusCode Prepare (AdbcError *error)
 
AdbcStatusCode Release (AdbcError *error)
 Finalize the object.
 
AdbcStatusCode SetOption (std::string_view key, Option value, AdbcError *error)
 Set an option value.
 
AdbcStatusCode SetSqlQuery (const char *query, AdbcError *error)
 
AdbcStatusCode SetSubstraitPlan (const uint8_t *plan, size_t length, AdbcError *error)
 
Result< int64_t > ExecuteIngestImpl (IngestState &state)
 
Result< int64_t > ExecuteQueryImpl (PreparedState &state, ArrowArrayStream *stream)
 
Result< int64_t > ExecuteQueryImpl (QueryState &state, ArrowArrayStream *stream)
 
Result< int64_t > ExecuteUpdateImpl (PreparedState &state)
 
Result< int64_t > ExecuteUpdateImpl (QueryState &state)
 
Status GetParameterSchemaImpl (PreparedState &state, ArrowSchema *schema)
 
Status InitImpl (void *parent)
 
Status PrepareImpl (QueryState &state)
 
Status ReleaseImpl ()
 
Status SetOptionImpl (std::string_view key, Option value)
 Set an option. May be called prior to InitImpl.
 
- Public Member Functions inherited from adbc::driver::BaseStatement< Derived >
Status InitImpl (void *parent)
 Initialize the statement.
 
Status ReleaseImpl ()
 
AdbcStatusCode ExecuteQuery (ArrowArrayStream *stream, int64_t *rows_affected, AdbcError *error)
 
Result< int64_t > ExecuteQueryImpl (ArrowArrayStream *stream)
 
AdbcStatusCode ExecuteSchema (ArrowSchema *schema, AdbcError *error)
 
Status ExecuteSchemaImpl (ArrowSchema *schema)
 
AdbcStatusCode Prepare (AdbcError *error)
 
Status PrepareImpl ()
 
AdbcStatusCode SetSqlQuery (const char *query, AdbcError *error)
 
Status SetSqlQueryImpl (std::string_view query)
 
AdbcStatusCode SetSubstraitPlan (const uint8_t *plan, size_t length, AdbcError *error)
 
Status SetSubstraitPlanImpl (std::string_view plan)
 
AdbcStatusCode Bind (ArrowArray *values, ArrowSchema *schema, AdbcError *error)
 
Status BindImpl (ArrowArray *values, ArrowSchema *schema)
 
AdbcStatusCode BindStream (ArrowArrayStream *stream, AdbcError *error)
 
Status BindStreamImpl (ArrowArrayStream *stream)
 
AdbcStatusCode GetParameterSchema (ArrowSchema *schema, AdbcError *error)
 
Status GetParameterSchemaImpl (struct ArrowSchema *schema)
 
AdbcStatusCode ExecutePartitions (ArrowSchema *schema, AdbcPartitions *partitions, int64_t *rows_affected, AdbcError *error)
 
AdbcStatusCode Cancel (AdbcError *error)
 
Status Cancel ()
 
- Public Member Functions inherited from adbc::driver::ObjectBase
virtual Result< OptionGetOption (std::string_view key)
 Get an option value.
 

Protected Attributes

ArrowArrayStream bind_parameters_
 
- Protected Attributes inherited from adbc::driver::ObjectBase
LifecycleState lifecycle_state_
 

Private Member Functions

Derived & impl ()
 

Private Attributes

State state_ = State(EmptyState{})
 

Detailed Description

template<typename Derived>
class adbc::driver::Statement< Derived >

A base implementation of a statement.

Member Typedef Documentation

◆ State

template<typename Derived >
using adbc::driver::Statement< Derived >::State = std::variant<EmptyState, IngestState, PreparedState, QueryState>

Statement state: one of the above.

Member Enumeration Documentation

◆ TableDoesNotExist

template<typename Derived >
enum class adbc::driver::Statement::TableDoesNotExist
strong

What to do in ingestion when the table does not exist.

◆ TableExists

template<typename Derived >
enum class adbc::driver::Statement::TableExists
strong

What to do in ingestion when the table already exists.

Member Function Documentation

◆ Init()

template<typename Derived >
AdbcStatusCode adbc::driver::Statement< Derived >::Init ( void * parent,
AdbcError * error )
inlinevirtual

Initialize the object.

Called after 0 or more SetOption calls. Generally, you won't need to override this directly. Instead, use the typed InitImpl provided by Database/Connection/Statement.

Parameters
[in]parentA pointer to the AdbcDatabase or AdbcConnection implementation as appropriate, or nullptr.

Reimplemented from adbc::driver::BaseStatement< Derived >.

◆ Release()

template<typename Derived >
AdbcStatusCode adbc::driver::Statement< Derived >::Release ( AdbcError * error)
inlinevirtual

Finalize the object.

This can be used to return an error if the object is not in a valid state (e.g. prevent closing a connection with open statements) or to clean up resources when resource cleanup could fail. Infallible resource cleanup (e.g. releasing memory) should generally be handled in the destructor.

Generally, you won't need to override this directly. Instead, use the typed ReleaseImpl provided by Database/Connection/Statement.

Reimplemented from adbc::driver::BaseStatement< Derived >.

◆ SetOption()

template<typename Derived >
AdbcStatusCode adbc::driver::Statement< Derived >::SetOption ( std::string_view key,
Option value,
AdbcError * error )
inlinevirtual

Set an option value.

Reimplemented from adbc::driver::BaseStatement< Derived >.

◆ SetOptionImpl()

template<typename Derived >
Status adbc::driver::Statement< Derived >::SetOptionImpl ( std::string_view key,
Option value )
inlinevirtual

Set an option. May be called prior to InitImpl.

Reimplemented from adbc::driver::BaseStatement< Derived >.


The documentation for this class was generated from the following file: