This commit is contained in:
Steven Fackler 2015-12-12 19:22:51 -08:00
parent 6fea7624d3
commit bc04239a1d
3 changed files with 10 additions and 6 deletions

View File

@ -746,7 +746,7 @@ impl InnerConnection {
try!(self.wait_for_ready());
return DbError::new(fields);
}
_ => bad_response!(self)
_ => bad_response!(self),
};
match try!(self.read_message()) {
CommandComplete { .. } => {}
@ -973,7 +973,12 @@ impl Connection {
/// ```
pub fn query<'a>(&'a self, query: &str, params: &[&ToSql]) -> Result<Rows<'a>> {
let (param_types, columns) = try!(self.conn.borrow_mut().raw_prepare("", query));
let stmt = Statement::new(self, "".to_owned(), param_types, columns, Cell::new(0), true);
let stmt = Statement::new(self,
"".to_owned(),
param_types,
columns,
Cell::new(0),
true);
stmt.into_query(params)
}

View File

@ -182,7 +182,7 @@ impl<'a> Row<'a> {
let conn = self.stmt.conn().conn.borrow();
match self.data[idx] {
Some(ref data) => FromSql::from_sql(ty, &mut &**data, &SessionInfo::new(&*conn)),
None => FromSql::from_sql_null(ty, &SessionInfo::new(&*conn))
None => FromSql::from_sql_null(ty, &SessionInfo::new(&*conn)),
}
}

View File

@ -65,9 +65,8 @@ impl<'conn> StatementInternals<'conn> for Statement<'conn> {
fn into_query(self, params: &[&ToSql]) -> Result<Rows<'conn>> {
check_desync!(self.conn);
self.inner_query("", 0, params).map(|(buf, _)| {
Rows::new_owned(self, buf.into_iter().collect())
})
self.inner_query("", 0, params)
.map(|(buf, _)| Rows::new_owned(self, buf.into_iter().collect()))
}
}