@@ -97,10 +97,10 @@ fn test_unknown_database() {
9797#[ test]
9898fn test_transaction_commit ( ) {
9999 let conn = PostgresConnection :: connect ( "postgres://postgres@localhost" , & NoSsl ) ;
100- conn. update ( "CREATE TEMPORARY TABLE foo (id INT PRIMARY KEY)" , [ ] ) ;
100+ conn. execute ( "CREATE TEMPORARY TABLE foo (id INT PRIMARY KEY)" , [ ] ) ;
101101
102102 let trans = conn. transaction ( ) ;
103- trans. update ( "INSERT INTO foo (id) VALUES ($1)" , [ & 1i32 as & ToSql ] ) ;
103+ trans. execute ( "INSERT INTO foo (id) VALUES ($1)" , [ & 1i32 as & ToSql ] ) ;
104104 drop ( trans) ;
105105
106106 let stmt = conn. prepare ( "SELECT * FROM foo" ) ;
@@ -112,12 +112,12 @@ fn test_transaction_commit() {
112112#[ test]
113113fn test_transaction_rollback ( ) {
114114 let conn = PostgresConnection :: connect ( "postgres://postgres@localhost" , & NoSsl ) ;
115- conn. update ( "CREATE TEMPORARY TABLE foo (id INT PRIMARY KEY)" , [ ] ) ;
115+ conn. execute ( "CREATE TEMPORARY TABLE foo (id INT PRIMARY KEY)" , [ ] ) ;
116116
117- conn. update ( "INSERT INTO foo (id) VALUES ($1)" , [ & 1i32 as & ToSql ] ) ;
117+ conn. execute ( "INSERT INTO foo (id) VALUES ($1)" , [ & 1i32 as & ToSql ] ) ;
118118
119119 let trans = conn. transaction ( ) ;
120- trans. update ( "INSERT INTO foo (id) VALUES ($1)" , [ & 2i32 as & ToSql ] ) ;
120+ trans. execute ( "INSERT INTO foo (id) VALUES ($1)" , [ & 2i32 as & ToSql ] ) ;
121121 trans. set_rollback ( ) ;
122122 drop ( trans) ;
123123
@@ -130,33 +130,33 @@ fn test_transaction_rollback() {
130130#[ test]
131131fn test_nested_transactions ( ) {
132132 let conn = PostgresConnection :: connect ( "postgres://postgres@localhost" , & NoSsl ) ;
133- conn. update ( "CREATE TEMPORARY TABLE foo (id INT PRIMARY KEY)" , [ ] ) ;
133+ conn. execute ( "CREATE TEMPORARY TABLE foo (id INT PRIMARY KEY)" , [ ] ) ;
134134
135- conn. update ( "INSERT INTO foo (id) VALUES (1)" , [ ] ) ;
135+ conn. execute ( "INSERT INTO foo (id) VALUES (1)" , [ ] ) ;
136136
137137 {
138138 let trans1 = conn. transaction ( ) ;
139- trans1. update ( "INSERT INTO foo (id) VALUES (2)" , [ ] ) ;
139+ trans1. execute ( "INSERT INTO foo (id) VALUES (2)" , [ ] ) ;
140140
141141 {
142142 let trans2 = trans1. transaction ( ) ;
143- trans2. update ( "INSERT INTO foo (id) VALUES (3)" , [ ] ) ;
143+ trans2. execute ( "INSERT INTO foo (id) VALUES (3)" , [ ] ) ;
144144 trans2. set_rollback ( ) ;
145145 }
146146
147147 {
148148 let trans2 = trans1. transaction ( ) ;
149- trans2. update ( "INSERT INTO foo (id) VALUES (4)" , [ ] ) ;
149+ trans2. execute ( "INSERT INTO foo (id) VALUES (4)" , [ ] ) ;
150150
151151 {
152152 let trans3 = trans2. transaction ( ) ;
153- trans3. update ( "INSERT INTO foo (id) VALUES (5)" , [ ] ) ;
153+ trans3. execute ( "INSERT INTO foo (id) VALUES (5)" , [ ] ) ;
154154 trans3. set_rollback ( ) ;
155155 }
156156
157157 {
158158 let trans3 = trans2. transaction ( ) ;
159- trans3. update ( "INSERT INTO foo (id) VALUES (6)" , [ ] ) ;
159+ trans3. execute ( "INSERT INTO foo (id) VALUES (6)" , [ ] ) ;
160160 }
161161 }
162162
@@ -177,8 +177,8 @@ fn test_nested_transactions() {
177177#[ test]
178178fn test_query ( ) {
179179 let conn = PostgresConnection :: connect ( "postgres://postgres@localhost" , & NoSsl ) ;
180- conn. update ( "CREATE TEMPORARY TABLE foo (id BIGINT PRIMARY KEY)" , [ ] ) ;
181- conn. update ( "INSERT INTO foo (id) VALUES ($1), ($2)" ,
180+ conn. execute ( "CREATE TEMPORARY TABLE foo (id BIGINT PRIMARY KEY)" , [ ] ) ;
181+ conn. execute ( "INSERT INTO foo (id) VALUES ($1), ($2)" ,
182182 [ & 1i64 as & ToSql , & 2i64 as & ToSql ] ) ;
183183 let stmt = conn. prepare ( "SELECT * from foo ORDER BY id" ) ;
184184 let result = stmt. query ( [ ] ) ;
@@ -192,11 +192,11 @@ fn test_lazy_query() {
192192
193193 {
194194 let trans = conn. transaction ( ) ;
195- trans. update ( "CREATE TEMPORARY TABLE foo (id INT PRIMARY KEY)" , [ ] ) ;
195+ trans. execute ( "CREATE TEMPORARY TABLE foo (id INT PRIMARY KEY)" , [ ] ) ;
196196 let stmt = trans. prepare ( "INSERT INTO foo (id) VALUES ($1)" ) ;
197197 let values = ~[ 0i32 , 1 , 2 , 3 , 4 , 5 ] ;
198198 for value in values. iter ( ) {
199- stmt. update ( [ value as & ToSql ] ) ;
199+ stmt. execute ( [ value as & ToSql ] ) ;
200200 }
201201
202202 let stmt = trans. prepare ( "SELECT id FROM foo ORDER BY id" ) ;
@@ -298,11 +298,11 @@ fn test_text_params() {
298298#[test]
299299fn test_bpchar_params() {
300300 let conn = PostgresConnection::connect(" postgres: //postgres@localhost", &NoSsl);
301- conn. update ( "CREATE TEMPORARY TABLE foo (
301+ conn. execute ( "CREATE TEMPORARY TABLE foo (
302302 id SERIAL PRIMARY KEY,
303303 b CHAR(5)
304304 )" , [ ] ) ;
305- conn. update ( "INSERT INTO foo (b) VALUES ($1), ($2), ($3)" ,
305+ conn. execute ( "INSERT INTO foo (b) VALUES ($1), ($2), ($3)" ,
306306 [ & Some ( "12345" ) as & ToSql , & Some ( "123" ) as & ToSql ,
307307 & None :: <~str > as & ToSql ] ) ;
308308 let stmt = conn. prepare( "SELECT b FROM foo ORDER BY id" ) ;
@@ -587,21 +587,21 @@ fn test_f64_nan_param() {
587587#[ should_fail]
588588fn test_wrong_param_type( ) {
589589 let conn = PostgresConnection :: connect( "postgres://postgres@localhost" , & NoSsl ) ;
590- conn. try_update ( "SELECT $1::VARCHAR" , [ & 1i32 as & ToSql ] ) ;
590+ conn. try_execute ( "SELECT $1::VARCHAR" , [ & 1i32 as & ToSql ] ) ;
591591}
592592
593593#[ test]
594594#[ should_fail]
595595fn test_too_few_params( ) {
596596 let conn = PostgresConnection :: connect( "postgres://postgres@localhost" , & NoSsl ) ;
597- conn. try_update ( "SELECT $1::INT, $2::INT" , [ & 1i32 as & ToSql ] ) ;
597+ conn. try_execute ( "SELECT $1::INT, $2::INT" , [ & 1i32 as & ToSql ] ) ;
598598}
599599
600600#[ test]
601601#[ should_fail]
602602fn test_too_many_params( ) {
603603 let conn = PostgresConnection :: connect( "postgres://postgres@localhost" , & NoSsl ) ;
604- conn. try_update ( "SELECT $1::INT, $2::INT" , [ & 1i32 as & ToSql ,
604+ conn. try_execute ( "SELECT $1::INT, $2::INT" , [ & 1i32 as & ToSql ,
605605 & 2i32 as & ToSql ,
606606 & 3i32 as & ToSql ] ) ;
607607}
@@ -638,12 +638,12 @@ fn test_custom_notice_handler() {
638638
639639 let conn = PostgresConnection :: connect( "postgres://postgres@localhost?client_min_messages=NOTICE" , & NoSsl ) ;
640640 conn. set_notice_handler( ~Handler as ~PostgresNoticeHandler ) ;
641- conn. update ( "CREATE FUNCTION pg_temp.note() RETURNS INT AS $$
641+ conn. execute ( "CREATE FUNCTION pg_temp.note() RETURNS INT AS $$
642642 BEGIN
643643 RAISE NOTICE 'note';
644644 RETURN 1;
645645 END; $$ LANGUAGE plpgsql" , [ ] ) ;
646- conn. update ( "SELECT pg_temp.note()" , [ ] ) ;
646+ conn. execute ( "SELECT pg_temp.note()" , [ ] ) ;
647647
648648 assert_eq!( unsafe { count } , 1 ) ;
649649}
@@ -669,10 +669,10 @@ fn test_notification_iterator_some() {
669669
670670 let conn = PostgresConnection :: connect( "postgres://postgres@localhost" , & NoSsl ) ;
671671 let mut it = conn. notifications( ) ;
672- conn. update ( "LISTEN test_notification_iterator_one_channel" , [ ] ) ;
673- conn. update ( "LISTEN test_notification_iterator_one_channel2" , [ ] ) ;
674- conn. update ( "NOTIFY test_notification_iterator_one_channel, 'hello'" , [ ] ) ;
675- conn. update ( "NOTIFY test_notification_iterator_one_channel2, 'world'" , [ ] ) ;
672+ conn. execute ( "LISTEN test_notification_iterator_one_channel" , [ ] ) ;
673+ conn. execute ( "LISTEN test_notification_iterator_one_channel2" , [ ] ) ;
674+ conn. execute ( "NOTIFY test_notification_iterator_one_channel, 'hello'" , [ ] ) ;
675+ conn. execute ( "NOTIFY test_notification_iterator_one_channel2, 'world'" , [ ] ) ;
676676
677677 check_notification( PostgresNotification {
678678 pid: 0 ,
@@ -686,7 +686,7 @@ fn test_notification_iterator_some() {
686686 }, it.next());
687687 assert!(it.next().is_none());
688688
689- conn.update (" NOTIFY test_notification_iterator_one_channel, '!' ", []);
689+ conn.execute (" NOTIFY test_notification_iterator_one_channel, '!' ", []);
690690 check_notification(PostgresNotification {
691691 pid: 0,
692692 channel: ~" test_notification_iterator_one_channel",
@@ -707,7 +707,7 @@ fn test_cancel_query() {
707707 cancel_data) . is_ok( ) ) ;
708708 }
709709
710- match conn. try_update ( "SELECT pg_sleep(10)" , [ ] ) {
710+ match conn. try_execute ( "SELECT pg_sleep(10)" , [ ] ) {
711711 Err ( PostgresDbError { code: QueryCanceled , .. } ) => { }
712712 res => fail!( "Unexpected result {:?}" , res)
713713 }
@@ -718,15 +718,15 @@ fn test_require_ssl_conn() {
718718 let ctx = SslContext :: new( Sslv3 ) ;
719719 let conn = PostgresConnection :: connect( "postgres://postgres@localhost" ,
720720 & RequireSsl ( ctx) ) ;
721- conn. update ( "SELECT 1::VARCHAR" , [ ] ) ;
721+ conn. execute ( "SELECT 1::VARCHAR" , [ ] ) ;
722722}
723723
724724#[ test]
725725fn test_prefer_ssl_conn( ) {
726726 let ctx = SslContext :: new( Sslv3 ) ;
727727 let conn = PostgresConnection :: connect( "postgres://postgres@localhost" ,
728728 & PreferSsl ( ctx) ) ;
729- conn. update ( "SELECT 1::VARCHAR" , [ ] ) ;
729+ conn. execute ( "SELECT 1::VARCHAR" , [ ] ) ;
730730}
731731
732732#[ test]
0 commit comments