pub struct Connection<'a> { /* private fields */ }Expand description
SQL connection with LRU statement cache.
Implementations§
Source§impl<'a> Connection<'a>
impl<'a> Connection<'a>
Sourcepub fn txn_start_ts(&self) -> Option<i64>
pub fn txn_start_ts(&self) -> Option<i64>
Txn-start UTC µs inside BEGIN/COMMIT, else None.
Sourcepub fn session_timezone(&self) -> String
pub fn session_timezone(&self) -> String
Returns the session time-zone (IANA name or fixed offset). Default "UTC".
Sourcepub fn set_session_timezone(&self, tz: &str) -> Result<()>
pub fn set_session_timezone(&self, tz: &str) -> Result<()>
Set the session time-zone. Accepts IANA names, ISO-8601 offsets, "UTC", "Z".
Sourcepub fn execute(&self, sql: &str) -> Result<ExecutionResult>
pub fn execute(&self, sql: &str) -> Result<ExecutionResult>
Execute a SQL statement. Returns the result.
Sourcepub fn execute_params(
&self,
sql: &str,
params: &[Value],
) -> Result<ExecutionResult>
pub fn execute_params( &self, sql: &str, params: &[Value], ) -> Result<ExecutionResult>
Execute a SQL statement with positional parameters ($1, $2, …).
Sourcepub fn query(&self, sql: &str) -> Result<QueryResult>
pub fn query(&self, sql: &str) -> Result<QueryResult>
Execute a SQL query and return the result set.
Sourcepub fn query_params(&self, sql: &str, params: &[Value]) -> Result<QueryResult>
pub fn query_params(&self, sql: &str, params: &[Value]) -> Result<QueryResult>
Execute a SQL query with positional parameters ($1, $2, …).
Sourcepub fn prepare(&self, sql: &str) -> Result<PreparedStatement<'_, 'a>>
pub fn prepare(&self, sql: &str) -> Result<PreparedStatement<'_, 'a>>
Prepare a SQL statement for repeated execution with parameters.
Sourcepub fn in_transaction(&self) -> bool
pub fn in_transaction(&self) -> bool
Returns true if an explicit transaction is active (BEGIN was issued).
Sourcepub fn table_schema(&self, name: &str) -> Option<TableSchema>
pub fn table_schema(&self, name: &str) -> Option<TableSchema>
Get the schema for a named table.
Sourcepub fn refresh_schema(&self) -> Result<()>
pub fn refresh_schema(&self) -> Result<()>
Reload schemas from the database.
Auto Trait Implementations§
impl<'a> !Freeze for Connection<'a>
impl<'a> !RefUnwindSafe for Connection<'a>
impl<'a> Send for Connection<'a>
impl<'a> !Sync for Connection<'a>
impl<'a> Unpin for Connection<'a>
impl<'a> UnsafeUnpin for Connection<'a>
impl<'a> !UnwindSafe for Connection<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more