Reuse the same vec during copies

This commit is contained in:
Steven Fackler 2014-10-28 09:16:11 -07:00
parent 5dd09ce9c4
commit 4a9ca42b20

View File

@ -1666,11 +1666,13 @@ impl<'a> PostgresCopyInStatement<'a> {
}
}
let mut data = buf.unwrap();
try_pg_desync!(conn, conn.stream.write_message(
&CopyData {
data: buf.unwrap()[]
data: data[]
}));
buf = MemWriter::new();
data.clear();
buf = MemWriter::from_vec(data);
}
let _ = buf.write_be_i16(-1);