Fix for nightly changes

This commit is contained in:
Steven Fackler 2014-11-20 10:54:40 -08:00
parent 1fa5941562
commit b21300e344
2 changed files with 7 additions and 6 deletions

View File

@ -518,9 +518,9 @@ impl InnerConnection {
fn prepare_copy_in<'a>(&mut self, table: &str, rows: &[&str], conn: &'a Connection)
-> Result<CopyInStatement<'a>> {
let mut query = vec![];
let _ = write!(query, "SELECT ");
let _ = write!(&mut query, "SELECT ");
let _ = util::comma_join(&mut query, rows.iter().map(|&e| e));
let _ = write!(query, " FROM {}", table);
let _ = write!(&mut query, " FROM {}", table);
let query = String::from_utf8(query).unwrap();
let (stmt_name, _, result_desc) = try!(self.raw_prepare(query[]));
@ -528,9 +528,9 @@ impl InnerConnection {
try!(self.close_statement(stmt_name[]));
let mut query = vec![];
let _ = write!(query, "COPY {} (", table);
let _ = write!(&mut query, "COPY {} (", table);
let _ = util::comma_join(&mut query, rows.iter().map(|&e| e));
let _ = write!(query, ") FROM STDIN WITH (FORMAT binary)");
let _ = write!(&mut query, ") FROM STDIN WITH (FORMAT binary)");
let query = String::from_utf8(query).unwrap();
let (stmt_name, _, _) = try!(self.raw_prepare(query[]));

View File

@ -2,6 +2,7 @@ use serialize::json;
use std::collections::HashMap;
use std::f32;
use std::f64;
use std::fmt;
use std::num::Float;
use postgres::{Connection, SslMode};
@ -53,10 +54,10 @@ mod uuid;
#[cfg(feature = "time")]
mod time;
fn test_type<T: PartialEq+FromSql+ToSql, S: Str>(sql_type: &str, checks: &[(T, S)]) {
fn test_type<T: PartialEq+FromSql+ToSql, S: fmt::Show>(sql_type: &str, checks: &[(T, S)]) {
let conn = or_panic!(Connection::connect("postgres://postgres@localhost", &SslMode::None));
for &(ref val, ref repr) in checks.iter() {
let stmt = or_panic!(conn.prepare(format!("SELECT {:s}::{}", *repr, sql_type)[]));
let stmt = or_panic!(conn.prepare(format!("SELECT {}::{}", *repr, sql_type)[]));
let result = or_panic!(stmt.query(&[])).next().unwrap().get(0u);
assert!(val == &result);