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
impl Connection for SyncConnection
Source§fn query(&mut self, sql: &str) -> Result<QueryResult, SqlError>
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>
fn execute(&mut self, sql: &str) -> Result<ExecutionSummary, SqlError>
Source§fn size_guards(&self) -> SizeGuards
fn size_guards(&self) -> SizeGuards
SizeGuards::default; the concrete
SyncConnection tracks the real
configured value.Source§fn set_size_guards(&mut self, guards: SizeGuards)
fn set_size_guards(&mut self, guards: SizeGuards)
[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>
fn execute_multi(&mut self, sql: &str) -> Result<Vec<StatementResult>, SqlError>
Source§fn ping(&mut self) -> Result<(), SqlError>
fn ping(&mut self) -> Result<(), SqlError>
SELECT 1). Blocks on a round-trip.Source§fn list_tables(&mut self, schema: Option<&str>) -> Result<Vec<String>, SqlError>
fn list_tables(&mut self, schema: Option<&str>) -> Result<Vec<String>, SqlError>
None).Source§fn list_schemas(&mut self) -> Result<Vec<SchemaInfo>, SqlError>
fn list_schemas(&mut self) -> Result<Vec<SchemaInfo>, SqlError>
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>
fn describe_table( &mut self, schema: Option<&str>, table: &str, ) -> Result<QueryResult, SqlError>
Source§fn primary_key(
&mut self,
schema: Option<&str>,
table: &str,
) -> Result<Vec<String>, SqlError>
fn primary_key( &mut self, schema: Option<&str>, table: &str, ) -> Result<Vec<String>, SqlError>
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>
fn list_foreign_keys( &mut self, schema: Option<&str>, ) -> Result<Vec<ForeignKey>, SqlError>
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>
fn bulk_insert_rows( &mut self, target: BulkInsert<'_>, ) -> Result<usize, SqlError>
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.