pub struct Statement {
pub parts: Vec<SqlPart>,
pub expected_response: ExpectedSqlResponse,
/* private fields */
}
Expand description
Sql message
Fields§
§parts: Vec<SqlPart>
The SQL statement
expected_response: ExpectedSqlResponse
The expected response type
Implementations§
Source§impl Statement
impl Statement
Sourcepub fn to_sql(self) -> Result<(String, Vec<Value>), Error>
pub fn to_sql(self) -> Result<(String, Vec<Value>), Error>
Convert Statement into a SQL statement and the list of placeholders
By default it converts the statement into placeholder using $1..$n placeholders which seems to be more widely supported, although it can be reimplemented with other formats since part is public
Sourcepub fn bind_vec<C, V>(self, name: C, value: Vec<V>) -> Self
pub fn bind_vec<C, V>(self, name: C, value: Vec<V>) -> Self
Binds a single variable with a vector.
This will rewrite the function from :foo
(where value is vec![1, 2, 3]) to :foo0, :foo1, :foo2
and binds each value from the value vector accordingly.
Sourcepub async fn pluck<C>(self, conn: &C) -> Result<Option<Value>, Error>where
C: DatabaseExecutor,
pub async fn pluck<C>(self, conn: &C) -> Result<Option<Value>, Error>where
C: DatabaseExecutor,
Executes a query and returns the affected rows
Sourcepub async fn batch<C>(self, conn: &C) -> Result<(), Error>where
C: DatabaseExecutor,
pub async fn batch<C>(self, conn: &C) -> Result<(), Error>where
C: DatabaseExecutor,
Executes a query and returns the affected rows
Sourcepub async fn execute<C>(self, conn: &C) -> Result<usize, Error>where
C: DatabaseExecutor,
pub async fn execute<C>(self, conn: &C) -> Result<usize, Error>where
C: DatabaseExecutor,
Executes a query and returns the affected rows
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Statement
impl RefUnwindSafe for Statement
impl Send for Statement
impl Sync for Statement
impl Unpin for Statement
impl UnwindSafe for Statement
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