Don't consume Statement
This commit is contained in:
parent
8b1034ad4e
commit
38b491bffb
@ -616,13 +616,12 @@ impl Statement {
|
||||
&self.columns
|
||||
}
|
||||
|
||||
pub fn execute(self,
|
||||
pub fn execute(&self,
|
||||
params: &[&ToSql],
|
||||
conn: Connection)
|
||||
-> BoxFuture<(u64, Statement, Connection), Error> {
|
||||
-> BoxFuture<(u64, Connection), Error> {
|
||||
conn.raw_execute(&self.name, "", &self.params, params)
|
||||
.and_then(|conn| conn.finish_execute())
|
||||
.map(|(n, conn)| (n, self, conn))
|
||||
.boxed()
|
||||
}
|
||||
}
|
||||
|
@ -113,11 +113,11 @@ fn prepare_execute() {
|
||||
c.unwrap().prepare("CREATE TEMPORARY TABLE foo (id SERIAL PRIMARY KEY, name VARCHAR)")
|
||||
})
|
||||
.and_then(|(s, c)| s.execute(&[], c))
|
||||
.and_then(|(n, _, c)| {
|
||||
.and_then(|(n, c)| {
|
||||
assert_eq!(0, n);
|
||||
c.prepare("INSERT INTO foo (name) VALUES ($1), ($2)")
|
||||
})
|
||||
.and_then(|(s, c)| s.execute(&[&"steven", &"bob"], c))
|
||||
.map(|(n, _, _)| assert_eq!(n, 2));
|
||||
.map(|(n, _)| assert_eq!(n, 2));
|
||||
l.run(done).unwrap();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user