pub async fn prepare(&mut self, query: &str) -> Result<Statement, Error> {
        let query_owned = query.to_owned();
        match self.statement_cache.map.get(&query_owned) {
            Some(statement) => Ok(statement.clone()),
            None => {
                let stmt = self.txn.prepare(query).await?;
                self.statement_cache.map
                    .insert(query_owned.clone(), stmt.clone());
                Ok(stmt)
            }
        }
    }
/// Creates a new prepared statement using the statement cache if possible.
///
/// See [`tokio_postgres::Transaction::prepare`](#method.prepare-1)
Creates a new prepared statement using the statement cache if possible.
Creates a new prepared statement using the statement cache if possible .
pub async fn prepare(&mut self, query: &str) -> Result<Statement, Error> {
        let query_owned = query.to_owned();
        match self.statement_cache.map.get(&query_owned) {
            Some(statement) => Ok(statement.clone()),
            None => {
                let stmt = self.txn.prepare(query).await?;
                self.statement_cache.map
                    .insert(query_owned.clone(), stmt.clone());
                Ok(stmt)
            }
        }
    }
pub async fn prepare ( & mut self , query : & str ) -> Result < Statement , Error > { let query_owned = query . to_owned ( ) ; match self . statement_cache . map . get ( & query_owned ) { Some ( statement ) => Ok ( statement . clone ( ) ) , None => { let stmt = self . txn . prepare ( query ) . await ? ; self . statement_cache . map . insert ( query_owned . clone ( ) , stmt . clone ( ) ) ; Ok ( stmt ) } } }
Creates a new prepared statement using the statement cache if possible.
Creates a new prepared statement using the statement cache if possible .
&mut self
query
&str
&mut self
query
&str