pub struct PreparedStatementTracker { /* private fields */ }Expand description
Tracker for prepared statements
Maintains a registry of prepared statements so they can be recreated on new backend connections.
Implementations§
Source§impl PreparedStatementTracker
impl PreparedStatementTracker
Sourcepub fn with_capacity(max_statements: usize) -> Self
pub fn with_capacity(max_statements: usize) -> Self
Create a new tracker with specified capacity
Sourcepub fn register(&mut self, name: String, query: String, param_types: Vec<u32>)
pub fn register(&mut self, name: String, query: String, param_types: Vec<u32>)
Register a prepared statement
§Arguments
name- Statement name (empty for unnamed)query- The SQL queryparam_types- Parameter type OIDs
Sourcepub fn unregister(&mut self, name: &str) -> Option<PreparedStatement>
pub fn unregister(&mut self, name: &str) -> Option<PreparedStatement>
Remove a prepared statement
Sourcepub fn get(&self, name: &str) -> Option<&PreparedStatement>
pub fn get(&self, name: &str) -> Option<&PreparedStatement>
Get a prepared statement by name
Sourcepub fn record_execution(&mut self, name: &str)
pub fn record_execution(&mut self, name: &str)
Record an execution of a statement
Sourcepub fn all_statements(&self) -> impl Iterator<Item = &PreparedStatement>
pub fn all_statements(&self) -> impl Iterator<Item = &PreparedStatement>
Get all statements (for recreation on new connection)
Sourcepub fn generate_prepare_sql(&self) -> Vec<String>
pub fn generate_prepare_sql(&self) -> Vec<String>
Generate PREPARE statements for all tracked statements
Returns SQL to recreate all statements on a new connection.
Sourcepub fn stats(&self) -> TrackerStats
pub fn stats(&self) -> TrackerStats
Get statistics
Trait Implementations§
Source§impl Debug for PreparedStatementTracker
impl Debug for PreparedStatementTracker
Source§impl Default for PreparedStatementTracker
impl Default for PreparedStatementTracker
Source§fn default() -> PreparedStatementTracker
fn default() -> PreparedStatementTracker
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PreparedStatementTracker
impl RefUnwindSafe for PreparedStatementTracker
impl Send for PreparedStatementTracker
impl Sync for PreparedStatementTracker
impl Unpin for PreparedStatementTracker
impl UnsafeUnpin for PreparedStatementTracker
impl UnwindSafe for PreparedStatementTracker
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more