Fix message names

This commit is contained in:
Steven Fackler 2016-04-04 22:52:59 -07:00
parent c16d1447fa
commit e418a62499
2 changed files with 7 additions and 8 deletions

View File

@ -30,11 +30,10 @@ pub enum Backend {
CommandComplete {
tag: String,
},
// FIXME naming
BCopyData {
CopyData {
data: Vec<u8>,
},
BCopyDone,
CopyDone,
CopyInResponse {
format: u8,
column_formats: Vec<u16>,
@ -348,12 +347,12 @@ impl<R: BufRead + StreamOptions> ReadMessage for R {
payload: try!(rdr.read_cstr()),
}
}
b'c' => Backend::BCopyDone,
b'c' => Backend::CopyDone,
b'C' => Backend::CommandComplete { tag: try!(rdr.read_cstr()) },
b'd' => {
let mut data = vec![];
try!(rdr.read_to_end(&mut data));
Backend::BCopyData { data: data }
Backend::CopyData { data: data }
}
b'D' => try!(read_data_row(&mut rdr)),
b'E' => Backend::ErrorResponse { fields: try!(read_fields(&mut rdr)) },

View File

@ -154,7 +154,7 @@ impl<'conn> Statement<'conn> {
Backend::CopyOutResponse { .. } => {
loop {
match try!(conn.read_message()) {
Backend::BCopyDone => break,
Backend::CopyDone => break,
Backend::ErrorResponse { fields } => {
try!(conn.wait_for_ready());
return DbError::new(fields);
@ -405,7 +405,7 @@ impl<'conn> Statement<'conn> {
let count;
loop {
match try!(info.conn.read_message()) {
Backend::BCopyData { data } => {
Backend::CopyData { data } => {
let mut data = &data[..];
while !data.is_empty() {
match w.write_with_info(data, &info) {
@ -420,7 +420,7 @@ impl<'conn> Statement<'conn> {
}
}
}
Backend::BCopyDone => {}
Backend::CopyDone => {}
Backend::CommandComplete { tag } => {
count = parse_update_count(tag);
break;