pub struct SessionClient { /* private fields */ }
Expand description

A coordinator client that is bound to a connection.

See also Client.

Implementations§

source§

impl SessionClient

source

pub fn parse<'a>( &self, sql: &'a str ) -> Result<Result<Vec<StatementParseResult<'a>>, ParserStatementError>, String>

Parses a SQL expression, reporting failures as a telemetry event if possible.

source

pub fn canceled(&self) -> impl Future<Output = ()> + Send

source

pub fn reset_canceled(&mut self)

source

pub async fn get_prepared_statement( &mut self, name: &str ) -> Result<&PreparedStatement, AdapterError>

source

pub async fn prepare( &mut self, name: String, stmt: Option<Statement<Raw>>, sql: String, param_types: Vec<Option<ScalarType>> ) -> Result<(), AdapterError>

Saves the parsed statement as a prepared statement.

The prepared statement is saved in the connection’s crate::session::Session under the specified name.

source

pub async fn declare( &mut self, name: String, stmt: Statement<Raw>, sql: String ) -> Result<(), AdapterError>

Binds a statement to a portal.

source

pub async fn execute( &mut self, portal_name: String, cancel_future: impl Future<Output = Error> + Send, outer_ctx_extra: Option<ExecuteContextExtra> ) -> Result<(ExecuteResponse, Instant), AdapterError>

Executes a previously-bound portal.

source

pub fn start_transaction( &mut self, implicit: Option<usize> ) -> Result<(), AdapterError>

Starts a transaction based on implicit:

  • None: InTransaction
  • Some(1): Started
  • Some(n > 1): InTransactionImplicit
  • Some(0): no change
source

pub async fn end_transaction( &mut self, action: EndTransactionAction ) -> Result<ExecuteResponse, AdapterError>

Ends a transaction.

source

pub fn fail_transaction(&mut self)

Fails a transaction.

source

pub async fn catalog_snapshot(&self) -> Arc<Catalog>

Fetches the catalog.

source

pub async fn dump_catalog(&mut self) -> Result<CatalogDump, AdapterError>

Dumps the catalog to a JSON string.

No authorization is performed, so access to this function must be limited to internal servers or superusers.

source

pub async fn check_catalog(&mut self) -> Result<(), Value>

Checks the catalog for internal consistency, returning a JSON object describing the inconsistencies, if there are any.

No authorization is performed, so access to this function must be limited to internal servers or superusers.

source

pub async fn check_coordinator(&mut self) -> Result<(), Value>

Checks the coordinator for internal consistency, returning a JSON object describing the inconsistencies, if there are any. This is a superset of checks that check_catalog performs,

No authorization is performed, so access to this function must be limited to internal servers or superusers.

source

pub fn retire_execute( &mut self, data: ExecuteContextExtra, reason: StatementEndedExecutionReason )

Tells the coordinator a statement has finished execution, in the cases where we have no other reason to communicate with the coordinator.

source

pub async fn insert_rows( &mut self, id: GlobalId, columns: Vec<usize>, rows: Vec<Row>, ctx_extra: ExecuteContextExtra ) -> Result<ExecuteResponse, AdapterError>

Inserts a set of rows into the given table.

The rows only contain the columns positions in columns, so they must be re-encoded for adding the default values for the remaining ones.

source

pub async fn get_system_vars( &mut self ) -> Result<GetVariablesResponse, AdapterError>

Gets the current value of all system variables.

source

pub async fn set_system_vars( &mut self, vars: BTreeMap<String, String> ) -> Result<(), AdapterError>

Updates the specified system variables to the specified values.

source

pub async fn terminate(&mut self)

Terminates the client session.

source

pub fn session(&mut self) -> &mut Session

Returns a mutable reference to the session bound to this client.

source

pub fn inner(&self) -> &Client

Returns a reference to the inner client.

source

pub fn add_idle_in_transaction_session_timeout(&mut self)

source

pub fn remove_idle_in_transaction_session_timeout(&mut self)

source

pub async fn recv_timeout(&mut self) -> Option<TimeoutType>

Cancel safety

This method is cancel safe. If recv is used as the event in a tokio::select! statement and some other branch completes first, it is guaranteed that no messages were received on this channel.

Trait Implementations§

source§

impl Drop for SessionClient

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FutureExt for T

source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<P, R> ProtoType<R> for Pwhere R: RustType<P>,

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more