@@ -149,7 +149,8 @@ impl<'conn> Statement<'conn> {
149
149
try!( conn. stream . write_message2 ( |buf| {
150
150
frontend:: copy_fail ( "COPY queries cannot be directly executed" , buf)
151
151
} ) ) ;
152
- try!( conn. stream . write_message ( & frontend:: Sync ) ) ;
152
+ try!( conn. stream
153
+ . write_message2 ( |buf| Ok :: < ( ) , io:: Error > ( frontend:: sync ( buf) ) ) ) ;
153
154
try!( conn. stream . flush ( ) ) ;
154
155
}
155
156
backend:: Message :: CopyOutResponse { .. } => {
@@ -300,10 +301,12 @@ impl<'conn> Statement<'conn> {
300
301
}
301
302
Err ( err) => {
302
303
try!( info. conn . stream . write_message2 ( |buf| frontend:: copy_fail ( "" , buf) ) ) ;
303
- try!( info. conn . stream . write_message2 ( |buf| {
304
- Ok :: < ( ) , io:: Error > ( frontend:: copy_done ( buf) )
305
- } ) ) ;
306
- try!( info. conn . stream . write_message ( & frontend:: Sync ) ) ;
304
+ try!( info. conn
305
+ . stream
306
+ . write_message2 ( |buf| Ok :: < ( ) , io:: Error > ( frontend:: copy_done ( buf) ) ) ) ;
307
+ try!( info. conn
308
+ . stream
309
+ . write_message2 ( |buf| Ok :: < ( ) , io:: Error > ( frontend:: sync ( buf) ) ) ) ;
307
310
try!( info. conn . stream . flush ( ) ) ;
308
311
match try!( info. conn . read_message ( ) ) {
309
312
backend:: Message :: ErrorResponse { .. } => {
@@ -320,10 +323,8 @@ impl<'conn> Statement<'conn> {
320
323
}
321
324
}
322
325
323
- try!( info. conn . stream . write_message2 ( |buf| {
324
- Ok :: < ( ) , io:: Error > ( frontend:: copy_done ( buf) )
325
- } ) ) ;
326
- try!( info. conn . stream . write_message ( & frontend:: Sync ) ) ;
326
+ try!( info. conn . stream . write_message2 ( |buf| Ok :: < ( ) , io:: Error > ( frontend:: copy_done ( buf) ) ) ) ;
327
+ try!( info. conn . stream . write_message2 ( |buf| Ok :: < ( ) , io:: Error > ( frontend:: sync ( buf) ) ) ) ;
327
328
try!( info. conn . stream . flush ( ) ) ;
328
329
329
330
let num = match try!( info. conn . read_message ( ) ) {
@@ -374,10 +375,9 @@ impl<'conn> Statement<'conn> {
374
375
}
375
376
backend:: Message :: CopyInResponse { .. } => {
376
377
try!( conn. stream . write_message2 ( |buf| frontend:: copy_fail ( "" , buf) ) ) ;
377
- try!( conn. stream . write_message2 ( |buf| {
378
- Ok :: < ( ) , io:: Error > ( frontend:: copy_done ( buf) )
379
- } ) ) ;
380
- try!( conn. stream . write_message ( & frontend:: Sync ) ) ;
378
+ try!( conn. stream
379
+ . write_message2 ( |buf| Ok :: < ( ) , io:: Error > ( frontend:: copy_done ( buf) ) ) ) ;
380
+ try!( conn. stream . write_message2 ( |buf| Ok :: < ( ) , io:: Error > ( frontend:: sync ( buf) ) ) ) ;
381
381
try!( conn. stream . flush ( ) ) ;
382
382
match try!( conn. read_message ( ) ) {
383
383
backend:: Message :: ErrorResponse { .. } => {
@@ -425,7 +425,7 @@ impl<'conn> Statement<'conn> {
425
425
Err ( e) => {
426
426
loop {
427
427
if let backend:: Message :: ReadyForQuery { .. } =
428
- try!( info. conn . read_message ( ) ) {
428
+ try!( info. conn . read_message ( ) ) {
429
429
return Err ( Error :: Io ( e) ) ;
430
430
}
431
431
}
@@ -441,15 +441,15 @@ impl<'conn> Statement<'conn> {
441
441
backend:: Message :: ErrorResponse { fields } => {
442
442
loop {
443
443
if let backend:: Message :: ReadyForQuery { .. } =
444
- try!( info. conn . read_message ( ) ) {
444
+ try!( info. conn . read_message ( ) ) {
445
445
return DbError :: new ( fields) ;
446
446
}
447
447
}
448
448
}
449
449
_ => {
450
450
loop {
451
451
if let backend:: Message :: ReadyForQuery { .. } =
452
- try!( info. conn . read_message ( ) ) {
452
+ try!( info. conn . read_message ( ) ) {
453
453
return Err ( Error :: Io ( bad_response ( ) ) ) ;
454
454
}
455
455
}
0 commit comments