Skip to main content

SyncConnection

Struct SyncConnection 

Source
pub struct SyncConnection { /* private fields */ }
Expand description

A blocking Connection backed by an async driver and a private current-thread runtime.

Blocking model. Every method calls self.rt.block_on(...) on the owned runtime, so it blocks the calling thread until the driver future resolves. Memory model. query buffers the result but is bounded by size_guards — an oversized cell/row or a result past the total cap fails fast; query_cursor streams at bounded memory. Reentrancy. The runtime is current-thread; do not call from inside another block_on on the same thread (hop to a blocking thread first).

Trait Implementations§

Source§

impl Connection for SyncConnection

Source§

fn query(&mut self, sql: &str) -> Result<QueryResult, SqlError>

Eager read, routed through the native cursor and collected into a fully-materialized QueryResult. Building the eager result on top of the streaming producer keeps a single decode path shared with query_cursor; for the network backends it also means the rows are pulled from the server’s cursor rather than pre-buffered by the driver.

Source§

fn execute(&mut self, sql: &str) -> Result<ExecutionSummary, SqlError>

Execute a statement that may not return rows (INSERT, UPDATE, CREATE, etc.). Blocks until the statement completes.
Source§

fn query_cursor(&mut self, sql: &str) -> Result<RowCursor<'_>, SqlError>

Open a streaming read cursor for sql, returning a RowCursor that pulls rows from a native database cursor at bounded memory. Read more
Source§

fn size_guards(&self) -> SizeGuards

The size guards currently applied to this connection’s reads (per-cell, per-row, per-result byte caps). The default implementation reports SizeGuards::default; the concrete SyncConnection tracks the real configured value.
Source§

fn set_size_guards(&mut self, guards: SizeGuards)

Install new size guards for subsequent reads. Lets a host raise or lower the per-cell / per-row / per-result caps (e.g. the CLI wiring its [limits] config). The default implementation is a no-op for wrappers that hold no guard state; the concrete SyncConnection stores it.
Source§

fn execute_multi(&mut self, sql: &str) -> Result<Vec<StatementResult>, SqlError>

Execute one or more statements, one result per statement. Backends that natively support multi-resultsets (Postgres, MSSQL) split the batch; others fall back to single-statement behavior. Blocks until the batch completes.
Source§

fn ping(&mut self) -> Result<(), SqlError>

Test connectivity (ping / SELECT 1). Blocks on a round-trip.
Source§

fn list_tables(&mut self, schema: Option<&str>) -> Result<Vec<String>, SqlError>

List tables in the given schema (or default schema if None).
Source§

fn list_schemas(&mut self) -> Result<Vec<SchemaInfo>, SqlError>

List the schemas / databases / owners visible on this connection, ordered by name. The entry whose is_default is set is the schema unqualified objects resolve against (PG current_schema(), MySQL DATABASE(), MSSQL SCHEMA_NAME(), Oracle USER, SQLite main). Blocks on a round-trip.
Source§

fn describe_table( &mut self, schema: Option<&str>, table: &str, ) -> Result<QueryResult, SqlError>

Describe the columns of a single table.
Source§

fn primary_key( &mut self, schema: Option<&str>, table: &str, ) -> Result<Vec<String>, SqlError>

Return the column names of table’s primary key, in key position order. Returns an empty Vec when the table has no declared PK. Must not infer a PK from unique indexes — only declared primary-key constraints.
Source§

fn list_foreign_keys( &mut self, schema: Option<&str>, ) -> Result<Vec<ForeignKey>, SqlError>

Return every foreign-key edge in schema (or the default schema if None). Used by schema-level copy to order tables — parents before children.
Source§

fn bulk_insert_rows( &mut self, target: BulkInsert<'_>, ) -> Result<usize, SqlError>

Insert target.rows into target.table using the backend’s native bulk loader. Returns the number of rows accepted, or SqlError::BulkUnavailable when the backend has no native loader so the caller can fall back to the generic INSERT path. Blocks until the whole batch has streamed to the server.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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> 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 T
where 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

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<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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 T
where 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