Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/queryable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ pub trait Queryable: Send {
/// [stmt_cache_size]: crate::Opts::stmt_cache_size
fn prep<'a, Q>(&'a mut self, query: Q) -> BoxFuture<'a, Statement>
where
Q: AsRef<str> + Sync + Send + 'a;
Q: AsQuery + 'a;

/// Closes the given statement.
///
Expand Down Expand Up @@ -464,9 +464,9 @@ impl Queryable for Conn {

fn prep<'a, Q>(&'a mut self, query: Q) -> BoxFuture<'a, Statement>
where
Q: AsRef<str> + Sync + Send + 'a,
Q: AsQuery + 'a,
{
async move { self.get_statement(query.as_ref()).await }.boxed()
async move { self.get_statement(query.as_query()).await }.boxed()
}

fn close(&mut self, stmt: Statement) -> BoxFuture<'_, ()> {
Expand Down Expand Up @@ -533,7 +533,7 @@ impl Queryable for Transaction<'_> {

fn prep<'a, Q>(&'a mut self, query: Q) -> BoxFuture<'a, Statement>
where
Q: AsRef<str> + Sync + Send + 'a,
Q: AsQuery + 'a,
{
self.0.prep(query)
}
Expand Down
45 changes: 45 additions & 0 deletions src/queryable/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,51 @@ impl StatementLike for Arc<str> {
}
}

impl StatementLike for Cow<'_, [u8]> {
fn to_statement<'a>(self, conn: &'a mut crate::Conn) -> ToStatementResult<'a>
where
Self: 'a,
{
to_statement_move(self, conn)
}
}

impl StatementLike for &'_ [u8] {
fn to_statement<'a>(self, conn: &'a mut crate::Conn) -> ToStatementResult<'a>
where
Self: 'a,
{
to_statement_move(self, conn)
}
}

impl StatementLike for Vec<u8> {
fn to_statement<'a>(self, conn: &'a mut crate::Conn) -> ToStatementResult<'a>
where
Self: 'a,
{
to_statement_move(self, conn)
}
}

impl StatementLike for Box<[u8]> {
fn to_statement<'a>(self, conn: &'a mut crate::Conn) -> ToStatementResult<'a>
where
Self: 'a,
{
to_statement_move(self, conn)
}
}

impl StatementLike for Arc<[u8]> {
fn to_statement<'a>(self, conn: &'a mut crate::Conn) -> ToStatementResult<'a>
where
Self: 'a,
{
to_statement_move(self, conn)
}
}

impl StatementLike for Statement {
fn to_statement<'a>(self, _conn: &'a mut crate::Conn) -> ToStatementResult<'static>
where
Expand Down