@@ -478,7 +478,9 @@ fn transaction_commit() {
478
478
. unwrap ( ) ;
479
479
480
480
let f = client. batch_execute ( "INSERT INTO foo (name) VALUES ('steven')" ) ;
481
- runtime. block_on ( client. transaction ( ) . build ( f) ) . unwrap ( ) ;
481
+ runtime
482
+ . block_on ( client. build_transaction ( ) . build ( f) )
483
+ . unwrap ( ) ;
482
484
483
485
let rows = runtime
484
486
. block_on (
@@ -514,7 +516,9 @@ fn transaction_abort() {
514
516
. batch_execute ( "INSERT INTO foo (name) VALUES ('steven')" )
515
517
. map_err ( |e| Box :: new ( e) as Box < dyn Error > )
516
518
. and_then ( |_| Err :: < ( ) , _ > ( Box :: < dyn Error > :: from ( "" ) ) ) ;
517
- runtime. block_on ( client. transaction ( ) . build ( f) ) . unwrap_err ( ) ;
519
+ runtime
520
+ . block_on ( client. build_transaction ( ) . build ( f) )
521
+ . unwrap_err ( ) ;
518
522
519
523
let rows = runtime
520
524
. block_on (
@@ -647,27 +651,25 @@ fn transaction_builder_around_moved_client() {
647
651
let connection = connection. map_err ( |e| panic ! ( "{}" , e) ) ;
648
652
runtime. handle ( ) . spawn ( connection) . unwrap ( ) ;
649
653
650
- let transaction_builder = client. transaction ( ) ;
651
- let work = future :: lazy ( move || {
652
- let execute = client . batch_execute (
654
+ let transaction_builder = client. build_transaction ( ) ;
655
+ let work = client
656
+ . batch_execute (
653
657
"CREATE TEMPORARY TABLE transaction_foo (
654
- id SERIAL,
655
- name TEXT
656
- )" ,
657
- ) ;
658
-
659
- execute. and_then ( move |_| {
658
+ id SERIAL,
659
+ name TEXT
660
+ )" ,
661
+ )
662
+ . and_then ( move |_| {
660
663
client
661
664
. prepare ( "INSERT INTO transaction_foo (name) VALUES ($1), ($2)" )
662
665
. map ( |statement| ( client, statement) )
663
666
} )
664
- } )
665
- . and_then ( |( mut client, statement) | {
666
- client
667
- . query ( & statement, & [ & "jim" , & "joe" ] )
668
- . collect ( )
669
- . map ( |_res| client)
670
- } ) ;
667
+ . and_then ( |( mut client, statement) | {
668
+ client
669
+ . query ( & statement, & [ & "jim" , & "joe" ] )
670
+ . collect ( )
671
+ . map ( |_res| client)
672
+ } ) ;
671
673
672
674
let transaction = transaction_builder. build ( work) ;
673
675
let mut client = runtime. block_on ( transaction) . unwrap ( ) ;
0 commit comments